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/entity/proxy/AgentProxy.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/entity/proxy/AgentProxy.java')
| -rw-r--r-- | src/main/java/com/c2kernel/entity/proxy/AgentProxy.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index b6566a8..e5a52f0 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -11,7 +11,7 @@ package com.c2kernel.entity.proxy;
import java.util.Date;
-import java.util.Enumeration;
+import java.util.Iterator;
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.InvalidDataException;
@@ -32,6 +32,7 @@ import com.c2kernel.lookup.Path; import com.c2kernel.persistency.outcome.OutcomeValidator;
import com.c2kernel.persistency.outcome.Schema;
import com.c2kernel.process.Gateway;
+import com.c2kernel.process.auth.Authenticator;
import com.c2kernel.scripting.ErrorInfo;
import com.c2kernel.scripting.Script;
import com.c2kernel.scripting.ScriptErrorException;
@@ -50,6 +51,7 @@ public class AgentProxy extends ItemProxy {
AgentPath agentPath;
+ Authenticator auth;
/**************************************************************************
* Creates an AgentProxy without cache and change notification
**************************************************************************/
@@ -66,7 +68,15 @@ public class AgentProxy extends ItemProxy }
}
- @Override
+ public Authenticator getAuthObj() {
+ return auth;
+ }
+
+ public void setAuthObj(Authenticator auth) {
+ this.auth = auth;
+ }
+
+ @Override
public Agent narrow() throws ObjectNotFoundException
{
try {
@@ -237,14 +247,14 @@ public class AgentProxy extends ItemProxy /** Let scripts resolve items */
public ItemProxy searchItem(String name) throws ObjectNotFoundException {
- Enumeration<Path> results = Gateway.getLDAPLookup().search(new DomainPath(""),name);
+ Iterator<Path> results = Gateway.getLookup().search(new DomainPath(""),name);
Path returnPath = null;
- if (!results.hasMoreElements())
+ if (!results.hasNext())
throw new ObjectNotFoundException(name, "");
- while(results.hasMoreElements()) {
- Path nextMatch = results.nextElement();
+ while(results.hasNext()) {
+ Path nextMatch = results.next();
if (returnPath != null && nextMatch.getSysKey() != -1 && returnPath.getSysKey() != nextMatch.getSysKey())
throw new ObjectNotFoundException("Too many items with that name");
returnPath = nextMatch;
|
