diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-06-05 15:02:07 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-06-05 15:02:07 +0200 |
| commit | d4fa3bd9dd48f4d5e26850a23f5ba48a9c10ad64 (patch) | |
| tree | 5ad7bfbce8ba9df9aad53ef33a8b908ca0680fc4 /src/main/java/com/c2kernel/lookup/RolePath.java | |
| parent | 8bb86312d4f07dcb343ca2d212f4020906dbdb52 (diff) | |
LDAP refactored behind interfaces. All functions of LDAP now hidden
behind interfaces: Authenticator, Lookup and NextKeyManager (LDAP
property storage was already a ClusterStorage). Gateway holds additional
objects, and
Fixes #26 #191. Refs #27 (needs additional work for read perms and auth
tokens)
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/RolePath.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/RolePath.java | 35 |
1 files changed, 10 insertions, 25 deletions
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<AgentPath> getChildren() {
+ public Iterator<Path> getChildren() {
AgentPath[] agents = getAgentsWithRole();
- Vector<AgentPath> children = new Vector<AgentPath>(agents.length);
+ ArrayList<Path> children = new ArrayList<Path>(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;
- }
}
|
