directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r564425 [1/4] - in /directory/sandbox/djencks/triplesec-jacc2: ./ admin-api2/ admin-api2/src/main/java/org/safehaus/triplesec/admin/ admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ admin-api2/src/main/java/org/safehaus/triplesec/...
Date Thu, 09 Aug 2007 23:40:18 GMT
Author: djencks
Date: Thu Aug  9 16:40:15 2007
New Revision: 564425

URL: http://svn.apache.org/viewvc?view=rev&rev=564425
Log:
It compiles but probably doesn't pass any integration tests

Added:
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java   (with props)
Removed:
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/DaoFactory.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ExternalUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/GroupDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/HauskeysUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/LocalUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/UserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/AbstractLdapDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/JndiIterator.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapDaoFactory.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapExternalUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapGroupDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapHauskeysUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapLocalUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapUserDao.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapUtils.java
Modified:
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/pom.xml
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUser.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Group.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUser.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUser.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/User.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java
    directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/interceptor/ChangelogService.java
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyChangeEvent.java
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyDnChangeEvent.java
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyRdnChangeEvent.java
    directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/AttributeUtils.java
    directory/sandbox/djencks/triplesec-jacc2/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java
    directory/sandbox/djencks/triplesec-jacc2/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java
    directory/sandbox/djencks/triplesec-jacc2/configuration/src/main/java/org/safehaus/triplesec/configuration/MutableTriplesecStartupConfiguration.java
    directory/sandbox/djencks/triplesec-jacc2/configuration/src/main/java/org/safehaus/triplesec/configuration/TriplesecStartupConfiguration.java
    directory/sandbox/djencks/triplesec-jacc2/itest-data/src/main/resources/server.xml
    directory/sandbox/djencks/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
    directory/sandbox/djencks/triplesec-jacc2/main/pom.xml
    directory/sandbox/djencks/triplesec-jacc2/main/src/main/java/org/safehaus/triplesec/Service.java
    directory/sandbox/djencks/triplesec-jacc2/pom.xml
    directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java
    directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java
    directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java
    directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java
    directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ExternalLinkPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupUsersPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/HotpSettingsPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewGroupPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserDependentsPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserInfoPanel.java
    directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserPanel.java
    directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java
    directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java
    directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilder.java
    directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilderTest.java
    directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/TriplesecRegistrationApplication.java
    directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/panels/WizardPanelFinish.java
    directory/sandbox/djencks/triplesec-jacc2/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/services/ConnectionManager.java

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/pom.xml?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/pom.xml (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/pom.xml Thu Aug  9 16:40:15 2007
@@ -165,7 +165,7 @@
             <plugin>
               <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                  <forkMode>pertest</forkMode>
+                  <forkMode>once</forkMode>
                 </configuration>
             </plugin>
         </plugins>

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUser.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUser.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUser.java Thu Aug  9 16:40:15 2007
@@ -20,42 +20,42 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
-
-import org.safehaus.triplesec.admin.dao.ExternalUserDao;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.StateManager;
 
 
 public class ExternalUser extends User
 {
-    private final String referral;
-    private final ExternalUserDao dao;
-    
-    public ExternalUser( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, ExternalUserDao dao, String id, String description, String referral, boolean disabled )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp, id, description, disabled );
-        this.dao = dao;
-        this.referral = referral;
-    }
+    //TODO this is wrong
+    public static final String[] attrs = new String[] {"uid",
+            "referral"};
 
+    private final static int REFERRAL_INDEX = 3;
 
-    public ExternalUser( String creatorsName, Date createTimestamp, ExternalUserDao dao, String id, 
-        String description, String referral )
+    public ExternalUser()
     {
-        super( creatorsName, createTimestamp, id, description, false );
-        this.dao = dao;
-        this.referral = referral;
+        super( new StateManager<LocalUser>( ( LocalUser ) null ) );
+        getStateManager().setPc( this );
+        getStateManager().addField( new SingleValuedField<String>( "referral", null ) );
     }
 
-
-    public ExternalUserModifier modifier()
+    public ExternalUser( String id, String description, String referral, boolean disabled )
     {
-        return new ExternalUserModifier( dao, this );
+        this();
+        setId( id );
+        setDescription( description );
+        setDisabled( disabled );
+        setReferral( referral );
     }
 
 
     public String getReferral()
     {
-        return referral;
+        return getStateManager().getStringValue( REFERRAL_INDEX );
+    }
+
+    public void setReferral( String referral )
+    {
+        getStateManager().setStringValue( REFERRAL_INDEX, referral );
     }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Group.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Group.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Group.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Group.java Thu Aug  9 16:40:15 2007
@@ -20,57 +20,88 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
+import java.util.Collection;
 import java.util.Set;
 
-import org.safehaus.triplesec.admin.dao.GroupDao;
+import javax.naming.directory.Attributes;
 
+import org.safehaus.triplesec.admin.persistence.PersistenceCapable;
+import org.safehaus.triplesec.admin.persistence.ReferenceMapField;
+import org.safehaus.triplesec.admin.persistence.SimpleRdn;
+import org.safehaus.triplesec.admin.persistence.State;
+import org.safehaus.triplesec.admin.persistence.StateManager;
 
-public class Group extends AdministeredEntity
+
+public class Group implements PersistenceCapable
 {
-    private final GroupDao dao;
-    private final String name;
-    private final Set members;
-    
-    
-    public Group( String creatorsName, Date createTimestamp, GroupDao dao, String name, Set members )
-    {
-        this( creatorsName, createTimestamp, null, null, dao, name, members );
-    }
-    
-    
-    public Group( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, GroupDao dao, String name, Set members )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp );
-        this.dao = dao;
-        this.name = name;
-        this.members = new HashSet( members );
+    public static final String[] attrs = new String[] {"cn",
+            "uniqueMember"};
+
+    protected static final int NAME_INDEX = 0;
+    protected static final int MEMBERS_INDEX = 1;
+
+    private StateManager<Group> stateManager;
+
+    public Group()
+    {
+        this.stateManager = new StateManager<Group>( this );
+        stateManager.setRdn( new SimpleRdn( "cn", null, "ou=groups" ) );
+        stateManager.addField( new ReferenceMapField<User>( "uniqueMember" ) );
+
+        stateManager.setState( State.EMPTY );
     }
 
+/*
+    public Group( String name, Set<User> members )
+    {
+        this();
+        setName( name );
+    }
+*/
+
 
     public String getName()
     {
-        return name;
+        return stateManager.getId();
+    }
+
+    public void setName( String name )
+    {
+        stateManager.setId( name );
     }
 
 
-    public Set getMembers()
+    public Collection<User> getMembers()
+    {
+        return stateManager.getReferenceMapField( MEMBERS_INDEX ).getCurrentValues();
+    }
+
+    public void addMember( User member )
     {
-        return Collections.unmodifiableSet( members );
+        stateManager.getReferenceMapField( MEMBERS_INDEX ).addValue( member );
     }
-    
-    
-    public GroupModifier modifier()
+
+    public void removeMember( User member )
     {
-        return new GroupModifier( dao, this );
+        stateManager.getReferenceMapField( MEMBERS_INDEX ).removeValue( member );
     }
-    
-    
+
     public String toString()
     {
-        return name;
+        return getName();
+    }
+
+    public StateManager getStateManager()
+    {
+        return stateManager;
+    }
+
+    public Attributes getAttributes()
+    {
+        return null;
+    }
+
+    public void parentSet( StateManager parentSm )
+    {
     }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUser.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUser.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUser.java Thu Aug  9 16:40:15 2007
@@ -20,221 +20,204 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.StateManager;
 
-import org.safehaus.triplesec.admin.dao.HauskeysUserDao;
 
-
-public class HauskeysUser extends User
+public class HauskeysUser extends LocalUser
 {
-    private final HauskeysUserDao dao;
-    private final String firstName;
-    private final String lastName;
-    private final String password;
-    private final String mobile;
-    private final String email;
-    private final String notifyBy;
-    private final String mobileCarrier;
-    private final String tokenPin;
-    private final String midletName;
-    private final String failuresInEpoch;
-    private final String activationKey;
-    private final String realm;
-    private final String secret;
-    private final String label;
-    private final String movingFactor;
-    private final String address1;
-    private final String address2;
-    private final String city;
-    private final String stateProvRegion;
-    private final String zipPostalCode;
-    private final String country;
-    private final String company;
-    
-    
-    public HauskeysUser( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, HauskeysUserDao dao, String id, String description, String firstName, 
-        String lastName, String password, String mobile, String email, String notifyBy, 
-        String mobileCarrier, String tokenPin, String midletName, String failuresInEpoch, 
-        String activationKey, String realm, String secret, String label, String movingFactor, 
-        String address1, String address2, String city, String stateProvRegion, 
-        String zipPostalCode, String country, String company, boolean disabled )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp, id, description, disabled );
-        this.dao = dao;
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.password = password;
-        this.mobile = mobile;
-        this.email = email;
-        this.notifyBy = notifyBy;
-        this.mobileCarrier = mobileCarrier;
-        this.tokenPin = tokenPin;
-        this.midletName = midletName;
-        this.failuresInEpoch = failuresInEpoch;
-        this.activationKey = activationKey;
-        this.realm = realm;
-        this.secret = secret;
-        this.label = label;
-        this.movingFactor = movingFactor;
-        this.address1 = address1;
-        this.address2 = address2;
-        this.city = city;
-        this.stateProvRegion = stateProvRegion;
-        this.zipPostalCode = zipPostalCode;
-        this.country = country;
-        this.company = company;
-    }
-
-
-    public HauskeysUser( String creatorsName, Date createTimestamp, HauskeysUserDao dao, String id, 
-        String description, String firstName, String lastName, String password, String mobile, 
-        String email, String notifyBy, String mobileCarrier, String tokenPin, String midletName, 
-        String failuresInEpoch, String activationKey, String realm, String secret, String label, 
-        String movingFactor, String address1, String address2, String city, String stateProvRegion, 
-        String zipPostalCode, String country, String company, boolean disabled )
-    {
-        this( creatorsName, createTimestamp, null, null, dao, id, description, firstName, lastName, 
-            password, mobile, email, notifyBy, mobileCarrier, tokenPin, midletName, failuresInEpoch, 
-            activationKey, realm, secret, label, movingFactor, address1, address2, city, stateProvRegion, 
-            zipPostalCode, country, company, disabled );
+    //TODO this is wrong
+    public static final String[] attrs = new String[] {"uid",
+            "referral"};
+
+    private static final int MOBILE_INDEX = 14;
+    private static final int NOTIFYBY_INDEX = 14;
+    private static final int MOBILECARRIER_INDEX = 14;
+    private static final int TOKENPIN_INDEX = 14;
+    private static final int MIDLETNAME_INDEX = 14;
+    private static final int FAILURESINEPOCH_INDEX = 14;
+    private static final int ACTIVATIONKEY_INDEX = 14;
+    private static final int REALM_INDEX = 14;
+    private static final int SECRET_INDEX = 14;
+    private static final int LABEL_INDEX = 14;
+    private static final int MOVINGFACTOR_INDEX = 14;
+
+
+    public HauskeysUser()
+    {
+        super( new StateManager<HauskeysUser>( ( HauskeysUser ) null ) );
+        getStateManager().setPc( this );
+
+        getStateManager().addField( new SingleValuedField<String>( "mobile", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "notifyBy", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "mobileCarrier", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "tokenPin", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "midletName", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "failuresInEpoch", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "activationKey", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "realm", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "secret", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "label", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "movingFactor", null ) );
+    }
+
+    public HauskeysUser( String id, String description, String firstName,
+            String lastName, String password, String mobile, String email, String notifyBy,
+            String mobileCarrier, String tokenPin, String midletName, String failuresInEpoch,
+            String activationKey, String realm, String secret, String label, String movingFactor,
+            String address1, String address2, String city, String stateProvRegion,
+            String zipPostalCode, String country, String company, boolean disabled )
+    {
+        this();
+        setId( id );
+        setDescription( description );
+        setDisabled( disabled );
+
+        setFirstName( firstName );
+        setLastName( lastName );
+        setPassword( password );
+        setEmail( email );
+        setAddress1( address1 );
+        setAddress2( address2 );
+        setCity( city );
+        setStateProvRegion( stateProvRegion );
+        setZipPostalCode( zipPostalCode );
+        setCountry( country );
+        setCompany( company );
+
+        setMobile( mobile );
+        setNotifyBy( notifyBy );
+        setMobileCarrier( mobileCarrier );
+        setTokenPin( tokenPin );
+        setMidletName( midletName );
+        setFailuresInEpoch( failuresInEpoch );
+        setActivationKey( activationKey );
+        setRealm( realm );
+        setSecret( secret );
+        setLabel( label );
+        setMovingFactor( movingFactor );
     }
 
 
     public String getMobile()
     {
-        return mobile;
+        return getStateManager().getStringValue( MOBILE_INDEX );
     }
 
 
-    public String getEmail()
+    public void setMobile( String mobile )
     {
-        return email;
+        getStateManager().setStringValue( MOBILE_INDEX, mobile );
     }
 
-
     public String getNotifyBy()
     {
-        return notifyBy;
+        return getStateManager().getStringValue( NOTIFYBY_INDEX );
     }
 
 
-    public String getMobileCarrier()
+    public void setNotifyBy( String notifyBy )
     {
-        return mobileCarrier;
+        getStateManager().setStringValue( NOTIFYBY_INDEX, notifyBy );
     }
 
-
-    public String getTokenPin()
+    public String getMobileCarrier()
     {
-        return tokenPin;
+        return getStateManager().getStringValue( MOBILECARRIER_INDEX );
     }
 
 
-    public String getMidletName()
+    public void setMobileCarrier( String mobileCarrier )
     {
-        return midletName;
+        getStateManager().setStringValue( MOBILECARRIER_INDEX, mobileCarrier );
     }
 
-
-    public String getFailuresInEpoch()
+    public String getTokenPin()
     {
-        return failuresInEpoch;
+        return getStateManager().getStringValue( TOKENPIN_INDEX );
     }
 
 
-    public String getActivationKey()
+    public void setTokenPin( String tokenPin )
     {
-        return activationKey;
+        getStateManager().setStringValue( TOKENPIN_INDEX, tokenPin );
     }
 
-
-    public String getRealm()
+    public String getMidletName()
     {
-        return realm;
+        return getStateManager().getStringValue( MIDLETNAME_INDEX );
     }
 
 
-    public String getSecret()
+    public void setMidletName( String midletName )
     {
-        return secret;
+        getStateManager().setStringValue( MIDLETNAME_INDEX, midletName );
     }
 
-
-    public String getLabel()
+    public String getFailuresInEpoch()
     {
-        return label;
+        return getStateManager().getStringValue( FAILURESINEPOCH_INDEX );
     }
 
 
-    public String getMovingFactor()
+    public void setFailuresInEpoch( String failuresInEpoch )
     {
-        return movingFactor;
+        getStateManager().setStringValue( FAILURESINEPOCH_INDEX, failuresInEpoch );
     }
-    
-    
-    public String getFirstName()
+
+    public String getActivationKey()
     {
-        return firstName;
+        return getStateManager().getStringValue( ACTIVATIONKEY_INDEX );
     }
 
 
-    public String getLastName()
+    public void setActivationKey( String activationKey )
     {
-        return lastName;
+        getStateManager().setStringValue( ACTIVATIONKEY_INDEX, activationKey );
     }
 
-
-    public String getPassword()
+    public String getRealm()
     {
-        return password;
+        return getStateManager().getStringValue( REALM_INDEX );
     }
 
 
-    public String getAddress1()
+    public void setRealm( String realm )
     {
-        return address1;
+        getStateManager().setStringValue( REALM_INDEX, realm );
     }
 
-
-    public String getAddress2()
+    public String getSecret()
     {
-        return address2;
+        return getStateManager().getStringValue( SECRET_INDEX );
     }
 
 
-    public String getCity()
+    public void setSecret( String secret )
     {
-        return city;
+        getStateManager().setStringValue( SECRET_INDEX, secret );
     }
 
-
-    public String getStateProvRegion()
+    public String getLabel()
     {
-        return stateProvRegion;
+        return getStateManager().getStringValue( LABEL_INDEX );
     }
 
 
-    public String getZipPostalCode()
+    public void setLabel( String label )
     {
-        return zipPostalCode;
+        getStateManager().setStringValue( LABEL_INDEX, label );
     }
 
-
-    public String getCountry()
+    public String getMovingFactor()
     {
-        return country;
+        return getStateManager().getStringValue( MOVINGFACTOR_INDEX );
     }
 
 
-    public String getCompany()
+    public void setMovingFactor( String movingFactor )
     {
-        return company;
+        getStateManager().setStringValue( MOVINGFACTOR_INDEX, movingFactor );
     }
 
-    
-    public HauskeysUserModifier modifier()
-    {
-        return new HauskeysUserModifier( dao, this );
-    }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUser.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUser.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUser.java Thu Aug  9 16:40:15 2007
@@ -20,139 +20,189 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
-
-import org.safehaus.triplesec.admin.dao.LocalUserDao;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.StateManager;
 
 
 public class LocalUser extends User
 {
-    private final LocalUserDao dao;
-    private final String firstName;
-    private final String lastName;
-    private final String password;
-    private final String address1;
-    private final String address2;
-    private final String city;
-    private final String stateProvRegion;
-    private final String zipPostalCode;
-    private final String country;
-    private final String company;
-    private final String email;
-    
-    
-    public LocalUser( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, LocalUserDao dao, String id, String description, String firstName, 
-        String lastName, String password, String address1, String address2, String city, String stateProvRegion, 
-        String zipPostalCode, String country, String company, String email, boolean disabled )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp, id, description, disabled );
-        this.dao = dao;
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.password = password;
-        
-        this.address1 = address1;
-        this.address2 = address2;
-        this.city = city;
-        this.stateProvRegion = stateProvRegion;
-        this.zipPostalCode = zipPostalCode;
-        this.country = country;
-        this.company = company;
-        this.email = email;
-    }
-
+    //TODO this is wrong
+    public static final String[] attrs = new String[] {"uid",
+            "referral"};
+
+    private final static int FIRST_NAME_INDEX = 3;
+    private final static int LAST_NAME_INDEX = 4;
+    private final static int PASSWORD_INDEX = 5;
+    private final static int ADDRESS1_INDEX = 6;
+    private final static int ADDRESS2_INDEX = 7;
+    private final static int CITY_INDEX = 8;
+    private final static int STATEPROVREGION_INDEX = 9;
+    private final static int ZIPPOSTALCODE_INDEX = 10;
+    private final static int COUNTRY_INDEX = 11;
+    private final static int COMPANY_INDEX = 12;
+    private final static int EMAIL_INDEX = 13;
+
+    public LocalUser()
+    {
+        this( new StateManager<LocalUser>( ( LocalUser ) null ) );
+        getStateManager().setPc( this );
+    }
+
+    protected LocalUser( StateManager<? extends LocalUser> stateManager )
+    {
+        super( stateManager );
+        getStateManager().addField( new SingleValuedField<String>( "firstname", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "lastname", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "password", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "address1", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "address2", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "city", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "stateProvRegion", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "zipPostalCode", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "country", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "company", null ) );
+        getStateManager().addField( new SingleValuedField<String>( "email", null ) );
 
-    public LocalUser( String creatorsName, Date createTimestamp, LocalUserDao dao, String id, 
-        String description, String firstName, String lastName, String password, String address1, 
-        String address2, String city, String stateProvRegion, String zipPostalCode, String country, 
-        String company, String email, boolean disabled )
-    {
-        super( creatorsName, createTimestamp, id, description, disabled );
-        this.dao = dao;
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.password = password;
-        
-        this.address1 = address1;
-        this.address2 = address2;
-        this.city = city;
-        this.stateProvRegion = stateProvRegion;
-        this.zipPostalCode = zipPostalCode;
-        this.country = country;
-        this.company = company;
-        this.email = email;
     }
 
+    public LocalUser( String id, String description, String firstName,
+            String lastName, String password, String address1, String address2, String city, String stateProvRegion,
+            String zipPostalCode, String country, String company, String email, boolean disabled )
+    {
+        this();
+        setId( id );
+        setDescription( description );
+        setDisabled( disabled );
+        setFirstName( firstName );
+        setLastName( lastName );
+        setPassword( password );
+        setAddress1( address1 );
+        setAddress2( address2 );
+        setCity( city );
+        setStateProvRegion( stateProvRegion );
+        setZipPostalCode( zipPostalCode );
+        setCountry( country );
+        setCompany( company );
+        setEmail( email );
+    }
 
-    public LocalUserModifier modifier()
+    public String getFirstName()
     {
-        return new LocalUserModifier( dao, this );
+        return getStateManager().getStringValue( FIRST_NAME_INDEX );
     }
 
-
-    public String getFirstName()
+    public void setFirstName( String firstName )
     {
-        return firstName;
+        getStateManager().setStringValue( FIRST_NAME_INDEX, firstName );
     }
 
 
     public String getEmail()
     {
-        return email;
+        return getStateManager().getStringValue( EMAIL_INDEX );
     }
 
 
+    public void setEmail( String email )
+    {
+        getStateManager().setStringValue( EMAIL_INDEX, email );
+    }
+
     public String getLastName()
     {
-        return lastName;
+        return getStateManager().getStringValue( LAST_NAME_INDEX );
     }
 
 
+    public void setLastName( String lastName )
+    {
+        getStateManager().setStringValue( LAST_NAME_INDEX, lastName );
+    }
+
     public String getPassword()
     {
-        return password;
+        return getStateManager().getStringValue( PASSWORD_INDEX );
     }
 
 
+    public void setPassword( String password )
+    {
+        getStateManager().setStringValue( PASSWORD_INDEX, password );
+    }
+
     public String getAddress1()
     {
-        return address1;
+        return getStateManager().getStringValue( ADDRESS1_INDEX );
     }
 
 
+    public void setAddress1( String address1 )
+    {
+        getStateManager().setStringValue( ADDRESS1_INDEX, address1 );
+    }
+
     public String getAddress2()
     {
-        return address2;
+        return getStateManager().getStringValue( ADDRESS2_INDEX );
     }
 
 
+    public void setAddress2( String address2 )
+    {
+        getStateManager().setStringValue( ADDRESS2_INDEX, address2 );
+    }
+
     public String getCity()
     {
-        return city;
+        return getStateManager().getStringValue( CITY_INDEX );
     }
 
 
+    public void setCity( String city )
+    {
+        getStateManager().setStringValue( CITY_INDEX, city );
+    }
+
     public String getStateProvRegion()
     {
-        return stateProvRegion;
+        return getStateManager().getStringValue( STATEPROVREGION_INDEX );
     }
 
 
+    public void setStateProvRegion( String stateProvRegion )
+    {
+        getStateManager().setStringValue( STATEPROVREGION_INDEX, stateProvRegion );
+    }
+
     public String getZipPostalCode()
     {
-        return zipPostalCode;
+        return getStateManager().getStringValue( ZIPPOSTALCODE_INDEX );
     }
 
 
+    public void setZipPostalCode( String zipPostalCode )
+    {
+        getStateManager().setStringValue( ZIPPOSTALCODE_INDEX, zipPostalCode );
+    }
+
     public String getCountry()
     {
-        return country;
+        return getStateManager().getStringValue( COUNTRY_INDEX );
     }
 
 
+    public void setCountry( String country )
+    {
+        getStateManager().setStringValue( COUNTRY_INDEX, country );
+    }
+
     public String getCompany()
     {
-        return company;
+        return getStateManager().getStringValue( COMPANY_INDEX );
+    }
+
+    public void setCompany( String company )
+    {
+        getStateManager().setStringValue( COMPANY_INDEX, company );
     }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java Thu Aug  9 16:40:15 2007
@@ -71,6 +71,7 @@
 
     }
 
+/*
     public Profile(  String profileId, String description,
             Set grants, Set denials, Set roles, boolean disabled, String user )
     {
@@ -80,6 +81,7 @@
         stateManager.setStringValue( DESCRIPTION_INDEX, description);
         stateManager.setStringValue( USERID_INDEX, user);
     }
+*/
 
 
 
@@ -160,11 +162,11 @@
 
     public boolean isDisabled()
     {
-        return ((SingleValuedField<Boolean>)stateManager.getField( DISABLED_INDEX)).getCurrentValue();
+        return stateManager.getBooleanValue( DISABLED_INDEX);
     }
 
     public void setDisabled(boolean disabled) {
-        ((SingleValuedField<Boolean>)stateManager.getField( DISABLED_INDEX)).setValue( disabled);
+        stateManager.setBooleanValue( DISABLED_INDEX, disabled);
     }
 
 

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java Thu Aug  9 16:40:15 2007
@@ -20,23 +20,20 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.InitialLdapContext;
 
-import org.safehaus.triplesec.admin.dao.DaoFactory;
-import org.safehaus.triplesec.admin.dao.ExternalUserDao;
-import org.safehaus.triplesec.admin.dao.GroupDao;
-import org.safehaus.triplesec.admin.dao.HauskeysUserDao;
-import org.safehaus.triplesec.admin.dao.LocalUserDao;
-import org.safehaus.triplesec.admin.dao.UserDao;
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang.math.RandomUtils;
 import org.safehaus.triplesec.admin.persistence.EntityManager;
 import org.safehaus.triplesec.admin.persistence.EntityManagerImpl;
+import org.safehaus.triplesec.admin.persistence.PCException;
 import org.safehaus.triplesec.admin.persistence.Query;
 
 
@@ -50,13 +47,18 @@
      */
     private String appDn;
     private Query<Application> appQuery;
+    private Query<Group> groupQuery;
+    private Query<ExternalUser> externalUserQuery;
+    private Query<HauskeysUser> hauskeysUserQuery;
+    private Query<LocalUser> localUserQuery;
+    private Query<User> userQuery;
+    private Query<User> userByActivationKey;
     //deprecated
-    private DaoFactory factory;
-    private GroupDao groupDao;
-    private ExternalUserDao externalUserDao;
-    private LocalUserDao localUserDao;
-    private HauskeysUserDao hauskeysUserDao;
-    private UserDao userDao;
+//    private DaoFactory factory;
+//    private ExternalUserDao externalUserDao;
+//    private LocalUserDao localUserDao;
+//    private HauskeysUserDao hauskeysUserDao;
+//    private UserDao userDao;
 
 
     public TriplesecAdmin( EntityManager entityManager, String appDn )
@@ -64,6 +66,13 @@
         this.entityManager = entityManager;
         this.appDn = appDn;
         appQuery = ( Query<Application> ) entityManager.createQuery( appDn, Application.class, "(& (appName=*) (objectClass=policyApplication) )");
+        groupQuery = ( Query<Group> ) entityManager.createQuery( "ou=Groups", Group.class, "(& (cn=:groupId) (objectClass=groupOfUniqueNames))");
+        //TODO figure out how to query for multiple object classes
+        externalUserQuery = ( Query<ExternalUser> ) entityManager.createQuery( "ou=Users", ExternalUser.class, "(& (uid=:uid) (objectClass=referral))");
+        hauskeysUserQuery = ( Query<HauskeysUser> ) entityManager.createQuery( "ou=Users", HauskeysUser.class, "(& (uid=:uid) (objectClass=safehausProfile))");
+        localUserQuery = ( Query<LocalUser> ) entityManager.createQuery( "ou=Users", LocalUser.class, "(& (uid=:uid) (objectClass=krb5Principal))");
+        userQuery = ( Query<User> ) entityManager.createQuery( "ou=Users", User.class, "(& (uid=:uid) (| (objectClass=referral) (objectClass=person) ))");
+        userByActivationKey = ( Query<User> ) entityManager.createQuery( "ou=Users", User.class, "(& (safehausActivationKey=:activationKey) (| (objectClass=referral) (objectClass=person) ))");
     }
 
     /**
@@ -90,12 +99,12 @@
             throw new DataAccessException( "Could not construct DirContext", e);
         }
         entityManager = new EntityManagerImpl(dirContext, rootDn);
-        factory = DaoFactory.createInstance( props );
-        groupDao = factory.getGroupDao();
-        externalUserDao = factory.getExternalUserDao();
-        localUserDao = factory.getLocalUserDao();
-        hauskeysUserDao = factory.getHauskeysUserDao();
-        userDao = factory.getUserDao();
+        groupQuery = ( Query<Group> ) entityManager.createQuery( "ou=Groups",  Group.class, "(& (cn=:groupId) (objectClass=groupOfUniqueNames))");
+//        factory = DaoFactory.createInstance( props );
+//        externalUserDao = factory.getExternalUserDao();
+//        localUserDao = factory.getLocalUserDao();
+//        hauskeysUserDao = factory.getHauskeysUserDao();
+//        userDao = factory.getUserDao();
     }
 
 
@@ -110,39 +119,51 @@
     // -----------------------------------------------------------------------
 
 
-    public ExternalUserModifier newExternalUser( String id, String referral )
-    {
-        return new ExternalUserModifier( externalUserDao, id, referral );
-    }
-
-
-    public LocalUserModifier newLocalUser( String id, String firstName, String lastName, String password )
-    {
-        return new LocalUserModifier( localUserDao, id, firstName, lastName, password );
-    }
-
-
-    public HauskeysUserModifier newHauskeysUser( String id, String firstName, String lastName, String password )
-    {
-        return new HauskeysUserModifier( hauskeysUserDao, id, firstName, lastName, password );
-    }
-
 
     public User getUser( String id ) throws DataAccessException
     {
-        return userDao.load( id );
-    }
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("uid", id);
+        Map<String, User> results = userQuery.execute( parameters );
+        if (results.isEmpty()) {
+            return null;
+        }
+        Iterator<User> iterator = results.values().iterator();
+        User user = iterator.next();
+        if (iterator.hasNext()) {
+            throw new DataAccessException("More than one user found: " + results);
+        }
+        return user;
+     }
 
 
     public boolean hasUser( String id ) throws DataAccessException
     {
-        return userDao.hasUser( id );
+        return getUser( id ) != null;
     }
 
 
     public String getRandomUniqueActivationKey() throws DataAccessException
     {
-        return userDao.getRandomUniqueActivationKey();
+        String key = null;
+        int count = 0;
+        boolean isNotUnique = true;
+        while( isNotUnique && count < 10 )
+        {
+            // max length 16, min length 8 bytes
+            int length = 8 + RandomUtils.nextInt() % 8;
+            key = RandomStringUtils.randomNumeric( length );
+
+            try
+            {
+                isNotUnique = !userByActivationKey.execute("activationKey", key).isEmpty();
+            } catch ( PCException e )
+            {
+                throw new DataAccessException("Could not search for activation key", e);
+            }
+        }
+
+        return key;
     }
 
 
@@ -177,28 +198,26 @@
     // -----------------------------------------------------------------------
 
 
-    public GroupModifier newGroup( String name, String member )
-    {
-        Set members = new HashSet();
-        members.add( member );
-        return new GroupModifier( groupDao, name, members );
-    }
-
 
-    public GroupModifier newGroup( String name, Set members )
+    public synchronized Group getGroup( String name ) throws DataAccessException
     {
-        return new GroupModifier( groupDao, name, members );
-    }
-
-
-    public Group getGroup( String name ) throws DataAccessException
-    {
-        return groupDao.load( name );
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("groupId", name);
+        Map<String, Group> results = groupQuery.execute( parameters );
+        if (results.isEmpty()) {
+            return null;
+        }
+        Iterator<Group> iterator = results.values().iterator();
+        Group group = iterator.next();
+        if (iterator.hasNext()) {
+            throw new DataAccessException("More than one group found: " + results);
+        }
+        return group;
     }
 
     public void close()
     {
         entityManager.close();
-        factory.close();
+//        factory.close();
     }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/User.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/User.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/User.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/User.java Thu Aug  9 16:40:15 2007
@@ -20,58 +20,99 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
 
+import org.safehaus.triplesec.admin.persistence.PersistenceCapable;
+import org.safehaus.triplesec.admin.persistence.SimpleRdn;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.State;
+import org.safehaus.triplesec.admin.persistence.StateManager;
 
-public abstract class User extends AdministeredEntity
+
+public class User implements PersistenceCapable
 {
-    private final String id;
-    private final String description;
-    private final boolean disabled;
-    
-    
-    public User( String creatorsName, Date createTimestamp, String id, String description )
-    {
-        this( creatorsName, createTimestamp, null, null, id, description, false );
-    }
-    
-    
-    public User( String creatorsName, Date createTimestamp, String id, String description, boolean disabled )
-    {
-        this( creatorsName, createTimestamp, null, null, id, description, false );
-    }
-    
-    
-    public User( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, String id, String description, boolean disabled )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp );
-        this.id = id;
-        this.description = description;
-        this.disabled = disabled;
+    public static final String[] attrs = new String[] {"uid",
+            Constants.DESCRIPTION_ID, null,
+            Constants.SAFEHAUS_DISABLED_ID};
+
+    protected static final int ID_INDEX = 0;
+    protected static final int DESCRIPTION_INDEX = 1;
+    protected static final int DISABLED_INDEX = 2;
+
+    private StateManager<? extends User> stateManager;
+
+    public User( StateManager<? extends User> stateManager )
+    {
+        this.stateManager = stateManager;
+        stateManager.setRdn( new SimpleRdn( "uid", null, "ou=users" ) );
+        stateManager.addField( new SingleValuedField<String>( Constants.DESCRIPTION_ID, null ) );
+        stateManager.addField( new SingleValuedField<Boolean>( Constants.SAFEHAUS_DISABLED_ID, null ) );
+
+        stateManager.setState( State.EMPTY );
+    }
+
+    public User( StateManager<? extends User> stateManager, String id, String description )
+    {
+        this( stateManager, id, description, false );
+    }
+
+    public User( StateManager<? extends User> stateManager, String id, String description, boolean disabled )
+    {
+        this( stateManager );
+        setId( id );
+        setDescription( description );
+        setDisabled( disabled );
     }
 
 
     public String getId()
     {
-        return id;
+        return stateManager.getId();
     }
 
 
+    public void setId( String id )
+    {
+        stateManager.setId( id );
+    }
+
     public String getDescription()
     {
-        return description;
+        return stateManager.getStringValue( DESCRIPTION_INDEX );
+    }
+
+    public void setDescription( String description )
+    {
+        stateManager.setStringValue( DESCRIPTION_INDEX, description );
+    }
+
+    public boolean isDisabled()
+    {
+        return stateManager.getBooleanValue( DISABLED_INDEX );
     }
 
+    public void setDisabled( boolean disabled )
+    {
+        stateManager.setBooleanValue( DISABLED_INDEX, disabled );
+    }
 
     public String toString()
     {
-        return id;
+        return getId();
     }
-    
-    
-    public boolean isDisabled()
+
+    public StateManager getStateManager()
+    {
+        return stateManager;
+    }
+
+    public Attributes getAttributes()
+    {
+        return new BasicAttributes( Constants.OBJECT_CLASS_ID, "person", true );
+    }
+
+    public void parentSet( StateManager parentSm )
     {
-        return disabled;
     }
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java Thu Aug  9 16:40:15 2007
@@ -31,8 +31,14 @@
 
     Map<String, T> execute();
 
-    Map<String, T> execute(String rdn);
+    Map<String, T> execute( String rdn );
+
+    Map<String, T> execute( PersistenceCapable parent );
+
+    Map<String, T> execute( Map<String, String> parameters );
+
+    Map<String, T> execute( String paramName, String paramValue );
+
+    void setParameter( String paramName, String paramValue );
 
-    Map<String, T> execute(PersistenceCapable parent);
-   
 }

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java Thu Aug  9 16:40:15 2007
@@ -23,6 +23,9 @@
 import java.util.Collection;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Collections;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 import java.lang.reflect.*;
 
 import javax.naming.directory.SearchControls;
@@ -33,16 +36,19 @@
 import javax.naming.NamingException;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class QueryImpl<T extends PersistenceCapable> implements Query<T>, ChangeListener<T>
 {
+
+    private static final Pattern paramsPattern = Pattern.compile( ":\\w");
     private final EntityManagerImpl em;
     private final Class<T> pcClass;
     private final String query;
     private final SearchControls controls;
     private String rdn;
     private PersistenceCapable parent;
+    private Map<String, String> parameters;
 
 
     public QueryImpl( EntityManagerImpl em, Class<T> pcClass, String query )
@@ -77,6 +83,22 @@
 
     public Map<String, T> execute()
     {
+        String substitutedQuery = substitute( parameters );
+        return internalExecute( substitutedQuery );
+    }
+
+    public Map<String, T> execute( Map<String, String> parameters) {
+        String substitedQuery = substitute( parameters );
+        return internalExecute( substitedQuery );
+    }
+    public Map<String, T> execute( String paramName, String paramValue) {
+        Map<String, String> parameters = Collections.singletonMap( paramName, paramValue);
+        String substitedQuery = substitute( parameters );
+        return internalExecute( substitedQuery );
+    }
+
+    private Map<String, T> internalExecute( String substitutedQuery )
+    {
         Map<String, T> map = new HashMap<String, T>();
         DirContext ctx = em.getDirContext();
         StringBuffer buf = rdn == null? new StringBuffer(): new StringBuffer(rdn).append(",");
@@ -87,7 +109,7 @@
         String name = buf.toString();
         try
         {
-            for ( NamingEnumeration ne = ctx.search( name, query, controls) ; ne.hasMoreElements(); ) {
+            for ( NamingEnumeration ne = ctx.search( name, substitutedQuery, controls) ; ne.hasMoreElements(); ) {
                 SearchResult result = ( SearchResult ) ne.nextElement();
                 Attributes attrs = result.getAttributes();
                 String dn = result.getName();
@@ -123,6 +145,30 @@
     {
         setParent( parent );
         return execute();
+    }
+
+    public void setParameter( String paramName, String paramValue )
+    {
+        if (parameters == null ){
+            parameters  = new HashMap<String, String>();
+        }
+        parameters.put(paramName, paramValue);
+    }
+
+    private String substitute( Map<String, String> parameters ) {
+        Matcher matcher = paramsPattern.matcher( query);
+        StringBuffer result = new StringBuffer();
+        while (matcher.find( )) {
+            String paramName = matcher.group().substring( 1); //remove leading :
+            String value = parameters.get(paramName);
+            if (value == null) {
+                //TODO should this throw an exception?
+                value = "";
+            }
+            matcher.appendReplacement( result, value);
+        }
+        matcher.appendTail( result);
+        return result.toString();
     }
 
     public void changed( String oldId, String newId, T t )

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java Thu Aug  9 16:40:15 2007
@@ -218,6 +218,20 @@
         }
     }
 
+    public Boolean getBooleanValue( int pos )
+    {
+        return ( ( SingleValuedField<Boolean> ) getField( pos ) ).getCurrentValue();
+    }
+
+    public void setBooleanValue( int pos, Boolean value )
+    {
+        ( ( SingleValuedField<Boolean> ) getField( pos ) ).setValue( value );
+        if ( state == State.CLEAN )
+        {
+            state = State.DIRTY;
+        }
+    }
+
     public ModificationItem[] getModificationItems()
     {
         List<ModificationItem> mods = new ArrayList<ModificationItem>();

Modified: directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java Thu Aug  9 16:40:15 2007
@@ -22,19 +22,16 @@
 
 import java.util.Properties;
 
-import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.safehaus.triplesec.admin.dao.DaoFactory;
-import org.safehaus.triplesec.admin.dao.ldap.LdapDaoFactory;
 import org.safehaus.triplesec.admin.persistence.EntityManager;
 import org.safehaus.triplesec.admin.persistence.EntityManagerImpl;
-import org.safehaus.triplesec.admin.persistence.State;
 import org.safehaus.triplesec.admin.persistence.PCException;
+import org.safehaus.triplesec.admin.persistence.State;
 import org.safehaus.triplesec.integration.TriplesecIntegration;
 
 
@@ -51,7 +48,7 @@
     private static final String NEW_APP_RDN = "appName=newName,appName=mockApplication,ou=applications";
 
     private Properties props;
-    private DaoFactory factory;
+//    private DaoFactory factory;
     private DirContext ctx;
     private TriplesecAdmin admin;
 
@@ -69,18 +66,18 @@
         super.setUp();
 
         props = new Properties();
-        props.setProperty( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+//        props.setProperty( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
         props.setProperty( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
         props.setProperty( "java.naming.provider.url", "ldap://localhost:" + getLdapPort() + "/dc=example,dc=com" );
         props.setProperty( "java.naming.security.principal", "uid=admin,ou=system" );
         props.setProperty( "java.naming.security.credentials", "secret" );
         props.setProperty( "java.naming.security.authentication", "simple" );
 
-        factory = DaoFactory.createInstance( props );
+//        factory = DaoFactory.createInstance( props );
         ctx = new InitialDirContext( props );
         admin = new TriplesecAdmin( props );
 
-        assertNotNull( factory );
+//        assertNotNull( factory );
 
         entityManager = new EntityManagerImpl( ctx, "dc=example,dc=com" );
         Application.PARENT_APPLICATION_RDN = "appName=mockApplication,ou=applications";
@@ -470,6 +467,7 @@
     }
 
 
+/*
     public void testLocalUserDao() throws Exception
     {
         assertFalse( admin.hasUser( "testLocalUser" ) );
@@ -536,8 +534,10 @@
         user.modifier().delete();
         assertFalse( admin.hasUser( "testLocalUser" ) );
     }
+*/
 
 
+/*
     public void testHauskeysUserDao() throws Exception
     {
         assertFalse( admin.hasUser( "testHauskeysUser" ) );
@@ -603,8 +603,10 @@
         user.modifier().delete();
         assertFalse( admin.hasUser( "testHauskeysUser" ) );
     }
+*/
 
 
+/*
     public void testExternalUserDao() throws Exception
     {
         final String uid = "testExternalUser";
@@ -636,6 +638,7 @@
         user.modifier().delete();
         assertFalse( admin.hasUser( uid ) );
     }
+*/
 
 /*
     public void testGroupDao() throws Exception

Modified: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/interceptor/ChangelogService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/interceptor/ChangelogService.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/interceptor/ChangelogService.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/interceptor/ChangelogService.java Thu Aug  9 16:40:15 2007
@@ -27,31 +27,31 @@
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.LinkedList;
-import java.util.List;
 import java.util.Properties;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.DateUtils;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.safehaus.triplesec.changelog.beta.model.AddChangeEvent;
 import org.safehaus.triplesec.changelog.beta.model.ChangeEvent;
 import org.safehaus.triplesec.changelog.beta.model.DeleteChangeEvent;
 import org.safehaus.triplesec.changelog.beta.model.ModifyChangeEvent;
 import org.safehaus.triplesec.changelog.beta.model.ModifyDnChangeEvent;
 import org.safehaus.triplesec.changelog.beta.model.ModifyRdnChangeEvent;
-import org.safehaus.triplesec.changelog.beta.model.StringAttribute;
+import org.safehaus.triplesec.changelog.beta.model.MoveAndRenameChangeEvent;
 import org.safehaus.triplesec.changelog.beta.support.AttributeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,6 +61,8 @@
  * An interceptor which maintains a change log as it intercepts changes to the
  * directory. It maintains an embedded DB for writing Changelog Event records.
  * 
+ * @org.apache.xbean.XBean
+ *
  * @author <a href="mailto:ersiner@safehaus.org">Ersin Er</a>
  * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
  */
@@ -218,17 +220,18 @@
     // Overridden (only change inducing) intercepted methods
     // -----------------------------------------------------------------------
 
-    public void add( NextInterceptor next, LdapDN nDn, Attributes entry ) throws NamingException
+    public void add( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        next.add( nDn, entry );
+        next.add( opContext );
 
         if ( ! isActive )
         {
             return;
         }
 
-        AddChangeEvent changeEvent = new AddChangeEvent( 0, nDn.getUpName(), getPrincipalName(), 
-            new Date(), AttributeUtils.attributesToStringAttributeList( entry, registry ) );
+        AddOperationContext addContext = (AddOperationContext) opContext;
+        AddChangeEvent changeEvent = new AddChangeEvent( 0, addContext.getDn().getUpName(), getPrincipalName(),
+            new Date(), AttributeUtils.attributesToStringAttributeList( addContext.getEntry(), registry ) );
         
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )
@@ -239,16 +242,16 @@
     }
 
 
-    public void delete( NextInterceptor next, LdapDN nDn ) throws NamingException
+    public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        next.delete( nDn );
+        next.delete( opContext );
 
         if ( ! isActive )
         {
             return;
         }
 
-        DeleteChangeEvent changeEvent = new DeleteChangeEvent( 0, nDn.toString(), getPrincipalName(), new Date() ); 
+        DeleteChangeEvent changeEvent = new DeleteChangeEvent( 0, opContext.getDn().toString(), getPrincipalName(), new Date() );
         
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )
@@ -259,56 +262,50 @@
     }
 
 
-    public void modify( NextInterceptor next, LdapDN nDn, int modOp, Attributes mods ) throws NamingException
-    {
-        /**
-         * TODO: We need to deep copy here (before invoking the next
-         * interceptor) attributes that are being deleted or replaced. They
-         * should be gathered from the DIT while we do not have them passed
-         * here. BTW, logging this detailed information can also be necessary
-         * for "rollback support".
-         * 
-         * This issue is also valid for other similar operations.
-         */
-
-        next.modify( nDn, modOp, mods );
-
-        if ( ! isActive )
-        {
-            return;
-        }
-        
-        List strAttributes = AttributeUtils.attributesToStringAttributeList( mods, registry );
-        ModifyChangeEvent changeEvent = new ModifyChangeEvent( 0, nDn.toString(), getPrincipalName(), new Date() );
-        changeEvent.addModificationAttributes( modOp, strAttributes );
-        
-        // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
-        synchronized ( queue )
-        {
-            queue.addLast( changeEvent );
-            queue.notifyAll();
-        }
-
-    }
+//    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
+//    {
+//        /**
+//         * TODO: We need to deep copy here (before invoking the next
+//         * interceptor) attributes that are being deleted or replaced. They
+//         * should be gathered from the DIT while we do not have them passed
+//         * here. BTW, logging this detailed information can also be necessary
+//         * for "rollback support".
+//         *
+//         * This issue is also valid for other similar operations.
+//         */
+//
+//        next.modify( opContext );
+//
+//        if ( ! isActive )
+//        {
+//            return;
+//        }
+//        ModifyOperationContext modContext = (ModifyOperationContext) opContext;
+//        List strAttributes = AttributeUtils.attributesToStringAttributeList( modContext.getModItems(), registry );
+//        ModifyChangeEvent changeEvent = new ModifyChangeEvent( 0, modContext.getDn().toString(), getPrincipalName(), new Date() );
+//        changeEvent.addModificationAttributes( modContext.get, strAttributes );
+//
+//        // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
+//        synchronized ( queue )
+//        {
+//            queue.addLast( changeEvent );
+//            queue.notifyAll();
+//        }
+//
+//    }
 
 
-    public void modify( NextInterceptor next, LdapDN nDn, ModificationItemImpl[] mods ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
 
-        next.modify( nDn, mods );
+        next.modify( opContext );
 
         if ( ! isActive )
         {
             return;
         }
 
-        ModifyChangeEvent changeEvent = new ModifyChangeEvent( 0, nDn.toString(), getPrincipalName(), new Date() );
-        
-        for (int i = 0; i < mods.length; i++ )
-        {
-            StringAttribute strAttribute = AttributeUtils.attributeToStringAttribute( mods[i].getAttribute(), registry );
-            changeEvent.addModificationAttribute( mods[i].getModificationOp(), strAttribute );
-        }
+        ModifyChangeEvent changeEvent = new ModifyChangeEvent( 0, opContext.getDn().toString(), getPrincipalName(), new Date(), ((ModifyOperationContext)opContext).getModItems());
 
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )
@@ -319,10 +316,10 @@
     }
     
     
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void rename( NextInterceptor next, OperationContext operationContext ) throws NamingException
     {
         
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.rename( operationContext );
         
         if ( ! isActive )
         {
@@ -331,11 +328,9 @@
         
         ModifyRdnChangeEvent changeEvent = new ModifyRdnChangeEvent( 
             0,
-            name.toString(), 
-            getPrincipalName(), 
+            getPrincipalName(),
             new Date(), 
-            newRn, 
-            deleteOldRn);
+            (RenameOperationContext) operationContext );
 
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )
@@ -347,24 +342,22 @@
     }
     
     
-    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         
-        next.move( oldName, newParentName, newRn, deleteOldRn );
+        next.move( opContext );
 
         if ( ! isActive )
         {
             return;
         }
 
-        String newDn = newRn + "," + newParentName;
+//        String newDn = newRn + "," + newParentName;
         ModifyDnChangeEvent changeEvent = new ModifyDnChangeEvent( 
             0,
-            oldName.toString(), 
-            getPrincipalName(), 
+            getPrincipalName(),
             new Date(), 
-            newDn, 
-            deleteOldRn );
+            (MoveOperationContext) opContext );
 
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )
@@ -376,23 +369,20 @@
     }
       
     
-    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName ) throws NamingException
+    public void moveAndRename( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        next.move( oldName, newParentName );
+        next.move( opContext );
         
         if ( ! isActive )
         {
             return;
         }
-        
-        String newDn = NamespaceTools.getRdn( oldName.toString() ) + "," + newParentName;
-        ModifyDnChangeEvent changeEvent = new ModifyDnChangeEvent( 
+        MoveAndRenameOperationContext context = (MoveAndRenameOperationContext) opContext;
+        ChangeEvent changeEvent = new MoveAndRenameChangeEvent(
             0,
-            oldName.toString(), 
-            getPrincipalName(), 
+            getPrincipalName(),
             new Date(), 
-            newDn, 
-            false );
+            context );
         
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
         synchronized ( queue )

Modified: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyChangeEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyChangeEvent.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyChangeEvent.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyChangeEvent.java Thu Aug  9 16:40:15 2007
@@ -26,6 +26,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.naming.directory.ModificationItem;
+
 import org.safehaus.triplesec.changelog.beta.support.AttributeModificationType;
 import org.safehaus.triplesec.changelog.beta.support.ChangeEventType;
 
@@ -35,103 +37,27 @@
  */
 public class ModifyChangeEvent extends BaseChangeEvent
 {
-    private List addedAttributes = new ArrayList();
-    private List removedAttributes = new ArrayList();
-    private List replacedAttributes = new ArrayList();
-    private Map modifications = new HashMap();
-    
-    /** Refecence types used for as keys for the attribute modification map */
-    private static Integer ADD_ATTRIBUTE_MODIFICATION_OBJECT = new Integer( AttributeModificationType.ADD_ATTRIBUTE_MODIFICATION );
-    private static Integer REMOVE_ATTRIBUTE_MODIFICATION_OBJECT = new Integer( AttributeModificationType.REMOVE_ATTRIBUTE_MODIFICATION );
-    private static Integer REPLACE_ATTRIBUTE_MODIFICATION_OBJECT = new Integer( AttributeModificationType.REPLACE_ATTRIBUTE_MODIFICATION );
+    private final ModificationItem[] mods;
 
-    public ModifyChangeEvent( int id, String affectedEntryName, String changeEventPrincipal, Date changeEventTime )
+    public ModifyChangeEvent(int id, String affectedEntryName, String changeEventPrincipal, Date changeEventTime, ModificationItem[] modificationItems)
     {
         super( id, ChangeEventType.MODIFY_CHANGE_EVENT, affectedEntryName, changeEventPrincipal, changeEventTime );
-        
-        modifications.put( ADD_ATTRIBUTE_MODIFICATION_OBJECT, addedAttributes );
-        modifications.put( REMOVE_ATTRIBUTE_MODIFICATION_OBJECT, removedAttributes );
-        modifications.put( REPLACE_ATTRIBUTE_MODIFICATION_OBJECT, replacedAttributes );
-    }
-    
-    public void addModificationAttribute( int modType, StringAttribute attribute )
-    {
-        switch ( modType )
-        {
-            case AttributeModificationType.ADD_ATTRIBUTE_MODIFICATION:
-                addedAttributes.add( attribute );
-                break;
-            case AttributeModificationType.REMOVE_ATTRIBUTE_MODIFICATION:
-                removedAttributes.add( attribute );
-                break;
-            case AttributeModificationType.REPLACE_ATTRIBUTE_MODIFICATION:
-                replacedAttributes.add( attribute );
-                break;
-            default:
-                throw new IllegalArgumentException( "Unmatched Attribute Modification Type: " + modType );
-        }
-    }
-    
-    public void addModificationAttributes( int modType, List stringAttributes )
-    {
-        Iterator it = stringAttributes.iterator();
-        while ( it.hasNext() )
-        {
-            addModificationAttribute( modType, (StringAttribute) it.next() );
-        }
-    }
-    
-    public List getAddedAttributes()
-    {
-        return addedAttributes;
-    }
-    
-    public List getRemovedAttributes()
-    {
-        return removedAttributes;
-    }
-    
-    public List getReplacedAttributes()
-    {
-        return replacedAttributes;
-    }
-    
-    public boolean anyAddedAttributeExists()
-    {
-        return addedAttributes.size() > 0;
+        this.mods = modificationItems;
     }
-    
-    public boolean anyRemovedAttributeExists()
-    {
-        return removedAttributes.size() > 0;
-    }
-    
-    public boolean anyReplacedAttributeExists()
-    {
-        return replacedAttributes.size() > 0;
+
+    /**
+     * TODO not safe... should return an immutable copy and use a list.
+     */
+    public ModificationItem[] getMods() {
+        return mods;
     }
 
     public String getEventMessage()
     {
         StringBuffer buffer = new StringBuffer();
         
-        if ( anyAddedAttributeExists() )
-        {
-            buffer.append( "added:: " );
-            buffer.append( getAddedAttributes().toString() );
-            buffer.append( "\n" );
-        }
-        if ( anyRemovedAttributeExists() )
-        {
-            buffer.append( "removed:: " );
-            buffer.append( getRemovedAttributes().toString() );
-            buffer.append( "\n" );
-        }
-        if ( anyReplacedAttributeExists() )
-        {
-            buffer.append( "replaced:: " );
-            buffer.append( getReplacedAttributes().toString() );
-            buffer.append( "\n" );
+        for (ModificationItem mod: mods) {
+            buffer.append(mod.toString()).append("\n");
         }
         
         return buffer.toString();

Modified: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyDnChangeEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyDnChangeEvent.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyDnChangeEvent.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyDnChangeEvent.java Thu Aug  9 16:40:15 2007
@@ -22,6 +22,7 @@
 import java.util.Date;
 
 import org.safehaus.triplesec.changelog.beta.support.ChangeEventType;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 
 /**
  * @author ersin
@@ -29,29 +30,18 @@
  */
 public class ModifyDnChangeEvent extends BaseChangeEvent
 {
-    private String newDn;
-    private boolean deleteOldRdn;
-    
+    private final String newDn;
+
     
-    public ModifyDnChangeEvent( int id, String affectedEntryName, String changeEventPrincipal, Date changeEventTime, String newDn, boolean deleteOldRdn )
+    public ModifyDnChangeEvent( int id, String changeEventPrincipal, Date changeEventTime, MoveOperationContext operationContext)
     {
-        super( id, ChangeEventType.MODDN_CHANGE_EVENT, affectedEntryName, changeEventPrincipal, changeEventTime );
-        this.newDn = newDn;
-        this.deleteOldRdn = deleteOldRdn;
+        super( id, ChangeEventType.MODDN_CHANGE_EVENT, operationContext.getDn().toString(), changeEventPrincipal, changeEventTime );
+        this.newDn = operationContext.getParent().toString();
     }
     
 
     /**
-     * @return Returns the deleteOldRdn.
-     */
-    public boolean isDeleteOldRdn()
-    {
-        return deleteOldRdn;
-    }
-
-
-    /**
-     * @return Returns the newDn.
+     * @return Returns the newDn.  This is the parent of the current Dn in its new location.
      */
     public String getNewDn()
     {

Modified: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyRdnChangeEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyRdnChangeEvent.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyRdnChangeEvent.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/ModifyRdnChangeEvent.java Thu Aug  9 16:40:15 2007
@@ -22,6 +22,8 @@
 import java.util.Date;
 
 import org.safehaus.triplesec.changelog.beta.support.ChangeEventType;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 
 /**
  * @author ersin
@@ -33,11 +35,11 @@
     private boolean deleteOldRdn;
     
     
-    public ModifyRdnChangeEvent( int id, String affectedEntryName, String changeEventPrincipal, Date changeEventTime, String newRdn, boolean deleteOldRdn )
+    public ModifyRdnChangeEvent( int id, String changeEventPrincipal, Date changeEventTime, RenameOperationContext modContext )
     {
-        super( id, ChangeEventType.MODRDN_CHANGE_EVENT, affectedEntryName, changeEventPrincipal, changeEventTime );
-        this.newRdn = newRdn;
-        this.deleteOldRdn = deleteOldRdn;
+        super( id, ChangeEventType.MODRDN_CHANGE_EVENT, modContext.getDn().toString(), changeEventPrincipal, changeEventTime );
+        this.newRdn = modContext.getNewRdn();
+        this.deleteOldRdn = modContext.getDelOldDn();
     }
     
 

Added: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java?view=auto&rev=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java (added)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java Thu Aug  9 16:40:15 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.safehaus.triplesec.changelog.beta.model;
+
+import java.util.Date;
+
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.safehaus.triplesec.changelog.beta.support.ChangeEventType;
+
+/**
+ * @author ersin
+ *
+ */
+public class MoveAndRenameChangeEvent extends BaseChangeEvent
+{
+    private final String newParentDn;
+    private final String newRdn;
+    private final boolean deleteOldDn;
+
+
+    public MoveAndRenameChangeEvent( int id, String changeEventPrincipal, Date changeEventTime, MoveAndRenameOperationContext operationContext)
+    {
+        super( id, ChangeEventType.MODDN_CHANGE_EVENT, operationContext.getDn().toString(), changeEventPrincipal, changeEventTime );
+        this.newParentDn = operationContext.getParent().toString();
+        this.newRdn = operationContext.getNewRdn();
+        this.deleteOldDn = operationContext.getDelOldDn();
+    }
+
+
+    /**
+     * @return Returns the newDn.  This is the parent of the current Dn in its new location.
+     */
+    public String getNewDn()
+    {
+        return newParentDn;
+    }
+
+
+    public String getNewRdn() {
+        return newRdn;
+    }
+
+    public boolean isDeleteOldDn() {
+        return deleteOldDn;
+    }/* (non-Javadoc)
+     * @see org.safehaus.triplesec.changelog.model.BaseChangeEvent#getEventMessage()
+     */
+    public String getEventMessage()
+    {
+        return "dn moved to parent " + newParentDn + " and rdn: " + newRdn + " with old db deleted: " + deleteOldDn;
+    }
+
+}

Propchange: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/model/MoveAndRenameChangeEvent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/AttributeUtils.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/AttributeUtils.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/AttributeUtils.java Thu Aug  9 16:40:15 2007
@@ -56,7 +56,7 @@
         String id = ( String ) attr.getID();
         int size = attr.size();
         
-        boolean isBinary = ! registry.lookup( id ).getSyntax().isHumanReadible();
+        boolean isBinary = ! registry.lookup( id ).getSyntax().isHumanReadable();
         
         StringAttribute strAttribute = new StringAttribute( id );
 



Mime
View raw message