init(config);
}
protected void init(Document config){
this.groups = new HashMap();
this.contexts = new SmartCache(120);
config.normalize();
int refreshminutes = 120;
Element root = config.getDocumentElement();
NodeList nl = root.getElementsByTagName("config");
if (nl.getLength() == 1){
Element conf = (Element) nl.item(0);
Node cc = conf.getFirstChild();
//NodeList cl= conf.getF.getChildNodes();
//for(int i=0; i<cl.getLength(); i++){
while (cc!=null){
if(cc.getNodeType()==ELEMENT_NODE){
Element c = (Element) cc;
c.normalize();
Node t = c.getFirstChild();
if(t!=null && t.getNodeType()==Node.TEXT_NODE){
String name = c.getNodeName();
String text = ((Text) t).getData();
//System.out.println(name+" = "+text);
if (name.equals("url")){
url = text;
}
else if (name.equals("logonid")){
logonid = text;
}
else if (name.equals("logonpassword")){
logonpassword = text;
}
else if (name.equals("keyfield")){
keyfield = text;
}
else if (name.equals("namefield")){
namefield = text;
}
else if (name.equals("usercontext")){
usercontext = text;
}
else if (name.equals("refresh-minutes")){
try{
refreshminutes = Integer.parseInt(text);
}
catch(Exception e){}
}
}
}
cc = cc.getNextSibling();
}
}
else{
throw new RuntimeException("LDAPGroupStore: config file must contain one config element");
}
this.personkeys = new SmartCache(refreshminutes*60);
NodeList gl = root.getChildNodes();
for (int j=0; j<gl.getLength(); j++){
if(gl.item(j).getNodeType() == ELEMENT_NODE){
Element g = (Element) gl.item(j);