KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > VModuleSection


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3;
7
8 import java.util.Hashtable JavaDoc;
9
10 /**
11  *
12  * <hr>
13  * <table width="100%" border="0">
14  * <tr>
15  * <td width="24%"><b>Filename</b></td><td width="76%">VModuleSection.java</td>
16  * </tr>
17  * <tr>
18  * <td width="24%"><b>Author</b></td><td width="76%">Guy Z�rcher (gzuercher@raptus.com)</td>
19  * </tr>
20  * <tr>
21  * <td width="24%"><b>Date</b></td><td width="76%">26th of April 2001</td>
22  * </tr>
23  * </table>
24  * <hr>
25  * <table width="100%" border="0">
26  * <tr>
27  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
28  * </tr>
29  * </table>
30  * <hr>
31  */

32 public class VModuleSection extends Object JavaDoc
33 {
34     /**
35      *
36      */

37     protected String JavaDoc identification = null;
38
39     /**
40      *
41      */

42     protected VModule vmodule = null;
43
44     /**
45      *
46      */

47     protected String JavaDoc[] elements = null;
48
49     /**
50      * The roles available for this section
51      */

52     protected String JavaDoc[] roles = null;
53     
54     /**
55      *
56      */

57     protected Hashtable JavaDoc sectionElements = null;
58
59     /**
60      * Return the roles available for this vmodule section
61      */

62     public String JavaDoc[] getRoles()
63     {
64         return roles;
65     }
66     
67     /**
68      *
69      */

70     public boolean initialize(String JavaDoc section, VModule vm)
71     {
72         this.identification = section;
73         this.vmodule = vm;
74         sectionElements = new Hashtable JavaDoc();
75
76         LoggingManager.log("Initialising section "+section, this);
77         //Configuration cfg = vmodule.getConfiguration();
78
XMLConfigManager cm = XMLConfigManager.getInstance();
79 // elements = cfg.getStringArrayByKey(Constants.VMODULE_PREFIX + vmodule.getIdentification() +
80
// Constants.VMODULE_SECTION_PREFIX + section +
81
// Constants.VMODULE_SECTION_ELEMENTS);
82

83         roles = cm.getStringArrayByTree("virtualhost/vmodules/vmodule?name="+vm.getIdentification()+"/section/"+section+"/roles","value");
84         if(roles != null)
85         {
86             for(int i=0;i<roles.length;i++)
87             {
88                 LoggingManager.log("Role for section "+section+":"+roles[i], this);
89             }
90         }
91         else
92         {
93             LoggingManager.log("No roles for section "+section, this);
94         }
95         
96         elements = cm.getStringArrayByTree("virtualhost/vmodules/vmodule?name="+vm.getIdentification()+"/section/"+section,"elements");
97         if(elements == null)
98         {
99             LoggingManager.log("No elements found for section " + identification + " in virtual module " +
100                                vmodule.getIdentification(), this);
101             return false;
102         }
103
104         // initialize all elements
105
for(int i = 0; i < elements.length; i ++)
106         {
107             LoggingManager.log("Initialising element "+elements[i],this);
108             VModuleSectionElement element = new VModuleSectionElement();
109             if(element.initialize(elements[i], this))
110                 sectionElements.put(elements[i], element);
111         }
112
113         return true;
114     }
115
116     /**
117      *
118      */

119     public String JavaDoc getIdentification() { return identification; }
120
121     /**
122      *
123      */

124     public VModule getVModule() { return vmodule; }
125
126     /**
127      *
128      */

129     public String JavaDoc[] getElements() { return elements; }
130
131     /**
132      *
133      */

134     public VModuleSectionElement getElement(String JavaDoc e) { return (VModuleSectionElement) sectionElements.get(e); }
135
136 }
137
138 /* end class VModuleSection */
139
Popular Tags