From c6204281c819ea4514952ed7623e282babcb5f8c Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 27 Feb 2013 21:36:23 +0100 Subject: More --- .../java/com/c2kernel/entity/proxy/AgentProxy.java | 10 +++--- .../c2kernel/entity/proxy/EntityProxyManager.java | 7 ++-- .../com/c2kernel/entity/transfer/TransferItem.java | 8 ++--- .../lifecycle/instance/predefined/Erase.java | 8 ++--- src/main/java/com/c2kernel/lookup/AgentPath.java | 15 ++++---- src/main/java/com/c2kernel/lookup/DomainPath.java | 10 ++++-- src/main/java/com/c2kernel/lookup/EntityPath.java | 8 +++++ src/main/java/com/c2kernel/lookup/Lookup.java | 2 +- src/main/java/com/c2kernel/lookup/Path.java | 15 +++----- src/main/java/com/c2kernel/lookup/RoleManager.java | 6 ++++ src/main/java/com/c2kernel/lookup/RolePath.java | 2 -- .../java/com/c2kernel/lookup/ldap/LDAPLookup.java | 41 ++++++++++++---------- .../com/c2kernel/lookup/ldap/LDAPRoleManager.java | 40 ++++++++++++++------- src/main/java/com/c2kernel/process/Bootstrap.java | 8 ++--- src/main/java/com/c2kernel/process/Gateway.java | 2 +- 15 files changed, 105 insertions(+), 77 deletions(-) diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index 6d2b17d..18b8ae8 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; @@ -257,14 +257,14 @@ public class AgentProxy extends EntityProxy /** Let scripts resolve items */ public ItemProxy searchItem(String name) throws ObjectNotFoundException { - Enumeration results = Gateway.getLookup().search(new DomainPath(""),name); + Iterator 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; diff --git a/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java b/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java index 9ed562b..994343a 100644 --- a/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java +++ b/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java @@ -12,7 +12,6 @@ package com.c2kernel.entity.proxy; import java.util.ArrayList; import java.util.ConcurrentModificationException; -import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -47,9 +46,9 @@ public class EntityProxyManager { Logger.msg(5, "EntityProxyManager - Starting....."); - Enumeration servers = Gateway.getLookup().searchEntities(new DomainPath("/servers")); - while(servers.hasMoreElements()) { - Path thisServerPath = servers.nextElement(); + Iterator servers = Gateway.getLookup().searchEntities(new DomainPath("/servers")); + while(servers.hasNext()) { + Path thisServerPath = servers.next(); try { int syskey = thisServerPath.getSysKey(); String remoteServer = ((Property)Gateway.getStorage().get(syskey, ClusterStorage.PROPERTY+"/Name", null)).getValue(); diff --git a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java index 36b8354..c6cf39a 100644 --- a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java +++ b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java @@ -2,7 +2,7 @@ package com.c2kernel.entity.transfer; import java.io.File; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; @@ -37,9 +37,9 @@ public class TransferItem { this.sysKey = sysKey; domainPaths = new ArrayList(); Property name = (Property)Gateway.getStorage().get(sysKey, ClusterStorage.PROPERTY + "/Name", null); - Enumeration paths = Gateway.getLookup().search(new DomainPath(), name.getValue()); - while (paths.hasMoreElements()) { - DomainPath thisPath = (DomainPath)paths.nextElement(); + Iterator paths = Gateway.getLookup().search(new DomainPath(), name.getValue()); + while (paths.hasNext()) { + DomainPath thisPath = (DomainPath)paths.next(); domainPaths.add(thisPath.toString()); } } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java index 6f4e8b6..e668ce9 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java @@ -13,7 +13,7 @@ package com.c2kernel.lifecycle.instance.predefined; -import java.util.Enumeration; +import java.util.Iterator; import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidDataException; @@ -58,9 +58,9 @@ public class Erase extends PredefinedStep Property name = (Property)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.PROPERTY+"/Name", null); // get all domain paths - Enumeration domPaths = Gateway.getLookup().search(new DomainPath(), name.getValue()); - while (domPaths.hasMoreElements()) { - DomainPath path = (DomainPath)domPaths.nextElement(); + Iterator domPaths = Gateway.getLookup().search(new DomainPath(), name.getValue()); + while (domPaths.hasNext()) { + DomainPath path = (DomainPath)domPaths.next(); // delete them if (path.getSysKey() == entityPath.getSysKey()) Gateway.getLookup().delete(path); diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java index c200d75..5dd177b 100644 --- a/src/main/java/com/c2kernel/lookup/AgentPath.java +++ b/src/main/java/com/c2kernel/lookup/AgentPath.java @@ -16,9 +16,8 @@ import java.security.NoSuchAlgorithmException; import org.apache.xerces.impl.dv.util.Base64; import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.lookup.ldap.LDAPLookupUtils; import com.c2kernel.process.Gateway; -import com.novell.ldap.LDAPEntry; +import com.c2kernel.utils.Logger; /** @@ -68,11 +67,11 @@ public class AgentPath extends EntityPath if (mAgentName==null) { try { - LDAPEntry agentEntry = LDAPLookupUtils.getEntry(Gateway.getLookup().getConnection(), this.getDN() + mLocalPath); - mAgentName = LDAPLookupUtils.getFirstAttributeValue(agentEntry,"uid"); - } catch (ObjectNotFoundException e) { - mAgentName = ""; - } + mAgentName = Gateway.getLookup().getRoleManager().getAgentName(this); + } catch (ObjectNotFoundException e) { + Logger.error(e); + mAgentName=""; + } } return mAgentName; } @@ -111,7 +110,7 @@ public class AgentPath extends EntityPath mAgentName; } - static String generateUserPassword(String pass, String algo) throws NoSuchAlgorithmException { + public static String generateUserPassword(String pass, String algo) throws NoSuchAlgorithmException { MessageDigest sha = MessageDigest.getInstance(algo); sha.reset(); sha.update(pass.getBytes()); diff --git a/src/main/java/com/c2kernel/lookup/DomainPath.java b/src/main/java/com/c2kernel/lookup/DomainPath.java index 523ac49..a1c2275 100644 --- a/src/main/java/com/c2kernel/lookup/DomainPath.java +++ b/src/main/java/com/c2kernel/lookup/DomainPath.java @@ -13,8 +13,6 @@ package com.c2kernel.lookup; 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; /** @@ -66,6 +64,14 @@ public class DomainPath extends Path public String getRoot() { return "domain"; } + + public static void setTypeRoot(String root) { + mTypeRoot = root; + } + + public static String getTypeRoot() { + return mTypeRoot; + } public DomainPath getParent() { if (mPath.length == 0) diff --git a/src/main/java/com/c2kernel/lookup/EntityPath.java b/src/main/java/com/c2kernel/lookup/EntityPath.java index 8e93f8f..deb44a3 100644 --- a/src/main/java/com/c2kernel/lookup/EntityPath.java +++ b/src/main/java/com/c2kernel/lookup/EntityPath.java @@ -81,6 +81,14 @@ public class EntityPath extends Path return "entity"; } + public static void setTypeRoot(String root) { + mTypeRoot = root; + } + + public static String getTypeRoot() { + return mTypeRoot; + } + @Override public EntityPath getEntity() throws ObjectNotFoundException { return this; diff --git a/src/main/java/com/c2kernel/lookup/Lookup.java b/src/main/java/com/c2kernel/lookup/Lookup.java index 060b5de..4c79c8b 100644 --- a/src/main/java/com/c2kernel/lookup/Lookup.java +++ b/src/main/java/com/c2kernel/lookup/Lookup.java @@ -31,7 +31,7 @@ public interface Lookup { public void install() throws ObjectNotFoundException; - public void disconnect(); + public void close(); public NextKeyManager getNextKeyManager(); diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java index 3390007..8196d4d 100644 --- a/src/main/java/com/c2kernel/lookup/Path.java +++ b/src/main/java/com/c2kernel/lookup/Path.java @@ -13,12 +13,11 @@ package com.c2kernel.lookup; import java.io.Serializable; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.Gateway; -import com.novell.ldap.LDAPConnection; -import com.novell.ldap.LDAPSearchConstraints; /** @@ -51,10 +50,6 @@ public abstract class Path implements Serializable // // needed for unusual subclass constructors - protected static String mGlobalPath; //cern.ch - protected static String mRootPath; //cristal2 - protected static String mLocalPath; //lab27 - public Path() { } @@ -241,10 +236,10 @@ public abstract class Path implements Serializable } public Path find(String name) throws ObjectNotFoundException { - Enumeration e = Gateway.getLookup().search(this, name); - if (e.hasMoreElements()) { - Path thisPath = e.nextElement(); - if (e.hasMoreElements()) + Iterator e = Gateway.getLookup().search(this, name); + if (e.hasNext()) { + Path thisPath = e.next(); + if (e.hasNext()) throw new ObjectNotFoundException("More than one match for "+name, ""); return thisPath; } diff --git a/src/main/java/com/c2kernel/lookup/RoleManager.java b/src/main/java/com/c2kernel/lookup/RoleManager.java index a483559..0caa215 100644 --- a/src/main/java/com/c2kernel/lookup/RoleManager.java +++ b/src/main/java/com/c2kernel/lookup/RoleManager.java @@ -76,4 +76,10 @@ public interface RoleManager { */ public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFoundException; + /** + * @param agentPath + * @return + */ + public String getAgentName(AgentPath agentPath) throws ObjectNotFoundException; + } diff --git a/src/main/java/com/c2kernel/lookup/RolePath.java b/src/main/java/com/c2kernel/lookup/RolePath.java index cdda034..ee24d63 100644 --- a/src/main/java/com/c2kernel/lookup/RolePath.java +++ b/src/main/java/com/c2kernel/lookup/RolePath.java @@ -17,8 +17,6 @@ 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; diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java index 3ca1749..d52371c 100644 --- a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java @@ -53,6 +53,9 @@ public class LDAPLookup implements Lookup private LDAPPropertyManager mPropManager; private final LDAPRoleManager mRoleManager; + protected static String mGlobalPath; //cern.ch + protected static String mRootPath; //cristal2 + protected static String mLocalPath; //lab27 /** @@ -69,14 +72,14 @@ public class LDAPLookup implements Lookup mLDAPConn = createConnection(mLDAPProps); - Path.mGlobalPath=props.mGlobalPath; - Path.mRootPath=props.mRootPath; - Path.mLocalPath=props.mLocalPath; + mGlobalPath=props.mGlobalPath; + mRootPath=props.mRootPath; + mLocalPath=props.mLocalPath; - EntityPath.mTypeRoot = "cn=entity,"+props.mLocalPath; - DomainPath.mTypeRoot = "cn=domain,"+props.mLocalPath; + EntityPath.setTypeRoot("cn=entity,"+props.mLocalPath); + DomainPath.setTypeRoot("cn=domain,"+props.mLocalPath); - mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.mTypeRoot); + mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.getTypeRoot()); Logger.msg(7, "LDAP.useOldProps="+Gateway.getProperty("LDAP.useOldProps", "false")); if (Gateway.getProperty("LDAP.useOldProps", "false").equals("true")) { Logger.debug(1, "Using Kernel 2.1 LDAP Property Format"); @@ -86,7 +89,7 @@ public class LDAPLookup implements Lookup Logger.debug(1, "Using Kernel 2.2 LDAP Property Format"); mPropManager = new LDAPPropertyManager(this); } - mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, EntityPath.mTypeRoot); + mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.getTypeRoot(), EntityPath.getTypeRoot()); } @@ -159,7 +162,7 @@ public class LDAPLookup implements Lookup * Disconnects the connection with the LDAP server during shutdown */ @Override - public void disconnect() { + public void close() { Logger.msg(1, "LDAP Lookup: Shutting down LDAP connection."); if (mLDAPConn != null) { try { @@ -265,7 +268,7 @@ public class LDAPLookup implements Lookup public void delete(Path path) throws ObjectCannotBeUpdated { try { - LDAPLookupUtils.delete(getConnection(),path.getDN()+Path.mLocalPath); + LDAPLookupUtils.delete(getConnection(),path.getDN()+mLocalPath); } catch (LDAPException ex) { throw new ObjectCannotBeUpdated(ex.getLDAPErrorMessage(), ""); } @@ -281,7 +284,7 @@ public class LDAPLookup implements Lookup if (!LDAPLookupUtils.exists(getConnection(),dn)) { String listDN[] = path.getPath(); - String name = "cn="+ path.getRoot() + "," + Path.mLocalPath; + String name = "cn="+ path.getRoot() + "," + mLocalPath; int i=0; while (i getEntityClass(Path path) throws ObjectNotFoundException { String[] attr = { LDAPConnection.ALL_USER_ATTRS }; try { - LDAPEntry anEntry=getConnection().read(path.getDN()+Path.mLocalPath,attr); + LDAPEntry anEntry=getConnection().read(path.getDN()+mLocalPath,attr); String type = LDAPLookupUtils.getFirstAttributeValue(anEntry, "objectClass"); if (type.equals("cristalentity")) return TraceableEntity.class; @@ -460,16 +463,16 @@ public class LDAPLookup implements Lookup LDAPLookupUtils.getFirstAttributeValue(entry, "jobList").equals("TRUE")); } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","aliasObject") || - (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(DomainPath.mTypeRoot))) + (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(DomainPath.getTypeRoot()))) { DomainPath domainPath = new DomainPath(); domainPath.setDN(dn); 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(EntityPath.getTypeRoot()))) { - if(dn.endsWith(EntityPath.mTypeRoot)) { + if(dn.endsWith(EntityPath.getTypeRoot())) { EntityPath entityPath; if (entityKey != -1) entityPath = new EntityPath(entityKey); diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPRoleManager.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPRoleManager.java index 816d1c4..42032f3 100644 --- a/src/main/java/com/c2kernel/lookup/ldap/LDAPRoleManager.java +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPRoleManager.java @@ -1,7 +1,7 @@ package com.c2kernel.lookup.ldap; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; @@ -11,6 +11,7 @@ import com.c2kernel.lookup.InvalidEntityPathException; import com.c2kernel.lookup.Path; import com.c2kernel.lookup.RoleManager; import com.c2kernel.lookup.RolePath; +import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; import com.novell.ldap.LDAPConnection; import com.novell.ldap.LDAPEntry; @@ -92,7 +93,8 @@ public class LDAPRoleManager implements RoleManager { throw new ObjectCannotBeUpdated("Agent " + agent.getAgentName() + " already has role " + role.getName()); } - public void removeRole(AgentPath agent, RolePath role) + @Override + public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFoundException { LDAPEntry roleEntry = LDAPLookupUtils.getEntry(mLdap.getConnection(), role.getFullDN()); @@ -102,12 +104,13 @@ public class LDAPRoleManager implements RoleManager { throw new ObjectCannotBeUpdated("Agent did not have that role"); } - public boolean hasRole(AgentPath agent, RolePath role) { + @Override + public boolean hasRole(AgentPath agent, RolePath role) { String filter = "(&(objectclass=cristalrole)(uniqueMember="+agent.getFullDN()+")(cn="+role.getName()+"))"; LDAPSearchConstraints searchCons = new LDAPSearchConstraints(); searchCons.setBatchSize(0); searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER ); - return mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons).hasMoreElements(); + return mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons).hasNext(); } @Override @@ -150,12 +153,12 @@ public class LDAPRoleManager implements RoleManager { LDAPSearchConstraints searchCons = new LDAPSearchConstraints(); searchCons.setBatchSize(0); searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER ); - Enumeration roles = mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons); + Iterator roles = mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons); ArrayList roleList = new ArrayList(); - while(roles.hasMoreElements()) + while(roles.hasNext()) { - RolePath path = (RolePath) roles.nextElement(); + RolePath path = (RolePath) roles.next(); roleList.add(path); } RolePath[] roleArr = new RolePath[roleList.size()]; @@ -180,10 +183,10 @@ public class LDAPRoleManager implements RoleManager { searchCons.setBatchSize(0); searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER ); String filter = "(&(objectclass=cristalagent)(uid="+agentName+"))"; - Enumeration res = mLdap.search(mEntityPath,LDAPConnection.SCOPE_SUB,filter,searchCons); - if (!res.hasMoreElements()) + Iterator res = mLdap.search(mEntityPath,LDAPConnection.SCOPE_SUB,filter,searchCons); + if (!res.hasNext()) throw new ObjectNotFoundException("Agent not found"); - Path result = res.nextElement(); + Path result = res.next(); if (result instanceof AgentPath) return (AgentPath)result; else @@ -197,14 +200,25 @@ public class LDAPRoleManager implements RoleManager { searchCons.setBatchSize(0); searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER ); String filter = "(&(objectclass=cristalrole)(cn="+roleName+"))"; - Enumeration res = mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons); - if (!res.hasMoreElements()) + Iterator res = mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons); + if (!res.hasNext()) throw new ObjectNotFoundException("Role not found"); - Path result = res.nextElement(); + Path result = res.next(); if (result instanceof RolePath) return (RolePath)result; else throw new ObjectNotFoundException("Entry was not a Role"); } + /* (non-Javadoc) + * @see com.c2kernel.lookup.RoleManager#getAgentName(com.c2kernel.lookup.AgentPath) + */ + @Override + public String getAgentName(AgentPath agentPath) throws ObjectNotFoundException { + LDAPLookup ldap = (LDAPLookup)Gateway.getLookup(); + LDAPEntry agentEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), agentPath.getDN() + ldap.mLocalPath); + + return LDAPLookupUtils.getFirstAttributeValue(agentEntry,"uid"); + } + } diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index b4e192c..c9e1433 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -1,7 +1,7 @@ package com.c2kernel.process; import java.net.InetAddress; -import java.util.Enumeration; +import java.util.Iterator; import java.util.StringTokenizer; import org.custommonkey.xmlunit.Diff; @@ -114,16 +114,16 @@ public class Bootstrap public static void verifyResource(String ns, String itemName, String itemType, String data) throws Exception { Logger.msg(1, "Bootstrap.verifyResource() - Verifying data of "+getDataType(itemType)+" "+itemName); - Enumeration en = Gateway.getLookup().search(getTypeRoot(itemType), itemName); + Iterator en = Gateway.getLookup().search(getTypeRoot(itemType), itemName); ItemProxy thisProxy; Outcome newOutcome = new Outcome(0, data, getDataType(itemType), 0); - if (!en.hasMoreElements()) { + if (!en.hasNext()) { Logger.msg("Bootstrap.verifyResource() - "+getDataType(itemType)+" "+itemName+" not found. Creating new."); thisProxy = createResourceItem(itemType, itemName, ns); } else { - DomainPath path = (DomainPath)en.nextElement(); + DomainPath path = (DomainPath)en.next(); thisProxy = (ItemProxy)Gateway.getProxyManager().getProxy(path); try { Viewpoint currentData = (Viewpoint)thisProxy.getObject(ClusterStorage.VIEWPOINT+"/"+getDataType(itemType)+"/last"); diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index afdff12..0b9665e 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -351,7 +351,7 @@ public class Gateway // disconnect from ldap if (mLookup != null) - mLookup.disconnect(); + mLookup.close(); mLookup = null; // shut down proxy manager -- cgit v1.2.3