diff options
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java index 3de9aad..ac91c29 100644 --- a/src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPClusterStorage.java @@ -2,13 +2,12 @@ package com.c2kernel.lookup.ldap; import java.util.ArrayList;
import java.util.StringTokenizer;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.Lookup;
import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.process.Gateway;
import com.c2kernel.process.auth.Authenticator;
import com.c2kernel.property.Property;
@@ -18,17 +17,17 @@ public class LDAPClusterStorage extends ClusterStorage { LDAPPropertyManager ldapStore;
@Override
- public void open(Authenticator auth) throws ClusterStorageException {
+ public void open(Authenticator auth) throws PersistencyException {
Lookup lookup = Gateway.getLookup();
if (lookup instanceof LDAPLookup)
ldapStore = ((LDAPLookup)lookup).getPropManager();
else
- throw new ClusterStorageException("Cannot use LDAP cluster storage without LDAP Lookup");
+ throw new PersistencyException("Cannot use LDAP cluster storage without LDAP Lookup");
}
@Override
- public void close() throws ClusterStorageException {
+ public void close() throws PersistencyException {
}
// introspection
@@ -52,12 +51,12 @@ public class LDAPClusterStorage extends ClusterStorage { // retrieve object by path
@Override
- public C2KLocalObject get(ItemPath thisItem, String path) throws ClusterStorageException {
+ public C2KLocalObject get(ItemPath thisItem, String path) throws PersistencyException {
Logger.msg(6, "LDAPClusterStorage.get() - "+thisItem+"/"+path);
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
if (pathLength != 2)
- throw new ClusterStorageException("Path length was invalid: "+path);
+ throw new PersistencyException("Path length was invalid: "+path);
String type = tok.nextToken();
String objName = tok.nextToken();
@@ -67,19 +66,19 @@ public class LDAPClusterStorage extends ClusterStorage { try {
Property newProperty = ldapStore.getProperty(thisItem, objName);
newObj = newProperty;
- } catch (ObjectNotFoundException ex) {
- throw new ClusterStorageException("Property "+objName+" not found in "+thisItem);
+ } catch (ObjectNotFound ex) {
+ throw new PersistencyException("Property "+objName+" not found in "+thisItem);
}
}
else
- throw new ClusterStorageException("Cluster type "+type+" not supported.");
+ throw new PersistencyException("Cluster type "+type+" not supported.");
return newObj;
}
// store object by path
@Override
- public void put(ItemPath thisItem, C2KLocalObject obj) throws ClusterStorageException {
+ public void put(ItemPath thisItem, C2KLocalObject obj) throws PersistencyException {
Logger.msg(6, "LDAPClusterStorage.put() - "+thisItem+"/"+ClusterStorage.getPath(obj));
String type = obj.getClusterType();
@@ -89,20 +88,20 @@ public class LDAPClusterStorage extends ClusterStorage { ldapStore.setProperty(thisItem, (Property)obj);
} catch (Exception e1) {
Logger.error(e1);
- throw new ClusterStorageException("LDAPClusterStorage - could not write property");
+ throw new PersistencyException("LDAPClusterStorage - could not write property");
}
}
else
- throw new ClusterStorageException("Cluster type "+type+" not supported.");
+ throw new PersistencyException("Cluster type "+type+" not supported.");
}
// delete cluster
@Override
- public void delete(ItemPath thisItem, String path) throws ClusterStorageException {
+ public void delete(ItemPath thisItem, String path) throws PersistencyException {
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
if (pathLength != 2)
- throw new ClusterStorageException("Path length was invalid: "+path);
+ throw new PersistencyException("Path length was invalid: "+path);
String type = tok.nextToken();
if (type.equals(PROPERTY)) {
@@ -110,11 +109,11 @@ public class LDAPClusterStorage extends ClusterStorage { ldapStore.deleteProperty(thisItem, tok.nextToken());
} catch (Exception e1) {
Logger.error(e1);
- throw new ClusterStorageException("LDAPClusterStorage - could not delete property");
+ throw new PersistencyException("LDAPClusterStorage - could not delete property");
}
}
else
- throw new ClusterStorageException("Cluster type "+type+" not supported.");
+ throw new PersistencyException("Cluster type "+type+" not supported.");
}
@@ -122,7 +121,7 @@ public class LDAPClusterStorage extends ClusterStorage { // directory listing
@Override
- public String[] getClusterContents(ItemPath thisItem, String path) throws ClusterStorageException {
+ public String[] getClusterContents(ItemPath thisItem, String path) throws PersistencyException {
Logger.msg(6, "LDAPClusterStorage.getClusterContents() - "+thisItem+"/"+path);
StringTokenizer tok = new StringTokenizer(path, "/");
int pathLength = tok.countTokens();
@@ -144,9 +143,9 @@ public class LDAPClusterStorage extends ClusterStorage { return allClusters;
}
else
- throw new ClusterStorageException("Cluster type "+type+" not supported.");
- } catch (ObjectNotFoundException e) {
- throw new ClusterStorageException("Item "+thisItem+" does not exist");
+ throw new PersistencyException("Cluster type "+type+" not supported.");
+ } catch (ObjectNotFound e) {
+ throw new PersistencyException("Item "+thisItem+" does not exist");
}
}
}
|
