diff options
| author | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
| commit | 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch) | |
| tree | 5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/persistency/LDAPClusterStorage.java | |
| parent | 036cbdba66f804743c4c838ed598d6972c4b3e17 (diff) | |
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
Diffstat (limited to 'source/com/c2kernel/persistency/LDAPClusterStorage.java')
| -rw-r--r-- | source/com/c2kernel/persistency/LDAPClusterStorage.java | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/source/com/c2kernel/persistency/LDAPClusterStorage.java b/source/com/c2kernel/persistency/LDAPClusterStorage.java index fb36d9f..16ac7a0 100644 --- a/source/com/c2kernel/persistency/LDAPClusterStorage.java +++ b/source/com/c2kernel/persistency/LDAPClusterStorage.java @@ -14,32 +14,38 @@ import com.c2kernel.utils.Logger; public class LDAPClusterStorage extends ClusterStorage {
LDAPPropertyManager ldapStore;
- public void open() throws ClusterStorageException {
+ @Override
+ public void open() throws ClusterStorageException {
ldapStore = Gateway.getLDAPLookup().getPropManager();
}
- public void close() throws ClusterStorageException {
+ @Override
+ public void close() throws ClusterStorageException {
}
// introspection
- public short queryClusterSupport(String clusterType) {
+ @Override
+ public short queryClusterSupport(String clusterType) {
if (clusterType.equals(PROPERTY))
return READWRITE;
else
return NONE;
}
- public String getName() {
+ @Override
+ public String getName() {
return "LDAP Cluster Storage";
}
-
- public String getId() {
+
+ @Override
+ public String getId() {
return "LDAP";
}
// retrieve object by path
- public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
Logger.msg(6, "LDAPClusterStorage.get() - "+sysKey+"/"+path);
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
@@ -75,7 +81,8 @@ public class LDAPClusterStorage extends ClusterStorage { return newObj;
}
// store object by path
- public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
+ @Override
+ public void put(Integer sysKey, C2KLocalObject obj) throws ClusterStorageException {
Logger.msg(6, "LDAPClusterStorage.put() - "+sysKey+"/"+ClusterStorage.getPath(obj));
String type = obj.getClusterType();
@@ -100,7 +107,8 @@ public class LDAPClusterStorage extends ClusterStorage { }
// delete cluster
- public void delete(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public void delete(Integer sysKey, String path) throws ClusterStorageException {
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
if (pathLength != 2)
@@ -120,7 +128,7 @@ public class LDAPClusterStorage extends ClusterStorage { } catch (Exception e1) {
Logger.error(e1);
throw new ClusterStorageException("LDAPClusterStorage - could not delete property");
- }
+ }
}
else
throw new ClusterStorageException("Cluster type "+type+" not supported.");
@@ -130,26 +138,27 @@ public class LDAPClusterStorage extends ClusterStorage { /* navigation */
// directory listing
- public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
+ @Override
+ public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
Logger.msg(6, "LDAPClusterStorage.getClusterContents() - "+sysKey+"/"+path);
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
if (pathLength > 1)
return new String[0];
-
+
String type = getClusterType(path);
- try
+ try
{
EntityPath thisEntity = new EntityPath(sysKey.intValue());
if (type.equals(PROPERTY))
return ldapStore.getPropertyNames(thisEntity);
- else
+ else
if (type.equals("")) { // root query
String[] allClusters = new String[0];
ArrayList<String> clusterList = new ArrayList<String>();
if (ldapStore.hasProperties(thisEntity))
clusterList.add(PROPERTY);
- allClusters = (String[])clusterList.toArray(allClusters);
+ allClusters = clusterList.toArray(allClusters);
return allClusters;
}
else
|
