diff options
Diffstat (limited to 'source/com/c2kernel/lookup/Path.java')
| -rw-r--r-- | source/com/c2kernel/lookup/Path.java | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/source/com/c2kernel/lookup/Path.java b/source/com/c2kernel/lookup/Path.java index b713493..4966d1e 100644 --- a/source/com/c2kernel/lookup/Path.java +++ b/source/com/c2kernel/lookup/Path.java @@ -32,10 +32,10 @@ public abstract class Path implements Serializable public static final String delim = "/";
// types
- public static final short UNKNOWN = 0;
+ public static final short UNKNOWN = 0;
public static final short CONTEXT = 1;
public static final short ENTITY = 2;
-
+
// invalid int key
public static final int INVALID = -1;
@@ -54,11 +54,11 @@ public abstract class Path implements Serializable protected org.omg.CORBA.Object mIOR = null;
//
// needed for unusual subclass constructors
-
+
protected static String mGlobalPath; //cern.ch
protected static String mRootPath; //cristal2
protected static String mLocalPath; //lab27
-
+
public Path() {
}
@@ -115,7 +115,7 @@ public abstract class Path implements Serializable {
mStringPath = null;
mDN = null;
- mPath = (String[])path.clone();
+ mPath = path.clone();
mSysKey = INVALID;
}
@@ -134,7 +134,7 @@ public abstract class Path implements Serializable newPath.add(tok.nextToken());
}
- mPath = (String[])(newPath.toArray(mPath));
+ mPath = (newPath.toArray(mPath));
mStringPath = null;
mDN = null;
mSysKey = INVALID;
@@ -153,7 +153,7 @@ public abstract class Path implements Serializable {
mStringPath = null;
mDN = null;
- mPath = (String[])(path.getPath().clone());
+ mPath = (path.getPath().clone());
mSysKey = INVALID;
}
@@ -167,7 +167,7 @@ public abstract class Path implements Serializable String root = "cn="+getRoot()+",";
if (dn.endsWith(mLocalPath))
dn = dn.substring(0, dn.lastIndexOf(mLocalPath));
-
+
if (dn.endsWith(root))
dn = dn.substring(0, dn.lastIndexOf(root));
@@ -180,7 +180,7 @@ public abstract class Path implements Serializable else
break;
}
- mPath = (String[])(newPath.toArray(mPath));
+ mPath = (newPath.toArray(mPath));
mSysKey = INVALID;
mStringPath = null;
mDN = dn+root;
@@ -204,8 +204,8 @@ public abstract class Path implements Serializable {
if (mStringPath == null) {
StringBuffer stringPathBuffer = new StringBuffer("/").append(getRoot());
- for (int i=0; i<mPath.length; i++)
- stringPathBuffer.append(delim).append(mPath[i]);
+ for (String element : mPath)
+ stringPathBuffer.append(delim).append(element);
mStringPath = stringPathBuffer.toString();
}
return mStringPath;
@@ -221,15 +221,15 @@ public abstract class Path implements Serializable }
return mDN;
}
-
+
public String getFullDN() {
return getDN()+mLocalPath;
}
-
+
public boolean exists() {
return Gateway.getLDAPLookup().exists(this);
}
-
+
/** Queries the lookup for the IOR
*/
@@ -240,14 +240,14 @@ public abstract class Path implements Serializable try {
newIOR = myLookup.getIOR(this);
} catch (ObjectNotFoundException ex) {
- newIOR = null;
}
setIOR(newIOR);
}
return mIOR;
}
- public String toString() {
+ @Override
+ public String toString() {
return getString();
}
@@ -258,17 +258,17 @@ public abstract class Path implements Serializable public int getSysKey() {
return mSysKey;
}
-
- public Enumeration getChildren() {
+
+ public Enumeration<?> getChildren() {
String filter = "objectclass=*";
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
searchCons.setBatchSize(10);
searchCons.setDereference(LDAPSearchConstraints.DEREF_FINDING );
return Gateway.getLDAPLookup().search(getFullDN(), LDAPConnection.SCOPE_ONE,filter,searchCons);
}
-
+
public Path find(String name) throws ObjectNotFoundException {
- Enumeration e = Gateway.getLDAPLookup().search(this, name);
+ Enumeration<?> e = Gateway.getLDAPLookup().search(this, name);
if (e.hasMoreElements()) {
Path thisPath =(Path)e.nextElement();
if (e.hasMoreElements())
@@ -277,24 +277,26 @@ public abstract class Path implements Serializable }
throw new ObjectNotFoundException("No match for "+name, "");
}
-
+
public abstract EntityPath getEntity() throws ObjectNotFoundException;
public abstract LDAPAttributeSet createAttributeSet() throws ObjectCannotBeUpdated;
-
- public boolean equals( Object path )
- {
+
+ @Override
+ public boolean equals( Object path )
+ {
return toString().equals(path.toString());
}
-
- public int hashCode() {
+
+ @Override
+ public int hashCode() {
return toString().hashCode();
}
public String dump() {
StringBuffer comp = new StringBuffer("Components: { ");
- for (int i=0; i<mPath.length; i++)
- comp.append("'").append(mPath[i]).append("' ");
+ for (String element : mPath)
+ comp.append("'").append(element).append("' ");
return "Path - dump(): "+comp.toString()+"}\n dn="+getDN()+"\n string="+toString()+"\n int="+getSysKey()+"\n type="+mType;
}
}
|
