From b96dd998d6c442be19c342399839896d00d4b6f5 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 2 Jun 2014 11:31:08 +0200 Subject: Initial commit --- src/main/java/com/c2kernel/lookup/RolePath.java | 35 +++++++------------------ 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/RolePath.java') diff --git a/src/main/java/com/c2kernel/lookup/RolePath.java b/src/main/java/com/c2kernel/lookup/RolePath.java index 0e07012..bd23991 100644 --- a/src/main/java/com/c2kernel/lookup/RolePath.java +++ b/src/main/java/com/c2kernel/lookup/RolePath.java @@ -10,15 +10,13 @@ package com.c2kernel.lookup; -import java.util.Enumeration; -import java.util.Vector; +import java.util.ArrayList; +import java.util.Iterator; import com.c2kernel.common.ObjectCannotBeUpdated; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; -import com.novell.ldap.LDAPAttribute; -import com.novell.ldap.LDAPAttributeSet; @@ -56,7 +54,7 @@ public class RolePath extends DomainPath */ public void setHasJobList(boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated { this.hasJobList = hasJobList; - Gateway.getLDAPLookup().getRoleManager().setHasJobList(this, hasJobList); + Gateway.getLookup().setHasJobList(this, hasJobList); } @@ -65,18 +63,17 @@ public class RolePath extends DomainPath mType = CONTEXT; } - @Override - public Enumeration getChildren() { + public Iterator getChildren() { AgentPath[] agents = getAgentsWithRole(); - Vector children = new Vector(agents.length); + ArrayList children = new ArrayList(agents.length); for (int i = 0; i < agents.length; i++) children.add(i, agents[i]); - return children.elements(); + return children.iterator(); } public AgentPath[] getAgentsWithRole() { try { - return Gateway.getLDAPLookup().getRoleManager().getAgents(this); + return Gateway.getLookup().getAgents(this); } catch (ObjectNotFoundException ex) { Logger.error("Cannot retrieve agent list. Role "+getName()+" does not exist in LDAP"); return new AgentPath[0]; @@ -84,11 +81,11 @@ public class RolePath extends DomainPath } public void addAgent(AgentPath agent) throws ObjectCannotBeUpdated, ObjectNotFoundException { - Gateway.getLDAPLookup().getRoleManager().addRole(agent, this); + Gateway.getLookup().addRole(agent, this); } public void removeAgent(AgentPath agent) throws ObjectCannotBeUpdated, ObjectNotFoundException { - Gateway.getLDAPLookup().getRoleManager().removeRole(agent, this); + Gateway.getLookup().removeRole(agent, this); } @Override @@ -99,9 +96,7 @@ public class RolePath extends DomainPath return "Path - dump(): "+ comp.toString()+ - "}\n dn="+ - getDN()+ - "\n string="+ + "}\n string="+ toString()+ "\n type="+ mType+ @@ -110,15 +105,5 @@ public class RolePath extends DomainPath "\n "; } - @Override - public LDAPAttributeSet createAttributeSet() - { - LDAPAttributeSet attrs = new LDAPAttributeSet(); - attrs.add(new LDAPAttribute("objectclass","cristalrole")); - String jobListString = hasJobList?"TRUE":"FALSE"; - attrs.add(new LDAPAttribute("jobList",jobListString)); - attrs.add(new LDAPAttribute("cn", getName())); - return attrs; - } } -- cgit v1.2.3