summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/lookup')
-rw-r--r--src/main/java/com/c2kernel/lookup/AgentPath.java10
-rw-r--r--src/main/java/com/c2kernel/lookup/DomainPath.java10
-rw-r--r--src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java2
-rw-r--r--src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java13
-rw-r--r--src/main/java/com/c2kernel/lookup/InvalidItemPathException.java13
-rw-r--r--src/main/java/com/c2kernel/lookup/ItemPath.java (renamed from src/main/java/com/c2kernel/lookup/EntityPath.java)30
-rw-r--r--src/main/java/com/c2kernel/lookup/LDAPLookup.java36
-rw-r--r--src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java10
-rw-r--r--src/main/java/com/c2kernel/lookup/LDAPRoleManager.java2
-rw-r--r--src/main/java/com/c2kernel/lookup/NextKeyManager.java14
-rw-r--r--src/main/java/com/c2kernel/lookup/Path.java2
11 files changed, 71 insertions, 71 deletions
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java
index 5ff6988..a560795 100644
--- a/src/main/java/com/c2kernel/lookup/AgentPath.java
+++ b/src/main/java/com/c2kernel/lookup/AgentPath.java
@@ -29,14 +29,14 @@ import com.novell.ldap.LDAPEntry;
* @version $Revision: 1.12 $ $Date: 2005/10/13 08:15:00 $
* @author $Author: abranson $
**/
-public class AgentPath extends EntityPath
+public class AgentPath extends ItemPath
{
private String mAgentName=null;
private String mPassword=null;
public AgentPath(int syskey, String agentName)
- throws InvalidAgentPathException,InvalidEntityPathException
+ throws InvalidAgentPathException,InvalidItemPathException
{
super(syskey);
if (agentName!=null && agentName.length()>0)
@@ -46,16 +46,16 @@ public class AgentPath extends EntityPath
}
public AgentPath(int syskey)
- throws InvalidEntityPathException
+ throws InvalidItemPathException
{
super(syskey);
}
- public AgentPath(EntityPath entity) {
+ public AgentPath(ItemPath entity) {
super();
try {
setSysKey(entity.getSysKey());
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
//won't happen as the entity path was valid
}
}
diff --git a/src/main/java/com/c2kernel/lookup/DomainPath.java b/src/main/java/com/c2kernel/lookup/DomainPath.java
index ce849ce..b0784f9 100644
--- a/src/main/java/com/c2kernel/lookup/DomainPath.java
+++ b/src/main/java/com/c2kernel/lookup/DomainPath.java
@@ -23,7 +23,7 @@ import com.novell.ldap.LDAPAttributeSet;
**/
public class DomainPath extends Path
{
- private EntityPath target = null;
+ private ItemPath target = null;
protected static String mTypeRoot;
/* Very simple extension to Path. Only copies constructors and defines root */
@@ -49,7 +49,7 @@ public class DomainPath extends Path
super(path, Path.UNKNOWN);
}
- public DomainPath(String path, EntityPath entity) throws InvalidEntityPathException
+ public DomainPath(String path, ItemPath entity) throws InvalidItemPathException
{
super(path, Path.UNKNOWN);
setEntity(entity);
@@ -76,7 +76,7 @@ public class DomainPath extends Path
return new DomainPath(parentPath);
}
- public void setEntity(EntityPath newTarget) {
+ public void setEntity(ItemPath newTarget) {
if (newTarget == null) { // clear
target = null;
mType = Path.CONTEXT;
@@ -88,7 +88,7 @@ public class DomainPath extends Path
}
@Override
- public EntityPath getEntity() throws ObjectNotFoundException {
+ public ItemPath getEntity() throws ObjectNotFoundException {
if (mType == UNKNOWN) { // must decide
checkType();
}
@@ -109,7 +109,7 @@ public class DomainPath extends Path
public void checkType() {
try {
setEntity(Gateway.getLDAPLookup().resolvePath(this));
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
Logger.error(ex);
mType = CONTEXT;
} catch (ObjectNotFoundException ex) {
diff --git a/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java b/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java
index be4d952..a74e1ee 100644
--- a/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java
+++ b/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java
@@ -1,6 +1,6 @@
package com.c2kernel.lookup;
-public class InvalidAgentPathException extends InvalidEntityPathException {
+public class InvalidAgentPathException extends InvalidItemPathException {
public InvalidAgentPathException() {
super();
diff --git a/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java b/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java
deleted file mode 100644
index 27c754d..0000000
--- a/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.c2kernel.lookup;
-
-public class InvalidEntityPathException extends Exception {
-
- public InvalidEntityPathException() {
- super();
- }
-
- public InvalidEntityPathException(String msg) {
- super(msg);
- }
-
-}
diff --git a/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java b/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java
new file mode 100644
index 0000000..5b37cd7
--- /dev/null
+++ b/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java
@@ -0,0 +1,13 @@
+package com.c2kernel.lookup;
+
+public class InvalidItemPathException extends Exception {
+
+ public InvalidItemPathException() {
+ super();
+ }
+
+ public InvalidItemPathException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/src/main/java/com/c2kernel/lookup/EntityPath.java b/src/main/java/com/c2kernel/lookup/ItemPath.java
index 4f9b771..89fe5ee 100644
--- a/src/main/java/com/c2kernel/lookup/EntityPath.java
+++ b/src/main/java/com/c2kernel/lookup/ItemPath.java
@@ -25,7 +25,7 @@ import com.novell.ldap.LDAPAttributeSet;
* @version $Revision: 1.14 $ $Date: 2006/03/03 13:52:21 $
* @author $Author: abranson $
**/
-public class EntityPath extends Path
+public class ItemPath extends Path
{
// no of components in a syskey
public static final int elementNo = 3;
@@ -40,14 +40,14 @@ public class EntityPath extends Path
* The object decides that for itself from the number of components
*/
- public EntityPath(int syskey) throws InvalidEntityPathException {
+ public ItemPath(int syskey) throws InvalidItemPathException {
super();
setSysKey(syskey);
}
/*
*/
- public EntityPath()
+ public ItemPath()
{
super();
}
@@ -55,7 +55,7 @@ public class EntityPath extends Path
/*
*/
- public EntityPath(String[] path) throws InvalidEntityPathException
+ public ItemPath(String[] path) throws InvalidItemPathException
{
super(path, Path.CONTEXT); // dummy - it will get replaced in checkSysPath()
checkSysPath();
@@ -63,7 +63,7 @@ public class EntityPath extends Path
/*
*/
- public EntityPath(String path) throws InvalidEntityPathException
+ public ItemPath(String path) throws InvalidItemPathException
{
super(path, Path.CONTEXT);
checkSysPath();
@@ -71,7 +71,7 @@ public class EntityPath extends Path
/*
*/
- public EntityPath(EntityPath parent, String child) throws InvalidEntityPathException {
+ public ItemPath(ItemPath parent, String child) throws InvalidItemPathException {
super(parent, child);
checkSysPath();
}
@@ -83,7 +83,7 @@ public class EntityPath extends Path
}
@Override
- public EntityPath getEntity() throws ObjectNotFoundException {
+ public ItemPath getEntity() throws ObjectNotFoundException {
return this;
}
@@ -101,22 +101,22 @@ public class EntityPath extends Path
if (mSysKey == Path.INVALID && mType == Path.ENTITY)
try {
if (mPath.length != elementNo)
- throw new InvalidEntityPathException("Incorrect number of components for a system key");
+ throw new InvalidItemPathException("Incorrect number of components for a system key");
mSysKey = 0;
for (String keypart : mPath) {
if (keypart.length()!=elementLen+1)
- throw new InvalidEntityPathException("Component '"+keypart+"' is not the correct size for a system key");
+ throw new InvalidItemPathException("Component '"+keypart+"' is not the correct size for a system key");
for(int j=1; j<elementLen+1; j++) // skip the 'd' prefix
{
char c = keypart.charAt(j);
if((c >= '0') && (c <='9'))
mSysKey = mSysKey*10 + c - '0';
else
- throw new InvalidEntityPathException("Component '"+keypart+"' contained a non-numeric char (excluding first char 'd').");
+ throw new InvalidItemPathException("Component '"+keypart+"' contained a non-numeric char (excluding first char 'd').");
}
}
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
mSysKey = Path.INVALID;
}
return mSysKey;
@@ -124,10 +124,10 @@ public class EntityPath extends Path
/** Sets path from int syskey
*/
- public void setSysKey(int sysKey) throws InvalidEntityPathException
+ public void setSysKey(int sysKey) throws InvalidItemPathException
{
if (sysKey < 0 || sysKey > maxSysKey)
- throw new InvalidEntityPathException("System key "+sysKey+" out of range");
+ throw new InvalidItemPathException("System key "+sysKey+" out of range");
String stringPath = Integer.toString(sysKey);
ArrayList<String> newKey = new ArrayList<String>();
for (int i=0; i<elementNo; i++) {
@@ -152,9 +152,9 @@ public class EntityPath extends Path
checkSysPath();
}
- public void checkSysPath() throws InvalidEntityPathException {
+ public void checkSysPath() throws InvalidItemPathException {
if (mPath.length > elementNo)
- throw new InvalidEntityPathException("EntityPath cannot have more than "+elementNo+" components: "+toString());
+ throw new InvalidItemPathException("EntityPath cannot have more than "+elementNo+" components: "+toString());
if (mPath.length == elementNo)
mType = Path.ENTITY;
else
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;
diff --git a/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java b/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java
index fcf1ef8..51b9ded 100644
--- a/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java
+++ b/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java
@@ -35,7 +35,7 @@ public class LDAPPropertyManager {
* @return
* @throws ObjectNotFoundException
*/
- public boolean hasProperties(EntityPath thisEntity) throws ObjectNotFoundException {
+ public boolean hasProperties(ItemPath thisEntity) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
return entityEntry.getAttribute("cristalprop") != null;
}
@@ -45,7 +45,7 @@ public class LDAPPropertyManager {
* @return array of Property
* @throws ObjectNotFoundException
*/
- public String[] getPropertyNames(EntityPath thisEntity) throws ObjectNotFoundException {
+ public String[] getPropertyNames(ItemPath thisEntity) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
ArrayList<String> propbag = new ArrayList<String>();
LDAPAttribute props = entityEntry.getAttribute("cristalprop");
@@ -66,7 +66,7 @@ public class LDAPPropertyManager {
* @return The Property object
* @throws ObjectNotFoundException
*/
- public Property getProperty(EntityPath thisEntity, String name) throws ObjectNotFoundException {
+ public Property getProperty(ItemPath thisEntity, String name) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
return getProperty(entityEntry, name);
}
@@ -77,7 +77,7 @@ public class LDAPPropertyManager {
* @throws ObjectNotFoundException
* @throws ObjectCannotBeUpdated
*/
- public void deleteProperty(EntityPath thisEntity, String name) throws ObjectNotFoundException, ObjectCannotBeUpdated {
+ public void deleteProperty(ItemPath thisEntity, String name) throws ObjectNotFoundException, ObjectCannotBeUpdated {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
Property prop = getProperty(entityEntry, name);
Logger.msg(6, "LDAPLookupUtils.deleteProperty("+name+") - Deleting property");
@@ -94,7 +94,7 @@ public class LDAPPropertyManager {
* @throws ObjectNotFoundException
* @throws ObjectCannotBeUpdated
*/
- public void setProperty(EntityPath thisEntity, Property prop) throws ObjectNotFoundException, ObjectCannotBeUpdated {
+ public void setProperty(ItemPath thisEntity, Property prop) throws ObjectNotFoundException, ObjectCannotBeUpdated {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
try {
Property oldProp = getProperty(entityEntry, prop.getName());
diff --git a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
index f40cd53..091f6d7 100644
--- a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
+++ b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
@@ -124,7 +124,7 @@ public class LDAPRoleManager {
agents.add(path);
} catch (ObjectNotFoundException ex) {
Logger.error("Agent "+userDN+" does not exist");
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
Logger.error("Agent "+userDN+" is not a valid entity");
}
}
diff --git a/src/main/java/com/c2kernel/lookup/NextKeyManager.java b/src/main/java/com/c2kernel/lookup/NextKeyManager.java
index a4ead4b..9aea50d 100644
--- a/src/main/java/com/c2kernel/lookup/NextKeyManager.java
+++ b/src/main/java/com/c2kernel/lookup/NextKeyManager.java
@@ -28,14 +28,14 @@ public class NextKeyManager {
this.lastKeyPath = lastKeyPath;
}
- public synchronized EntityPath generateNextEntityKey()
+ public synchronized ItemPath generateNextEntityKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException
{
- EntityPath lastKey = getLastEntityPath();
+ ItemPath lastKey = getLastEntityPath();
try {
lastKey.setSysKey(lastKey.getSysKey()+1);
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectCannotBeUpdated("Invalid syskey "+(lastKey.getSysKey()+1)+". Maybe centre is full.");
}
//test that storage is empty for that key
@@ -56,7 +56,7 @@ public class NextKeyManager {
public synchronized AgentPath generateNextAgentKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException {
- EntityPath newEntity = generateNextEntityKey();
+ ItemPath newEntity = generateNextEntityKey();
return new AgentPath(newEntity);
}
@@ -65,15 +65,15 @@ public class NextKeyManager {
LDAPLookupUtils.setAttributeValue(ldap.getConnection(), lastKeyEntry,"intsyskey",Integer.toString(sysKey));
}
- public EntityPath getLastEntityPath() throws ObjectNotFoundException
+ public ItemPath getLastEntityPath() throws ObjectNotFoundException
{
LDAPEntry lastKeyEntry = LDAPLookupUtils.getEntry(ldap.getConnection(),lastKeyPath);
String lastKey = LDAPLookupUtils.getFirstAttributeValue(lastKeyEntry,"intsyskey");
try {
int sysKey = Integer.parseInt(lastKey);
- EntityPath sysPath = new EntityPath(sysKey);
+ ItemPath sysPath = new ItemPath(sysKey);
return sysPath;
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("Invalid syskey. Maybe centre is full.");
} catch (NumberFormatException ex) {
throw new ObjectNotFoundException("Invalid syskey in lastkey.");
diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java
index 4bec43a..16f3e5d 100644
--- a/src/main/java/com/c2kernel/lookup/Path.java
+++ b/src/main/java/com/c2kernel/lookup/Path.java
@@ -279,7 +279,7 @@ public abstract class Path implements Serializable
throw new ObjectNotFoundException("No match for "+name, "");
}
- public abstract EntityPath getEntity() throws ObjectNotFoundException;
+ public abstract ItemPath getEntity() throws ObjectNotFoundException;
public abstract LDAPAttributeSet createAttributeSet() throws ObjectCannotBeUpdated;