]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.util/src/org/argeo/osgi/useradmin/LdifUser.java
Introduce transaction working copy abstraction
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / osgi / useradmin / LdifUser.java
index c4c02a748f8e0eb4130eb9da2cc9bbce4ab70496..aaac50272a02cb605ec962521fcf77f9f873a06a 100644 (file)
@@ -21,10 +21,11 @@ import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.ldap.LdapName;
 
-import org.argeo.util.naming.AuthPassword;
+import org.argeo.util.directory.Person;
 import org.argeo.util.naming.LdapAttrs;
 import org.argeo.util.naming.LdapObjs;
 import org.argeo.util.naming.SharedSecret;
+import org.argeo.util.naming.ldap.AuthPassword;
 
 /** Directory user implementation */
 abstract class LdifUser implements DirectoryUser {
@@ -182,22 +183,22 @@ abstract class LdifUser implements DirectoryUser {
        /** Should only be called from working copy thread. */
        private synchronized Attributes getModifiedAttributes() {
                assert getWc() != null;
-               return getWc().getAttributes(getDn());
+               return getWc().getModifiedData().get(getDn());
        }
 
        protected synchronized boolean isEditing() {
                return getWc() != null && getModifiedAttributes() != null;
        }
 
-       private synchronized UserDirectoryWorkingCopy getWc() {
+       private synchronized DirectoryUserWorkingCopy getWc() {
                return userAdmin.getWorkingCopy();
        }
 
        protected synchronized void startEditing() {
                if (frozen)
-                       throw new UserDirectoryException("Cannot edit frozen view");
+                       throw new IllegalStateException("Cannot edit frozen view");
                if (getUserAdmin().isReadOnly())
-                       throw new UserDirectoryException("User directory is read-only");
+                       throw new IllegalStateException("User directory is read-only");
                assert getModifiedAttributes() == null;
                getWc().startEditing(this);
                // modifiedAttributes = (Attributes) publishedAttributes.clone();
@@ -254,7 +255,7 @@ abstract class LdifUser implements DirectoryUser {
                                                effectiveKeys.add(id);
                                }
                        } catch (NamingException e) {
-                               throw new UserDirectoryException("Cannot initialise attribute dictionary", e);
+                               throw new IllegalStateException("Cannot initialise attribute dictionary", e);
                        }
                        if (!credentials)
                                effectiveKeys.add(LdapAttrs.objectClasses.name());
@@ -383,7 +384,7 @@ abstract class LdifUser implements DirectoryUser {
                                else
                                        return null;
                        } catch (NamingException e) {
-                               throw new UserDirectoryException("Cannot get value for attribute " + key, e);
+                               throw new IllegalStateException("Cannot get value for attribute " + key, e);
                        }
                }
 
@@ -405,7 +406,7 @@ abstract class LdifUser implements DirectoryUser {
                                else
                                        return null;
                        } catch (NamingException e) {
-                               throw new UserDirectoryException("Cannot remove attribute " + key, e);
+                               throw new IllegalStateException("Cannot remove attribute " + key, e);
                        }
                }
        }