From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- source/com/c2kernel/lookup/DomainPath.java | 43 +++++++++++++++++------------- 1 file changed, 24 insertions(+), 19 deletions(-) mode change 100755 => 100644 source/com/c2kernel/lookup/DomainPath.java (limited to 'source/com/c2kernel/lookup/DomainPath.java') diff --git a/source/com/c2kernel/lookup/DomainPath.java b/source/com/c2kernel/lookup/DomainPath.java old mode 100755 new mode 100644 index ad314ee..ce849ce --- a/source/com/c2kernel/lookup/DomainPath.java +++ b/source/com/c2kernel/lookup/DomainPath.java @@ -30,15 +30,15 @@ public class DomainPath extends Path public DomainPath() { - super(Path.UNKNOWN); + super(Path.UNKNOWN); } public DomainPath(short type) { - super(); + super(); mType = type; } - + public DomainPath(String[] path) { super(path, Path.UNKNOWN); @@ -54,7 +54,7 @@ public class DomainPath extends Path super(path, Path.UNKNOWN); setEntity(entity); } - + public DomainPath(DomainPath parent, String child) { super(parent, child); } @@ -62,47 +62,50 @@ public class DomainPath extends Path /* the root of domain paths is /domain * clearly */ - public String getRoot() { + @Override + public String getRoot() { return "domain"; } - + public DomainPath getParent() { if (mPath.length == 0) return null; - + String[] parentPath = new String[mPath.length-1]; System.arraycopy(mPath, 0, parentPath, 0, parentPath.length); return new DomainPath(parentPath); } - + public void setEntity(EntityPath newTarget) { if (newTarget == null) { // clear target = null; mType = Path.CONTEXT; return; } - + target = newTarget; mType = Path.ENTITY; } - - public EntityPath getEntity() throws ObjectNotFoundException { + + @Override + public EntityPath getEntity() throws ObjectNotFoundException { if (mType == UNKNOWN) { // must decide checkType(); } - + if (target == null) throw new ObjectNotFoundException("Path is a context", ""); return target; } - - public short getType() { + + @Override + public short getType() { if (mType == UNKNOWN) { // must decide checkType(); } return mType; } - + public void checkType() { try { setEntity(Gateway.getLDAPLookup().resolvePath(this)); @@ -114,7 +117,7 @@ public class DomainPath extends Path } } - + /** * Retrieves the domkey of the path * @return the last path component; @@ -123,18 +126,20 @@ public class DomainPath extends Path return mPath[mPath.length-1]; } - public int getSysKey() { + @Override + public int getSysKey() { if (mType == UNKNOWN) { // must decide checkType(); } - + if (mType == ENTITY) { return target.getSysKey(); } else return INVALID; } - public LDAPAttributeSet createAttributeSet() { + @Override + public LDAPAttributeSet createAttributeSet() { LDAPAttributeSet attrs = new LDAPAttributeSet(); attrs.add(new LDAPAttribute("cn",getName())); if (getType() == ENTITY) { -- cgit v1.2.3