1 5 6 package com.raptus.owxv3; 7 8 import java.util.Hashtable ; 9 10 32 public class VModuleSection extends Object 33 { 34 37 protected String identification = null; 38 39 42 protected VModule vmodule = null; 43 44 47 protected String [] elements = null; 48 49 52 protected String [] roles = null; 53 54 57 protected Hashtable sectionElements = null; 58 59 62 public String [] getRoles() 63 { 64 return roles; 65 } 66 67 70 public boolean initialize(String section, VModule vm) 71 { 72 this.identification = section; 73 this.vmodule = vm; 74 sectionElements = new Hashtable (); 75 76 LoggingManager.log("Initialising section "+section, this); 77 XMLConfigManager cm = XMLConfigManager.getInstance(); 79 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 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 119 public String getIdentification() { return identification; } 120 121 124 public VModule getVModule() { return vmodule; } 125 126 129 public String [] getElements() { return elements; } 130 131 134 public VModuleSectionElement getElement(String e) { return (VModuleSectionElement) sectionElements.get(e); } 135 136 } 137 138 139 | Popular Tags |