From a1f0ecbb6a2bea6aa214322c412af2f3c5ce124b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 7 May 2014 17:33:13 +0200 Subject: Agent now extends Item, so they can have workflows. All traces of the old 'Entity' superclasses should be removed, including proxies and paths. Very large change, breaks API compatibility with CRISTAL 2.x. Fixes #135 --- src/main/java/com/c2kernel/lookup/LDAPLookup.java | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/LDAPLookup.java') diff --git a/src/main/java/com/c2kernel/lookup/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/LDAPLookup.java index 4ea6e68..116362e 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPLookup.java +++ b/src/main/java/com/c2kernel/lookup/LDAPLookup.java @@ -12,7 +12,7 @@ import com.c2kernel.common.ObjectCannotBeUpdated; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.TraceableEntity; import com.c2kernel.entity.agent.ActiveEntity; -import com.c2kernel.entity.proxy.EntityProxyManager; +import com.c2kernel.entity.proxy.ProxyManager; import com.c2kernel.entity.proxy.ProxyMessage; import com.c2kernel.process.Gateway; import com.c2kernel.property.PropertyDescription; @@ -67,13 +67,13 @@ public class LDAPLookup Path.mRootPath=props.mRootPath; Path.mLocalPath=props.mLocalPath; - EntityPath.mTypeRoot = "cn=entity,"+props.mLocalPath; + ItemPath.mTypeRoot = "cn=entity,"+props.mLocalPath; DomainPath.mTypeRoot = "cn=domain,"+props.mLocalPath; - mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.mTypeRoot); + mNextKeyManager = new NextKeyManager(this, "cn=last,"+ItemPath.mTypeRoot); Logger.msg(7, "LDAP.useOldProps="+Gateway.getProperties().getBoolean("LDAP.useOldProps", false)); mPropManager = new LDAPPropertyManager(this); - mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, EntityPath.mTypeRoot); + mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, ItemPath.mTypeRoot); } @@ -199,12 +199,12 @@ public class LDAPLookup * * @param domPath * @return - * @throws InvalidEntityPathException + * @throws InvalidItemPathException * @throws ObjectNotFoundException */ - protected EntityPath resolvePath(DomainPath domPath) - throws InvalidEntityPathException, ObjectNotFoundException { - EntityPath referencedPath = null; + protected ItemPath resolvePath(DomainPath domPath) + throws InvalidItemPathException, ObjectNotFoundException { + ItemPath referencedPath = null; LDAPEntry domEntry = LDAPLookupUtils.getEntry(getConnection(), domPath .getFullDN(), LDAPSearchConstraints.DEREF_ALWAYS); String entityKey = LDAPLookupUtils.getFirstAttributeValue(domEntry, @@ -216,7 +216,7 @@ public class LDAPLookup if (objClass.equals("cristalagent")) referencedPath = new AgentPath(Integer.parseInt(entityKey)); else - referencedPath = new EntityPath(Integer.parseInt(entityKey)); + referencedPath = new ItemPath(Integer.parseInt(entityKey)); return referencedPath; } @@ -231,7 +231,7 @@ public class LDAPLookup LDAPEntry newEntry = new LDAPEntry(path.getFullDN(),attrSet); LDAPLookupUtils.addEntry(getConnection(),newEntry); if (path instanceof DomainPath) - EntityProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.ADDED)); + ProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.ADDED)); return newEntry; } catch (LDAPException ex) { if (ex.getResultCode() == LDAPException.ENTRY_ALREADY_EXISTS) @@ -251,7 +251,7 @@ public class LDAPLookup throw new ObjectCannotBeUpdated(ex.getLDAPErrorMessage(), ""); } if (path instanceof DomainPath) { - EntityProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.DELETED)); + ProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.DELETED)); } } @@ -393,7 +393,7 @@ public class LDAPLookup return search(start.getFullDN(), LDAPConnection.SCOPE_SUB, "objectClass=aliasObject", searchCons); } - public LDAPPathSet searchAliases(EntityPath entity) { + public LDAPPathSet searchAliases(ItemPath entity) { LDAPSearchConstraints searchCons = new LDAPSearchConstraints(); searchCons.setBatchSize(0); searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER); @@ -431,7 +431,7 @@ public class LDAPLookup * @throws ObjectNotFoundException * @throws ObjectNotFoundException */ - protected Path nodeToPath(LDAPEntry entry) throws InvalidEntityPathException, ObjectNotFoundException + protected Path nodeToPath(LDAPEntry entry) throws InvalidItemPathException, ObjectNotFoundException { String dn = entry.getDN(); @@ -470,14 +470,14 @@ public class LDAPLookup thisPath = domainPath; } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalentity") || - (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(EntityPath.mTypeRoot))) + (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(ItemPath.mTypeRoot))) { - if(dn.endsWith(EntityPath.mTypeRoot)) { - EntityPath entityPath; + if(dn.endsWith(ItemPath.mTypeRoot)) { + ItemPath entityPath; if (entityKey != -1) - entityPath = new EntityPath(entityKey); + entityPath = new ItemPath(entityKey); else { - entityPath = new EntityPath(); + entityPath = new ItemPath(); entityPath.setDN(dn); } thisPath = entityPath; -- cgit v1.2.3