directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r496618 [1/5] - in /directory/sandbox/triplesec-jacc2: ./ admin-api2/ admin-api2/src/ 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/tr...
Date Tue, 16 Jan 2007 08:24:50 GMT
Author: djencks
Date: Tue Jan 16 00:24:45 2007
New Revision: 496618

URL: http://svn.apache.org/viewvc?view=rev&rev=496618
Log:
Intermediate commit, does not all compile.  Includes object-ldap mapping framework in admin-api2, some rewrite of jaas, some jacc support, and lots of problems due to change in bootstrap schema loading

Added:
    directory/sandbox/triplesec-jacc2/admin-api2/
      - copied from r493297, directory/sandbox/triplesec-jacc2/admin-api/
    directory/sandbox/triplesec-jacc2/admin-api2/pom.xml
      - copied unchanged from r496616, directory/sandbox/triplesec-jacc2/admin-api/pom.xml
    directory/sandbox/triplesec-jacc2/admin-api2/src/
      - copied from r496616, directory/sandbox/triplesec-jacc2/admin-api/src/
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ChangeListener.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ChildMap.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ConstantRdn.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Field.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/HiddenChild.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/MultiValuedField.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/PCException.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/PersistenceCapable.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Rdn.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ReferenceMapField.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/RootStateManager.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/SimpleRdn.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/SingleValuedField.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/State.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/StateManager.java   (with props)
    directory/sandbox/triplesec-jacc2/admin-api2/todo.txt
      - copied unchanged from r496616, directory/sandbox/triplesec-jacc2/admin-api/todo.txt
    directory/sandbox/triplesec-jacc2/guardian-api/src/main/java/org/safehaus/triplesec/guardian/RealmPolicy.java   (with props)
    directory/sandbox/triplesec-jacc2/guardian-api/src/main/java/org/safehaus/triplesec/guardian/RealmPolicyFactory.java
      - copied, changed from r493297, directory/sandbox/triplesec-jacc/guardian-api/src/main/java/org/safehaus/triplesec/guardian/RealmPolicyFactory.java
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/apache/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/apache/directory/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/apache/directory/triplesec/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/apache/directory/triplesec/jaas/
    directory/sandbox/triplesec-jacc2/itest-data/src/main/java/org/apache/directory/triplesec/jaas/TestLoginConfiguration.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/BaseKerberosLoginModuleWrapper.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/Kerberos1FactorLoginModuleWrapper.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/Kerberos2FactorLoginModuleWrapper.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/LdapBindLoginModule.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/TriplesecRealmPrincipal.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/TriplesecRealmPrincipalLoginModule.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/TriplesecRealmPrincipalLoginModuleTest.java   (with props)
    directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/UPCallbackHandler.java   (with props)
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/PermissionKey.java   (with props)
Removed:
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ApplicationModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/MultiValuedField.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/PermissionModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ProfileModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/RoleModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/SingleValuedField.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ApplicationDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/PermissionDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ProfileDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/RoleDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapApplicationDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapPermissionDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapProfileDao.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapRoleDao.java
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/data/
Modified:
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/AdministeredEntity.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Application.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Constants.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Permission.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Profile.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Role.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/DaoFactory.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/ldap/LdapDaoFactory.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/EntryModifierTest.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/test/java/org/safehaus/triplesec/admin/IntegrationTest.java
    directory/sandbox/triplesec-jacc2/configuration-io/pom.xml
    directory/sandbox/triplesec-jacc2/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java
    directory/sandbox/triplesec-jacc2/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java
    directory/sandbox/triplesec-jacc2/configuration-io/src/test/java/org/safehaus/triplesec/configuration/WebappConfigurationTest.java
    directory/sandbox/triplesec-jacc2/configuration/src/main/java/org/safehaus/triplesec/configuration/MutableTriplesecStartupConfiguration.java
    directory/sandbox/triplesec-jacc2/guardian-api/src/main/java/org/safehaus/triplesec/guardian/ConnectionDriver.java
    directory/sandbox/triplesec-jacc2/guardian-api/src/test/java/org/safehaus/triplesec/guardian/ApplicationPolicyFactoryTest.java
    directory/sandbox/triplesec-jacc2/guardian-api/src/test/java/org/safehaus/triplesec/guardian/mock/MockConnectionDriver.java
    directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapConnectionDriver.java
    directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifConnectionDriver.java
    directory/sandbox/triplesec-jacc2/integration/src/main/java/org/safehaus/triplesec/integration/TriplesecIntegration.java
    directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.ldif
    directory/sandbox/triplesec-jacc2/jaas/pom.xml
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/DataPolicyConfiguration.java
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfiguration.java
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
    directory/sandbox/triplesec-jacc2/jacc/src/test/java/org/apache/directory/triplesec/jacc/TripleSecPolicyIntegrationTest.java
    directory/sandbox/triplesec-jacc2/pom.xml
    directory/sandbox/triplesec-jacc2/store/pom.xml
    directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/DefaultServerProfileStore.java
    directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/ProfileStateFactory.java
    directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java
    directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java
    directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ProfileFactoryITest.java
    directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java
    directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java
    directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
    directory/sandbox/triplesec-jacc2/verifier/pom.xml
    directory/sandbox/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java
    directory/sandbox/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/AdministeredEntity.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/AdministeredEntity.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/AdministeredEntity.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/AdministeredEntity.java Tue Jan 16 00:24:45 2007
@@ -22,50 +22,52 @@
 
 import java.util.Date;
 
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+
 
 public abstract class AdministeredEntity
 {
-    private final String creatorsName;
-    private final String modifiersName;
-    private final Date createTimestamp;
-    private final Date modifyTimestamp;
-    
-    
+    private final SingleValuedField<String> creatorsName;
+    private final SingleValuedField<String> modifiersName;
+    private final SingleValuedField<Date> createTimestamp;
+    private final SingleValuedField<Date> modifyTimestamp;
+
+
     protected AdministeredEntity( String creatorsName, Date creationTimestamp )
     {
         this( creatorsName, creationTimestamp, null, null );
     }
-    
-    
+
+
     protected AdministeredEntity( String creatorsName, Date createTimestamp, String modifiersName, Date modifyTimestamp )
     {
-        this.creatorsName = creatorsName;
-        this.createTimestamp = createTimestamp;
-        this.modifiersName = modifiersName;
-        this.modifyTimestamp = modifyTimestamp;
+        this.creatorsName = new SingleValuedField<String>("creatorsName", creatorsName);
+        this.createTimestamp = new SingleValuedField<Date>("createTimestamp", createTimestamp);
+        this.modifiersName = new SingleValuedField<String>("modifiersName", modifiersName);
+        this.modifyTimestamp = new SingleValuedField<Date>("modifiersName", modifyTimestamp);
     }
-    
-    
+
+
     public String getCreatorsName()
     {
-        return creatorsName;
+        return creatorsName.getCurrentValue();
     }
 
 
     public String getModifiersName()
     {
-        return modifiersName;
+        return modifiersName.getCurrentValue();
     }
 
 
     public Date getCreateTimestamp()
     {
-        return createTimestamp;
+        return createTimestamp.getCurrentValue();
     }
 
 
     public Date getModifyTimestamp()
     {
-        return modifyTimestamp;
+        return modifyTimestamp.getCurrentValue();
     }
 }

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Application.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Application.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Application.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Application.java Tue Jan 16 00:24:45 2007
@@ -20,160 +20,210 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
-import java.util.Iterator;
+import java.util.Collection;
 
-import org.safehaus.triplesec.admin.dao.ApplicationDao;
-import org.safehaus.triplesec.admin.dao.PermissionDao;
-import org.safehaus.triplesec.admin.dao.ProfileDao;
-import org.safehaus.triplesec.admin.dao.RoleDao;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.SearchControls;
 
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.StateManager;
+import org.safehaus.triplesec.admin.persistence.SimpleRdn;
+import org.safehaus.triplesec.admin.persistence.PersistenceCapable;
+import org.safehaus.triplesec.admin.persistence.State;
+import org.safehaus.triplesec.admin.persistence.ChildMap;
+import org.safehaus.triplesec.admin.persistence.HiddenChild;
 
-public class Application extends AdministeredEntity
+
+public class Application implements PersistenceCapable
 {
-    private final RoleDao roleDao;
-    private final ProfileDao profileDao;
-    private final PermissionDao permissionDao;
-    private final String appRdn;
-    private final String description;
-    private final String password;
-    private final ApplicationDao dao;
-    
-    
-    public Application( String creatorsName, Date creationTimestamp, ApplicationDao dao, String name, 
-        String description, String password, PermissionDao permissionDao, RoleDao roleDao, ProfileDao profileDao )
-    {
-        this( creatorsName, creationTimestamp, null, null, dao, name, description, password,
-            permissionDao, roleDao, profileDao );
-    }
-    
-    
-    public Application( String creatorsName, Date creationTimestamp, String modifiersName, Date modifyTimestamp, 
-        ApplicationDao dao, String name, String description, String userPassword, PermissionDao permissionDao, 
-        RoleDao roleDao, ProfileDao profileDao )
-    {
-        super( creatorsName, creationTimestamp, modifiersName, modifyTimestamp );
-        this.appRdn = name;
-        this.dao = dao;
-        this.description = description;
-        this.permissionDao = permissionDao;
-        this.profileDao = profileDao;
-        this.roleDao = roleDao;
-        this.password = userPassword;
-    }
-    
-    
-    // -----------------------------------------------------------------------
-    // Package friendly dao accessors
-    // -----------------------------------------------------------------------
-    
-    
-    PermissionDao getPermissionDao()
-    {
-        return permissionDao;
-    }
-    
-    
-    RoleDao getRoleDao()
-    {
-        return roleDao;
-    }
-    
-    
-    ProfileDao getProfileDao()
-    {
-        return profileDao;
-    }
-    
-    
-    // -----------------------------------------------------------------------
-    // Property accessors
-    // -----------------------------------------------------------------------
-    
-    
-    public String getAppRdn()
+    public static String PARENT_APPLICATION_RDN = "ou=applications";
+
+    private static final SearchControls PERMISSIONS_CONTROLS = new SearchControls( SearchControls.ONELEVEL_SCOPE, 0, 0, Permission.attrs, false, false );
+    private static final String PERMISSIONS_QUERY = "(& (permName=*) (objectClass=policyPermission) )";
+    private static final HiddenChild PERMISSIONS_SPACER = new HiddenChild( "ou=permissions", new BasicAttributes( "objectClass", "OrganizationalUnit", true ) );
+
+    private static final SearchControls ROLES_CONTROLS = new SearchControls( SearchControls.ONELEVEL_SCOPE, 0, 0, Role.attrs, false, false );
+    private static final String ROLES_QUERY = "(& (roleName=*) (objectClass=policyRole) )";
+    private static final HiddenChild ROLES_SPACER = new HiddenChild( "ou=roles", new BasicAttributes( "objectClass", "OrganizationalUnit", true ) );
+
+    private static final SearchControls PROFILES_CONTROLS = new SearchControls( SearchControls.ONELEVEL_SCOPE, 0, 0, Profile.attrs, false, false );
+    private static final String PROFILES_QUERY = "(& (profileId=*) (objectClass=policyProfile) )";
+    private static final HiddenChild PROFILES_SPACER = new HiddenChild( "ou=profiles", new BasicAttributes( "objectClass", "OrganizationalUnit", true ) );
+
+    private static final int APPNAME_INDEX = 0;
+    private static final int DESCRIPTION_INDEX = 1;
+    private static final int PASSWORD_INDEX = 2;
+
+    static final int PERMISSIONS_INDEX = 0;
+    static final int ROLES_INDEX = 1;
+    static final int PROFILES_INDEX = 2;
+
+    private final StateManager stateManager;
+
+    public Application()
+    {
+        stateManager = new StateManager( this );
+        stateManager.setRdn( new SimpleRdn( "appName", null, PARENT_APPLICATION_RDN ) );
+        stateManager.addField( new SingleValuedField<String>( "description", null ) );
+        stateManager.addField( new SingleValuedField<String>( "userPassword", null ) );
+
+        stateManager.addMap( new ChildMap<Permission>( this, Permission.class, "ou=permissions", PERMISSIONS_CONTROLS, PERMISSIONS_QUERY ) );
+        stateManager.addMap( new ChildMap<Role>( this, Role.class, "ou=roles", ROLES_CONTROLS, ROLES_QUERY ) );
+        stateManager.addMap( new ChildMap<Profile>( this, Profile.class, "ou=profiles", PROFILES_CONTROLS, PROFILES_QUERY ) );
+
+        stateManager.addHiddenChild( PERMISSIONS_SPACER );
+        stateManager.addHiddenChild( ROLES_SPACER );
+        stateManager.addHiddenChild( PROFILES_SPACER );
+
+        stateManager.setState( State.EMPTY );
+    }
+
+    public Application( String name, String description, String password )
+    {
+        this();
+        setAppName( name );
+        setDescription( description );
+        setPassword( password );
+    }
+
+    public void setParentStateManager( StateManager parentSM )
     {
-        return appRdn;
+        stateManager.setParent( parentSM );
     }
-    
-    
+
+    public void setParentApplication( Application application )
+    {
+        setParentStateManager( application.stateManager );
+    }
+
+    public String getAppName()
+    {
+        return stateManager.getId();
+    }
+
+    public void setAppName( String appName )
+    {
+        stateManager.setId( appName );
+    }
+
+
     public String getDescription()
     {
-        return description;
+        return stateManager.getStringValue( DESCRIPTION_INDEX );
+    }
+
+    public void setDescription( String description )
+    {
+        stateManager.setStringValue( DESCRIPTION_INDEX, description );
     }
-    
-    
+
+
     public String getPassword()
     {
-        return password;
+        return stateManager.getStringValue( PASSWORD_INDEX );
     }
-    
-    
-    // -----------------------------------------------------------------------
-    // Accessors to contained entities
-    // -----------------------------------------------------------------------
-    
-    
-    public Permission getPermission( String permName ) throws DataAccessException
+
+    public void setPassword( String password )
+    {
+        stateManager.setStringValue( PASSWORD_INDEX, password );
+    }
+
+    public Permission getPermission( String permissionId )
+    {
+        ChildMap<Permission> map = stateManager.getChildMap( PERMISSIONS_INDEX );
+        return map.get( permissionId );
+    }
+
+    public void addPermission( Permission permission )
+    {
+        ChildMap<Permission> map = stateManager.getChildMap( PERMISSIONS_INDEX );
+        String permissionId = permission.getPermissionId();
+        map.put( permissionId, permission );
+    }
+
+    public void removePermission( Permission permission )
+    {
+        ChildMap<Permission> map = stateManager.getChildMap( PERMISSIONS_INDEX );
+        String permissionId = permission.getPermissionId();
+        map.remove( permissionId );
+    }
+
+    public Collection<Permission> getPermissions()
+    {
+        ChildMap<Permission> map = stateManager.getChildMap( PERMISSIONS_INDEX );
+        return map.values();
+    }
+
+    public Role getRole( String roleId )
     {
-        return permissionDao.load( appRdn, permName );
+        ChildMap<Role> map = stateManager.getChildMap( ROLES_INDEX );
+        return map.get( roleId );
     }
-    
-    
-    public Role getRole( String roleName ) throws DataAccessException
+
+    public void addRole( Role role )
+    {
+        ChildMap<Role> map = stateManager.getChildMap( ROLES_INDEX );
+        String roleId = role.getRoleName();
+        map.put( roleId, role );
+    }
+
+    public void removeRole( Role role )
     {
-        return roleDao.load( appRdn, roleName );
+        ChildMap<Role> map = stateManager.getChildMap( ROLES_INDEX );
+        String roleId = role.getRoleName();
+        map.remove( roleId );
     }
-    
-    
-    public Profile getProfile( String profileId ) throws DataAccessException
+
+    public Collection<Role> getRoles()
+    {
+        ChildMap<Role> map = stateManager.getChildMap( ROLES_INDEX );
+        return map.values();
+    }
+
+    public Profile getProfile( String profileId )
     {
-        return profileDao.load( appRdn, profileId );
+        ChildMap<Profile> map = stateManager.getChildMap( PROFILES_INDEX );
+        return map.get( profileId );
     }
-    
-    
-    // -----------------------------------------------------------------------
-    // ReadOnly Iterator methods
-    // -----------------------------------------------------------------------
-    
-    
-    public Iterator permissionIterator() throws DataAccessException
+
+    public void addProfile( Profile profile )
     {
-        return new ReadOnlyIterator( permissionDao.permissionIterator( appRdn ) );
+        ChildMap<Profile> map = stateManager.getChildMap( PROFILES_INDEX );
+        String profileId = profile.getProfileId();
+        map.put( profileId, profile );
     }
-    
-    
-    public Iterator roleIterator() throws DataAccessException
+
+    public void removeProfile( Profile profile )
     {
-        return new ReadOnlyIterator( roleDao.roleIterator( appRdn ) );
+        ChildMap<Profile> map = stateManager.getChildMap( PROFILES_INDEX );
+        String profileId = profile.getProfileId();
+        map.remove( profileId );
     }
-    
-    
-    public Iterator profileIterator() throws DataAccessException
+
+    public Collection<Profile> getProfiles()
     {
-        return new ReadOnlyIterator( profileDao.profileIterator( appRdn ) );
+        ChildMap<Profile> map = stateManager.getChildMap( PROFILES_INDEX );
+        return map.values();
     }
-    
-    
-    public Iterator profileIterator( String user) throws DataAccessException
+
+//    public String toString()
+//    {
+//        return appRdn;
+//    }
+
+    public StateManager getStateManager()
     {
-        return new ReadOnlyIterator( profileDao.profileIterator( appRdn, user ) );
+        return stateManager;
     }
-    
-    
-    // -----------------------------------------------------------------------
-    // Modifier factory methods
-    // -----------------------------------------------------------------------
-    
-    
-    public ApplicationModifier modifier()
+
+    public Attributes getAttributes()
     {
-        return new ApplicationModifier( dao, this );
+        return new BasicAttributes( Constants.OBJECT_CLASS_ID, Constants.POLICY_APPLICATION_OC, true );
     }
-    
-    
-    public String toString()
+
+    public void parentSet( StateManager parentSm )
     {
-        return appRdn;
     }
+
 }

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Constants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Constants.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Constants.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Constants.java Tue Jan 16 00:24:45 2007
@@ -25,6 +25,7 @@
 
 public interface Constants
 {
+    String POLICY_APPLICATION_OC = "policyApplication";
     String POLICY_PROFILE_OC = "policyProfile";
     String POLICY_PERMISSION_OC = "policyPermission";
     String POLICY_ROLE_OC = "policyRole";
@@ -38,6 +39,7 @@
     String KRB5PRINCIPAL_OC = "krb5Principal";
     String KRB5KDCENTRY_OC = "krb5KDCEntry";
     String REFERRAL_OC = "referral";
+    String POLICY_JAVA_PERMISSION_OC = "javaPermission";
     
     String SAFEHAUS_RESYNCH_COUNT_ID = "safehausResynchCount";
     String SAFEHAUS_DISABLED_ID = "safehausDisabled";
@@ -90,6 +92,10 @@
     String PROFILEID_ID = "profileId";
     String SAFEHAUS_ID = "safehausUid";
     String CREATORS_NAME_ID = "creatorsName";
+
+    String PERM_JAVA_CLASS_ID = "permJavaClass";
+    String PERM_JAVA_NAME_ID = "permJavaName";
+    String PERM_JAVA_ACTIONS_ID = "permJavaActions";
 
     ModificationItem[] EMPTY_MODS = new ModificationItem[0];
     String INVALID_MSG = "This modifier has persisted changes and is no longer valid.";

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/ExternalUserModifier.java Tue Jan 16 00:24:45 2007
@@ -26,33 +26,34 @@
 import javax.naming.directory.ModificationItem;
 
 import org.safehaus.triplesec.admin.dao.ExternalUserDao;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
 
 
 public class ExternalUserModifier implements Constants
 {
-    private SingleValuedField referral;
-    private final SingleValuedField disabled;
-    
+    private SingleValuedField<String> referral;
+    private final SingleValuedField<String> disabled;
+
     private final ExternalUserDao dao;
     private final String id;
     private final ExternalUser archetype;
-    private final SingleValuedField description;
+    private final SingleValuedField<String> description;
     private boolean persisted = false;
-    
-    
+
+
     // -----------------------------------------------------------------------
     // Constructors
     // -----------------------------------------------------------------------
 
-    
+
     public ExternalUserModifier( ExternalUserDao dao, ExternalUser archetype )
     {
         this.id = archetype.getId();
         this.dao = dao;
         this.archetype = archetype;
-        this.referral = new SingleValuedField( REF_ID, archetype.getReferral() );
-        this.description = new SingleValuedField( DESCRIPTION_ID, archetype.getDescription() );
-        this.disabled = new SingleValuedField( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
+        this.referral = new SingleValuedField<String>( REF_ID, archetype.getReferral() );
+        this.description = new SingleValuedField<String>( DESCRIPTION_ID, archetype.getDescription() );
+        this.disabled = new SingleValuedField<String>( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
     }
 
 
@@ -65,13 +66,13 @@
         this.description = new SingleValuedField( DESCRIPTION_ID, null );
         this.disabled = new SingleValuedField( KRB5_DISABLED_ID, null );
     }
-    
-    
+
+
     // -----------------------------------------------------------------------
     // Mutators
     // -----------------------------------------------------------------------
 
-    
+
     public ExternalUserModifier setDisabled( boolean disabled )
     {
         if ( persisted )
@@ -81,8 +82,8 @@
         this.disabled.setValue( String.valueOf( disabled ).toUpperCase() );
         return this;
     }
-    
-    
+
+
     public ExternalUserModifier setReferral( String referral )
     {
         if ( persisted )
@@ -92,8 +93,8 @@
         this.referral.setValue( referral );
         return this;
     }
-    
-   
+
+
     public ExternalUserModifier setDescription( String description )
     {
         if ( persisted )
@@ -109,7 +110,7 @@
     // Modifier Check Methods
     // -----------------------------------------------------------------------
 
-    
+
     public boolean isUpdateNeeded()
     {
         return description.isUpdateNeeded() || referral.isUpdateNeeded() || disabled.isUpdateNeeded();
@@ -126,19 +127,19 @@
     {
         return archetype != null;
     }
-    
-    
+
+
     public boolean isValid()
     {
         return ! persisted;
     }
-    
-    
+
+
     // -----------------------------------------------------------------------
     // Modifier Methods
     // -----------------------------------------------------------------------
 
-    
+
     public ExternalUser add() throws DataAccessException
     {
         if ( persisted )
@@ -149,8 +150,8 @@
         persisted = true;
         return user;
     }
-    
-    
+
+
     public ExternalUser rename( String newName ) throws DataAccessException
     {
         if ( persisted )
@@ -163,27 +164,27 @@
             throw new ModificationLossException( id + " has been modified. " +
                     "A rename operation will result in the loss of these modifications." );
         }
-        
+
         ExternalUser user = dao.rename( newName, archetype );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public ExternalUser modify() throws DataAccessException
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        ExternalUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id, 
-            description.getCurrentValue(), referral.getCurrentValue(), 
+        ExternalUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id,
+            description.getCurrentValue(), referral.getCurrentValue(),
             parseBoolean( disabled.getCurrentValue().toLowerCase() ), getModificationItems() );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public void delete() throws DataAccessException
     {
         if ( persisted )
@@ -194,7 +195,7 @@
         persisted = true;
     }
 
-    
+
     private ModificationItem[] getModificationItems()
     {
         // new entries do not generate modification items
@@ -231,7 +232,7 @@
         {
             return true;
         }
-        
+
         return false;
     }
 }

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/GroupModifier.java Tue Jan 16 00:24:45 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.ModificationItem;
 
 import org.safehaus.triplesec.admin.dao.GroupDao;
+import org.safehaus.triplesec.admin.persistence.MultiValuedField;
 
 
 public class GroupModifier implements Constants
@@ -43,8 +44,8 @@
         this.name = archetype.getName();
         this.members = new MultiValuedField( UNIQUE_MEMBER_ID, archetype.getMembers() );
     }
-    
-    
+
+
     public GroupModifier( GroupDao dao, String name, Set members )
     {
         this.dao = dao;
@@ -61,12 +62,12 @@
         {
             return EMPTY_MODS;
         }
-        
+
         if ( members.isUpdateNeeded() )
         {
             return new ModificationItem[] { members.getModificationItem() };
         }
-        
+
         return EMPTY_MODS;
     }
 
@@ -81,32 +82,32 @@
     {
         return archetype != null;
     }
-    
-    
+
+
     public boolean isUpdateNeeded()
     {
         return members.isUpdateNeeded();
     }
-    
-    
+
+
     public boolean isValid()
     {
         return ! persisted;
     }
-    
-    
+
+
     public GroupModifier addMember( String member )
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        
+
         members.addValue( member );
         return this;
     }
-    
-    
+
+
     public GroupModifier removeMember( String member )
     {
         if ( persisted )
@@ -117,8 +118,8 @@
         members.removeValue( member );
         return this;
     }
-    
-    
+
+
     public Group add() throws DataAccessException
     {
         if ( persisted )
@@ -129,8 +130,8 @@
         persisted = true;
         return group;
     }
-    
-    
+
+
     public Group rename( String newName ) throws DataAccessException
     {
         if ( persisted )
@@ -143,26 +144,26 @@
             throw new ModificationLossException( name + " has been modified. " +
                     "A rename operation will result in the loss of these modifications." );
         }
-        
+
         Group group = dao.rename( newName, archetype );
         persisted = true;
         return group;
     }
-    
-    
+
+
     public Group modify() throws DataAccessException
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        Group group = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), name, 
+        Group group = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), name,
             members.getCurrentValues(), getModificationItems() );
         persisted = true;
         return group;
     }
-    
-    
+
+
     public void delete() throws DataAccessException
     {
         if ( persisted )

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/HauskeysUserModifier.java Tue Jan 16 00:24:45 2007
@@ -28,6 +28,7 @@
 import javax.naming.directory.ModificationItem;
 
 import org.safehaus.triplesec.admin.dao.HauskeysUserDao;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
 
 
 public class HauskeysUserModifier implements Constants
@@ -36,103 +37,103 @@
     private final HauskeysUser archetype;
     private final HauskeysUserDao dao;
 
-    private final SingleValuedField firstName;
-    private final SingleValuedField disabled;
-    private final SingleValuedField lastName;
-    private final SingleValuedField password;
-    private final SingleValuedField description;
-    private final SingleValuedField mobile;
-    private final SingleValuedField email;
-    private final SingleValuedField notifyBy;
-    private final SingleValuedField mobileCarrier;
-    private final SingleValuedField tokenPin;
-    private final SingleValuedField midletName;
-    private final SingleValuedField failuresInEpoch;
-    private final SingleValuedField activationKey;
-    private final SingleValuedField realm;
-    private final SingleValuedField secret;
-    private final SingleValuedField label;
-    private final SingleValuedField movingFactor;
-    
-    private final SingleValuedField address1;
-    private final SingleValuedField address2;
-    private final SingleValuedField city;
-    private final SingleValuedField stateProvRegion;
-    private final SingleValuedField zipPostalCode;
-    private final SingleValuedField country;
-    private final SingleValuedField company;
+    private final SingleValuedField<String> firstName;
+    private final SingleValuedField<String> disabled;
+    private final SingleValuedField<String> lastName;
+    private final SingleValuedField<String> password;
+    private final SingleValuedField<String> description;
+    private final SingleValuedField<String> mobile;
+    private final SingleValuedField<String> email;
+    private final SingleValuedField<String> notifyBy;
+    private final SingleValuedField<String> mobileCarrier;
+    private final SingleValuedField<String> tokenPin;
+    private final SingleValuedField<String> midletName;
+    private final SingleValuedField<String> failuresInEpoch;
+    private final SingleValuedField<String> activationKey;
+    private final SingleValuedField<String> realm;
+    private final SingleValuedField<String> secret;
+    private final SingleValuedField<String> label;
+    private final SingleValuedField<String> movingFactor;
+
+    private final SingleValuedField<String> address1;
+    private final SingleValuedField<String> address2;
+    private final SingleValuedField<String> city;
+    private final SingleValuedField<String> stateProvRegion;
+    private final SingleValuedField<String> zipPostalCode;
+    private final SingleValuedField<String> country;
+    private final SingleValuedField<String> company;
 
     private boolean persisted = false;
-    
-    
+
+
     // -----------------------------------------------------------------------
     // Constructors
     // -----------------------------------------------------------------------
 
-    
+
     public HauskeysUserModifier( HauskeysUserDao dao, HauskeysUser archetype )
     {
         this.id = archetype.getId();
         this.dao = dao;
         this.archetype = archetype;
-        this.firstName = new SingleValuedField( GIVENNAME_ID, archetype.getFirstName() );
-        this.lastName = new SingleValuedField( SURNAME_ID, archetype.getLastName() );
-        this.password = new SingleValuedField( PASSWORD_ID, archetype.getPassword() );
-        this.description = new SingleValuedField( DESCRIPTION_ID, archetype.getDescription() );
-        this.mobile = new SingleValuedField( MOBILE_ID, archetype.getMobile() );
-        this.email = new SingleValuedField( EMAIL_ID, archetype.getEmail() );
-        this.notifyBy = new SingleValuedField( NOTIFY_BY_ID, archetype.getNotifyBy() );
-        this.mobileCarrier = new SingleValuedField( MOBILE_CARRIER_ID, archetype.getMobileCarrier() );
-        this.tokenPin = new SingleValuedField( TOKEN_PIN_ID, archetype.getTokenPin() );
-        this.midletName = new SingleValuedField( MIDLE_NAME_ID, archetype.getMidletName() );
-        this.failuresInEpoch = new SingleValuedField( FAILURES_IN_EPOCH_ID, archetype.getFailuresInEpoch() );
-        this.activationKey = new SingleValuedField( ACTIVATION_KEY_ID, archetype.getActivationKey() );
-        this.realm = new SingleValuedField( REALM_ID, archetype.getRealm() );
-        this.secret = new SingleValuedField( SECRET_ID, archetype.getSecret() );
-        this.label = new SingleValuedField( LABEL_ID, archetype.getLabel() );
-        this.movingFactor = new SingleValuedField( MOVING_FACTOR_ID, archetype.getMovingFactor() );
-        this.address1 = new SingleValuedField( STREET_ID, archetype.getAddress1() );
-        this.address2 = new SingleValuedField( POSTAL_ADDRESS_ID, archetype.getAddress2() );
-        this.city = new SingleValuedField( LOCALITY_NAME_ID, archetype.getCity() );
-        this.stateProvRegion = new SingleValuedField( STATE_PROVINCE_ID, archetype.getStateProvRegion() );
-        this.zipPostalCode = new SingleValuedField( ZIP_POSTAL_CODE_ID, archetype.getZipPostalCode() );
-        this.country = new SingleValuedField( COUNTRY_ID, archetype.getCountry() );
-        this.company = new SingleValuedField( ORGANIZATION_ID, archetype.getCompany() );
-        this.disabled = new SingleValuedField( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
+        this.firstName = new SingleValuedField<String>( GIVENNAME_ID, archetype.getFirstName() );
+        this.lastName = new SingleValuedField<String>( SURNAME_ID, archetype.getLastName() );
+        this.password = new SingleValuedField<String>( PASSWORD_ID, archetype.getPassword() );
+        this.description = new SingleValuedField<String>( DESCRIPTION_ID, archetype.getDescription() );
+        this.mobile = new SingleValuedField<String>( MOBILE_ID, archetype.getMobile() );
+        this.email = new SingleValuedField<String>( EMAIL_ID, archetype.getEmail() );
+        this.notifyBy = new SingleValuedField<String>( NOTIFY_BY_ID, archetype.getNotifyBy() );
+        this.mobileCarrier = new SingleValuedField<String>( MOBILE_CARRIER_ID, archetype.getMobileCarrier() );
+        this.tokenPin = new SingleValuedField<String>( TOKEN_PIN_ID, archetype.getTokenPin() );
+        this.midletName = new SingleValuedField<String>( MIDLE_NAME_ID, archetype.getMidletName() );
+        this.failuresInEpoch = new SingleValuedField<String>( FAILURES_IN_EPOCH_ID, archetype.getFailuresInEpoch() );
+        this.activationKey = new SingleValuedField<String>( ACTIVATION_KEY_ID, archetype.getActivationKey() );
+        this.realm = new SingleValuedField<String>( REALM_ID, archetype.getRealm() );
+        this.secret = new SingleValuedField<String>( SECRET_ID, archetype.getSecret() );
+        this.label = new SingleValuedField<String>( LABEL_ID, archetype.getLabel() );
+        this.movingFactor = new SingleValuedField<String>( MOVING_FACTOR_ID, archetype.getMovingFactor() );
+        this.address1 = new SingleValuedField<String>( STREET_ID, archetype.getAddress1() );
+        this.address2 = new SingleValuedField<String>( POSTAL_ADDRESS_ID, archetype.getAddress2() );
+        this.city = new SingleValuedField<String>( LOCALITY_NAME_ID, archetype.getCity() );
+        this.stateProvRegion = new SingleValuedField<String>( STATE_PROVINCE_ID, archetype.getStateProvRegion() );
+        this.zipPostalCode = new SingleValuedField<String>( ZIP_POSTAL_CODE_ID, archetype.getZipPostalCode() );
+        this.country = new SingleValuedField<String>( COUNTRY_ID, archetype.getCountry() );
+        this.company = new SingleValuedField<String>( ORGANIZATION_ID, archetype.getCompany() );
+        this.disabled = new SingleValuedField<String>( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
     }
 
 
-    public HauskeysUserModifier( HauskeysUserDao dao, String id, String firstName, String lastName, 
+    public HauskeysUserModifier( HauskeysUserDao dao, String id, String firstName, String lastName,
         String password )
     {
         this.id = id;
         this.dao = dao;
         this.archetype = null;
-        this.firstName = new SingleValuedField( GIVENNAME_ID, firstName );
-        this.lastName = new SingleValuedField( SURNAME_ID, lastName );
-        this.disabled = new SingleValuedField( KRB5_DISABLED_ID, "FALSE" );
-
-        this.password = new SingleValuedField( PASSWORD_ID, password );
-        this.description = new SingleValuedField( DESCRIPTION_ID, null );
-        this.mobile = new SingleValuedField( MOBILE_ID, null );
-        this.email = new SingleValuedField( EMAIL_ID, null );
-        this.notifyBy = new SingleValuedField( NOTIFY_BY_ID, null );
-        this.mobileCarrier = new SingleValuedField( MOBILE_CARRIER_ID, null );
-        this.tokenPin = new SingleValuedField( TOKEN_PIN_ID, null );
-        this.midletName = new SingleValuedField( MIDLE_NAME_ID, null );
-        this.failuresInEpoch = new SingleValuedField( FAILURES_IN_EPOCH_ID, null );
-        this.activationKey = new SingleValuedField( ACTIVATION_KEY_ID, null );
-        this.realm = new SingleValuedField( REALM_ID, null );
-        this.secret = new SingleValuedField( SECRET_ID, null );
-        this.label = new SingleValuedField( LABEL_ID, null );
-        this.movingFactor = new SingleValuedField( MOVING_FACTOR_ID, null );
-        this.address1 = new SingleValuedField( STREET_ID, null );
-        this.address2 = new SingleValuedField( POSTAL_ADDRESS_ID, null );
-        this.city = new SingleValuedField( LOCALITY_NAME_ID, null );
-        this.stateProvRegion = new SingleValuedField( STATE_PROVINCE_ID, null );
-        this.zipPostalCode = new SingleValuedField( ZIP_POSTAL_CODE_ID, null );
-        this.country = new SingleValuedField( COUNTRY_ID, null );
-        this.company = new SingleValuedField( ORGANIZATION_ID, null );
+        this.firstName = new SingleValuedField<String>( GIVENNAME_ID, firstName );
+        this.lastName = new SingleValuedField<String>( SURNAME_ID, lastName );
+        this.disabled = new SingleValuedField<String>( KRB5_DISABLED_ID, "FALSE" );
+
+        this.password = new SingleValuedField<String>( PASSWORD_ID, password );
+        this.description = new SingleValuedField<String>( DESCRIPTION_ID, null );
+        this.mobile = new SingleValuedField<String>( MOBILE_ID, null );
+        this.email = new SingleValuedField<String>( EMAIL_ID, null );
+        this.notifyBy = new SingleValuedField<String>( NOTIFY_BY_ID, null );
+        this.mobileCarrier = new SingleValuedField<String>( MOBILE_CARRIER_ID, null );
+        this.tokenPin = new SingleValuedField<String>( TOKEN_PIN_ID, null );
+        this.midletName = new SingleValuedField<String>( MIDLE_NAME_ID, null );
+        this.failuresInEpoch = new SingleValuedField<String>( FAILURES_IN_EPOCH_ID, null );
+        this.activationKey = new SingleValuedField<String>( ACTIVATION_KEY_ID, null );
+        this.realm = new SingleValuedField<String>( REALM_ID, null );
+        this.secret = new SingleValuedField<String>( SECRET_ID, null );
+        this.label = new SingleValuedField<String>( LABEL_ID, null );
+        this.movingFactor = new SingleValuedField<String>( MOVING_FACTOR_ID, null );
+        this.address1 = new SingleValuedField<String>( STREET_ID, null );
+        this.address2 = new SingleValuedField<String>( POSTAL_ADDRESS_ID, null );
+        this.city = new SingleValuedField<String>( LOCALITY_NAME_ID, null );
+        this.stateProvRegion = new SingleValuedField<String>( STATE_PROVINCE_ID, null );
+        this.zipPostalCode = new SingleValuedField<String>( ZIP_POSTAL_CODE_ID, null );
+        this.country = new SingleValuedField<String>( COUNTRY_ID, null );
+        this.company = new SingleValuedField<String>( ORGANIZATION_ID, null );
     }
 
 
@@ -140,7 +141,7 @@
     // Mutators
     // -----------------------------------------------------------------------
 
-    
+
     public HauskeysUserModifier setAddress1( String address1 )
     {
         if ( persisted )
@@ -150,8 +151,8 @@
         this.address1.setValue( address1 );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setAddress2( String address2 )
     {
         if ( persisted )
@@ -161,8 +162,8 @@
         this.address2.setValue( address2 );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setCity( String city )
     {
         if ( persisted )
@@ -172,8 +173,8 @@
         this.city.setValue( city );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setStateProvRegion( String stateProvRegion )
     {
         if ( persisted )
@@ -183,8 +184,8 @@
         this.stateProvRegion.setValue( stateProvRegion );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setZipPostalCode( String zipPostalCode )
     {
         if ( persisted )
@@ -194,8 +195,8 @@
         this.zipPostalCode.setValue( zipPostalCode );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setCountry( String country )
     {
         if ( persisted )
@@ -205,8 +206,8 @@
         this.country.setValue( country );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setCompany( String company )
     {
         if ( persisted )
@@ -216,8 +217,8 @@
         this.company.setValue( company );
         return this;
     }
-    
-    
+
+
     public HauskeysUserModifier setDisabled( boolean disabled )
     {
         if ( persisted )
@@ -228,7 +229,7 @@
         return this;
     }
 
-    
+
     public HauskeysUserModifier setFirstName( String firstName )
     {
         if ( persisted )
@@ -238,8 +239,8 @@
         this.firstName.setValue( firstName );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setLastName( String lastName )
     {
         if ( persisted )
@@ -249,8 +250,8 @@
         this.lastName.setValue( lastName );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setPassword( String password )
     {
         if ( persisted )
@@ -260,8 +261,8 @@
         this.password.setValue( password );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setDescription( String description )
     {
         if ( persisted )
@@ -271,8 +272,8 @@
         this.description.setValue( description );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setMobile( String mobile )
     {
         if ( persisted )
@@ -282,8 +283,8 @@
         this.mobile.setValue( mobile );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setEmail( String email )
     {
         if ( persisted )
@@ -293,8 +294,8 @@
         this.email.setValue( email );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setNotifyBy( String notifyBy )
     {
         if ( persisted )
@@ -304,8 +305,8 @@
         this.notifyBy.setValue( notifyBy );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setMobileCarrier( String mobileCarrier )
     {
         if ( persisted )
@@ -315,8 +316,8 @@
         this.mobileCarrier.setValue( mobileCarrier );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setTokenPin( String tokenPin )
     {
         if ( persisted )
@@ -326,8 +327,8 @@
         this.tokenPin.setValue( tokenPin );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setMidletName( String midletName )
     {
         if ( persisted )
@@ -337,8 +338,8 @@
         this.midletName.setValue( midletName );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setFailuresInEpoch( String failuresInEpoch )
     {
         if ( persisted )
@@ -348,8 +349,8 @@
         this.failuresInEpoch.setValue( failuresInEpoch );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setActivationKey( String activationKey )
     {
         if ( persisted )
@@ -359,8 +360,8 @@
         this.activationKey.setValue( activationKey );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setRealm( String realm )
     {
         if ( persisted )
@@ -370,8 +371,8 @@
         this.realm.setValue( realm );
         return this;
     }
-    
-   
+
+
     public HauskeysUserModifier setSecret( String secret )
     {
         if ( persisted )
@@ -382,7 +383,7 @@
         return this;
     }
 
-    
+
     public HauskeysUserModifier setLabel( String label )
     {
         if ( persisted )
@@ -393,7 +394,7 @@
         return this;
     }
 
-    
+
     public HauskeysUserModifier setMovingFactor( String movingFactor )
     {
         if ( persisted )
@@ -404,12 +405,12 @@
         return this;
     }
 
-    
+
     // -----------------------------------------------------------------------
     // Modifier Check Methods
     // -----------------------------------------------------------------------
 
-    
+
     public boolean isNewEntry()
     {
         return archetype == null;
@@ -420,21 +421,21 @@
     {
         return archetype != null;
     }
-    
-    
+
+
     public boolean isValid()
     {
         return ! persisted;
     }
-    
-    
+
+
     public boolean isUpdateNeeded()
     {
-        return 
+        return
             disabled.isUpdateNeeded() ||
-            description.isUpdateNeeded() || 
-            firstName.isUpdateNeeded() || 
-            lastName.isUpdateNeeded() || 
+            description.isUpdateNeeded() ||
+            firstName.isUpdateNeeded() ||
+            lastName.isUpdateNeeded() ||
             password.isUpdateNeeded() ||
             mobile.isUpdateNeeded() ||
             email.isUpdateNeeded() ||
@@ -462,7 +463,7 @@
     // Modifier Methods
     // -----------------------------------------------------------------------
 
-    
+
     public HauskeysUser add() throws DataAccessException
     {
         if ( persisted )
@@ -470,19 +471,19 @@
             throw new IllegalStateException( INVALID_MSG );
         }
         HauskeysUser user = dao.add( id, description.getCurrentValue(), firstName.getCurrentValue(),
-            lastName.getCurrentValue(), password.getCurrentValue(), mobile.getCurrentValue(), 
-            email.getCurrentValue(), notifyBy.getCurrentValue(), mobileCarrier.getCurrentValue(), 
+            lastName.getCurrentValue(), password.getCurrentValue(), mobile.getCurrentValue(),
+            email.getCurrentValue(), notifyBy.getCurrentValue(), mobileCarrier.getCurrentValue(),
             tokenPin.getCurrentValue(), midletName.getCurrentValue(), failuresInEpoch.getCurrentValue(),
-            activationKey.getCurrentValue(), realm.getCurrentValue(), secret.getCurrentValue(), 
-            label.getCurrentValue(), movingFactor.getCurrentValue(), address1.getCurrentValue(), 
-            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(), 
-            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(), 
+            activationKey.getCurrentValue(), realm.getCurrentValue(), secret.getCurrentValue(),
+            label.getCurrentValue(), movingFactor.getCurrentValue(), address1.getCurrentValue(),
+            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(),
+            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(),
             parseBoolean( disabled.getCurrentValue().toLowerCase() ) );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public HauskeysUser rename( String newName ) throws DataAccessException
     {
         if ( persisted )
@@ -495,34 +496,34 @@
             throw new ModificationLossException( id + " has been modified. " +
                     "A rename operation will result in the loss of these modifications." );
         }
-        
+
         HauskeysUser user = dao.rename( newName, archetype );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public HauskeysUser modify() throws DataAccessException
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        HauskeysUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id, 
-            description.getCurrentValue(), firstName.getCurrentValue(), lastName.getCurrentValue(), 
-            password.getCurrentValue(), mobile.getCurrentValue(), email.getCurrentValue(), 
-            notifyBy.getCurrentValue(), mobileCarrier.getCurrentValue(), tokenPin.getCurrentValue(), 
-            midletName.getCurrentValue(), failuresInEpoch.getCurrentValue(), activationKey.getCurrentValue(), 
-            realm.getCurrentValue(), secret.getCurrentValue(), label.getCurrentValue(), 
-            movingFactor.getCurrentValue(), address1.getCurrentValue(), 
-            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(), 
-            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(), 
+        HauskeysUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id,
+            description.getCurrentValue(), firstName.getCurrentValue(), lastName.getCurrentValue(),
+            password.getCurrentValue(), mobile.getCurrentValue(), email.getCurrentValue(),
+            notifyBy.getCurrentValue(), mobileCarrier.getCurrentValue(), tokenPin.getCurrentValue(),
+            midletName.getCurrentValue(), failuresInEpoch.getCurrentValue(), activationKey.getCurrentValue(),
+            realm.getCurrentValue(), secret.getCurrentValue(), label.getCurrentValue(),
+            movingFactor.getCurrentValue(), address1.getCurrentValue(),
+            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(),
+            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(),
             parseBoolean( disabled.getCurrentValue().toLowerCase() ), getModificationItems() );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public void delete() throws DataAccessException
     {
         if ( persisted )
@@ -533,7 +534,7 @@
         persisted = true;
     }
 
-    
+
     private ModificationItem[] getModificationItems()
     {
         // new entries do not generate modification items
@@ -641,28 +642,28 @@
             {
                 mods.add( disabled.getModificationItem() );
             }
-            
+
             // if first or last name has changed modify the common name
             if ( firstName.isUpdateNeeded() || lastName.isUpdateNeeded() )
             {
-                mods.add( new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute( "cn", 
+                mods.add( new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute( "cn",
                     firstName.getCurrentValue() + " " + lastName.getCurrentValue() ) ) );
             }
-            
+
             ModificationItem[] modArray = new ModificationItem[mods.size()];
             return ( ModificationItem[] ) mods.toArray( modArray );
         }
         return EMPTY_MODS;
     }
 
-    
+
     private static boolean parseBoolean( String bool )
     {
         if ( bool.equals( "true" ) )
         {
             return true;
         }
-        
+
         return false;
     }
 }

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/LocalUserModifier.java Tue Jan 16 00:24:45 2007
@@ -26,6 +26,7 @@
 import javax.naming.directory.ModificationItem;
 
 import org.safehaus.triplesec.admin.dao.LocalUserDao;
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
 
 
 public class LocalUserModifier implements Constants
@@ -33,46 +34,46 @@
     private final String id;
     private final LocalUser archetype;
     private final LocalUserDao dao;
-    private final SingleValuedField disabled;
-    private final SingleValuedField firstName;
-    private final SingleValuedField lastName;
-    private final SingleValuedField password;
-    private final SingleValuedField description;
-
-    private final SingleValuedField address1;
-    private final SingleValuedField address2;
-    private final SingleValuedField city;
-    private final SingleValuedField stateProvRegion;
-    private final SingleValuedField zipPostalCode;
-    private final SingleValuedField country;
-    private final SingleValuedField company;
-    private final SingleValuedField email;
+    private final SingleValuedField<String> disabled;
+    private final SingleValuedField<String> firstName;
+    private final SingleValuedField<String> lastName;
+    private final SingleValuedField<String> password;
+    private final SingleValuedField<String> description;
+
+    private final SingleValuedField<String> address1;
+    private final SingleValuedField<String> address2;
+    private final SingleValuedField<String> city;
+    private final SingleValuedField<String> stateProvRegion;
+    private final SingleValuedField<String> zipPostalCode;
+    private final SingleValuedField<String> country;
+    private final SingleValuedField<String> company;
+    private final SingleValuedField<String> email;
 
     private boolean persisted = false;
-    
+
     // -----------------------------------------------------------------------
     // Constructors
     // -----------------------------------------------------------------------
 
-    
+
     public LocalUserModifier( LocalUserDao dao, LocalUser archetype )
     {
         this.id = archetype.getId();
         this.dao = dao;
         this.archetype = archetype;
-        this.firstName = new SingleValuedField( GIVENNAME_ID, archetype.getFirstName() );
-        this.lastName = new SingleValuedField( SURNAME_ID, archetype.getLastName() );
-        this.password = new SingleValuedField( PASSWORD_ID, archetype.getPassword() );
-        this.description = new SingleValuedField( DESCRIPTION_ID, archetype.getDescription() );
-        this.disabled = new SingleValuedField( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
-        this.address1 = new SingleValuedField( STREET_ID, archetype.getAddress1() );
-        this.address2 = new SingleValuedField( POSTAL_ADDRESS_ID, archetype.getAddress2() );
-        this.city = new SingleValuedField( LOCALITY_NAME_ID, archetype.getCity() );
-        this.stateProvRegion = new SingleValuedField( STATE_PROVINCE_ID, archetype.getStateProvRegion() );
-        this.zipPostalCode = new SingleValuedField( ZIP_POSTAL_CODE_ID, archetype.getZipPostalCode() );
-        this.country = new SingleValuedField( COUNTRY_ID, archetype.getCountry() );
-        this.company = new SingleValuedField( ORGANIZATION_ID, archetype.getCompany() );
-        this.email = new SingleValuedField( EMAIL_ID, archetype.getEmail() );
+        this.firstName = new SingleValuedField<String>( GIVENNAME_ID, archetype.getFirstName() );
+        this.lastName = new SingleValuedField<String>( SURNAME_ID, archetype.getLastName() );
+        this.password = new SingleValuedField<String>( PASSWORD_ID, archetype.getPassword() );
+        this.description = new SingleValuedField<String>( DESCRIPTION_ID, archetype.getDescription() );
+        this.disabled = new SingleValuedField<String>( KRB5_DISABLED_ID, String.valueOf( archetype.isDisabled() ).toUpperCase() );
+        this.address1 = new SingleValuedField<String>( STREET_ID, archetype.getAddress1() );
+        this.address2 = new SingleValuedField<String>( POSTAL_ADDRESS_ID, archetype.getAddress2() );
+        this.city = new SingleValuedField<String>( LOCALITY_NAME_ID, archetype.getCity() );
+        this.stateProvRegion = new SingleValuedField<String>( STATE_PROVINCE_ID, archetype.getStateProvRegion() );
+        this.zipPostalCode = new SingleValuedField<String>( ZIP_POSTAL_CODE_ID, archetype.getZipPostalCode() );
+        this.country = new SingleValuedField<String>( COUNTRY_ID, archetype.getCountry() );
+        this.company = new SingleValuedField<String>( ORGANIZATION_ID, archetype.getCompany() );
+        this.email = new SingleValuedField<String>( EMAIL_ID, archetype.getEmail() );
     }
 
 
@@ -101,7 +102,7 @@
     // Mutators
     // -----------------------------------------------------------------------
 
-    
+
     public LocalUserModifier setEmail( String email )
     {
         if ( persisted )
@@ -111,8 +112,8 @@
         this.email.setValue( email );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setAddress1( String address1 )
     {
         if ( persisted )
@@ -122,8 +123,8 @@
         this.address1.setValue( address1 );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setAddress2( String address2 )
     {
         if ( persisted )
@@ -133,8 +134,8 @@
         this.address2.setValue( address2 );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setCity( String city )
     {
         if ( persisted )
@@ -144,8 +145,8 @@
         this.city.setValue( city );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setStateProvRegion( String stateProvRegion )
     {
         if ( persisted )
@@ -155,8 +156,8 @@
         this.stateProvRegion.setValue( stateProvRegion );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setZipPostalCode( String zipPostalCode )
     {
         if ( persisted )
@@ -166,8 +167,8 @@
         this.zipPostalCode.setValue( zipPostalCode );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setCountry( String country )
     {
         if ( persisted )
@@ -177,8 +178,8 @@
         this.country.setValue( country );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setCompany( String company )
     {
         if ( persisted )
@@ -188,8 +189,8 @@
         this.company.setValue( company );
         return this;
     }
-    
-    
+
+
     public LocalUserModifier setDisabled( boolean disabled )
     {
         if ( persisted )
@@ -200,7 +201,7 @@
         return this;
     }
 
-    
+
     public LocalUserModifier setFirstName( String firstName )
     {
         if ( persisted )
@@ -210,8 +211,8 @@
         this.firstName.setValue( firstName );
         return this;
     }
-    
-   
+
+
     public LocalUserModifier setLastName( String lastName )
     {
         if ( persisted )
@@ -221,8 +222,8 @@
         this.lastName.setValue( lastName );
         return this;
     }
-    
-   
+
+
     public LocalUserModifier setPassword( String password )
     {
         if ( persisted )
@@ -232,8 +233,8 @@
         this.password.setValue( password );
         return this;
     }
-    
-   
+
+
     public LocalUserModifier setDescription( String description )
     {
         if ( persisted )
@@ -243,13 +244,13 @@
         this.description.setValue( description );
         return this;
     }
-    
-   
+
+
     // -----------------------------------------------------------------------
     // Modifier Check Methods
     // -----------------------------------------------------------------------
 
-    
+
     public boolean isNewEntry()
     {
         return archetype == null;
@@ -260,21 +261,21 @@
     {
         return archetype != null;
     }
-    
-    
+
+
     public boolean isValid()
     {
         return ! persisted;
     }
-    
-    
+
+
     public boolean isUpdateNeeded()
     {
-        return 
-            description.isUpdateNeeded() || 
-            firstName.isUpdateNeeded() || 
-            lastName.isUpdateNeeded() || 
-            password.isUpdateNeeded() || 
+        return
+            description.isUpdateNeeded() ||
+            firstName.isUpdateNeeded() ||
+            lastName.isUpdateNeeded() ||
+            password.isUpdateNeeded() ||
             disabled.isUpdateNeeded() ||
             address1.isUpdateNeeded() ||
             address2.isUpdateNeeded() ||
@@ -284,7 +285,7 @@
             country.isUpdateNeeded() ||
             company.isUpdateNeeded() ||
             email.isUpdateNeeded();
-            
+
     }
 
 
@@ -292,23 +293,23 @@
     // Modifier Methods
     // -----------------------------------------------------------------------
 
-    
+
     public LocalUser add() throws DataAccessException
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        LocalUser user = dao.add( id, description.getCurrentValue(), firstName.getCurrentValue(), 
-            lastName.getCurrentValue(), password.getCurrentValue(), address1.getCurrentValue(), 
-            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(), 
-            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(), 
+        LocalUser user = dao.add( id, description.getCurrentValue(), firstName.getCurrentValue(),
+            lastName.getCurrentValue(), password.getCurrentValue(), address1.getCurrentValue(),
+            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(),
+            zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(),
             email.getCurrentValue(), parseBoolean( disabled.getCurrentValue().toLowerCase() ) );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public LocalUser rename( String newName ) throws DataAccessException
     {
         if ( persisted )
@@ -321,31 +322,31 @@
             throw new ModificationLossException( id + " has been modified. " +
                     "A rename operation will result in the loss of these modifications." );
         }
-        
+
         LocalUser user = dao.rename( newName, archetype );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public LocalUser modify() throws DataAccessException
     {
         if ( persisted )
         {
             throw new IllegalStateException( INVALID_MSG );
         }
-        LocalUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id, 
-            description.getCurrentValue(), password.getCurrentValue(), firstName.getCurrentValue(),  
-            lastName.getCurrentValue(), address1.getCurrentValue(), 
-            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(), 
+        LocalUser user = dao.modify( archetype.getCreatorsName(), archetype.getCreateTimestamp(), id,
+            description.getCurrentValue(), password.getCurrentValue(), firstName.getCurrentValue(),
+            lastName.getCurrentValue(), address1.getCurrentValue(),
+            address2.getCurrentValue(), city.getCurrentValue(), stateProvRegion.getCurrentValue(),
             zipPostalCode.getCurrentValue(), country.getCurrentValue(), company.getCurrentValue(),
-            email.getCurrentValue(), parseBoolean( disabled.getCurrentValue().toLowerCase() ), 
+            email.getCurrentValue(), parseBoolean( disabled.getCurrentValue().toLowerCase() ),
             getModificationItems() );
         persisted = true;
         return user;
     }
-    
-    
+
+
     public void delete() throws DataAccessException
     {
         if ( persisted )
@@ -356,7 +357,7 @@
         persisted = true;
     }
 
-    
+
     private ModificationItem[] getModificationItems()
     {
         // new entries do not generate modification items
@@ -420,21 +421,21 @@
             {
                 mods.add( email.getModificationItem() );
             }
-            
+
             ModificationItem[] modArray = new ModificationItem[mods.size()];
             return ( ModificationItem[] ) mods.toArray( modArray );
         }
         return EMPTY_MODS;
     }
 
-    
+
     private static boolean parseBoolean( String bool )
     {
         if ( bool.equals( "true" ) )
         {
             return true;
         }
-        
+
         return false;
     }
 }

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Permission.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Permission.java?view=diff&rev=496618&r1=496616&r2=496618
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Permission.java (original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/Permission.java Tue Jan 16 00:24:45 2007
@@ -20,62 +20,133 @@
 package org.safehaus.triplesec.admin;
 
 
-import java.util.Date;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.BasicAttribute;
+
+import org.safehaus.triplesec.admin.persistence.SingleValuedField;
+import org.safehaus.triplesec.admin.persistence.StateManager;
+import org.safehaus.triplesec.admin.persistence.SimpleRdn;
+import org.safehaus.triplesec.admin.persistence.State;
+import org.safehaus.triplesec.admin.persistence.PersistenceCapable;
 
-import org.safehaus.triplesec.admin.dao.PermissionDao;
 
-
-public class Permission extends AdministeredEntity
+public class Permission implements PersistenceCapable
 {
-    private final String description;
-    private final String name;
-    private final String applicationRdn;
-    private final PermissionDao dao;
-
-    
-    public Permission( String creatorsName, Date createTimestamp, PermissionDao dao, String applicationName, String name, String description )
-    {
-        this( creatorsName, createTimestamp, null, null, dao, applicationName, name, description );
-    }
-    
-    
-    public Permission( String creatorsName, Date createTimestamp, String modifiersName, 
-        Date modifyTimestamp, PermissionDao dao, String applicationName, String name, String description )
-    {
-        super( creatorsName, createTimestamp, modifiersName, modifyTimestamp );
-        this.dao = dao;
-        this.applicationRdn = applicationName;
-        this.name = name;
-        this.description = description;
+
+    public static final String[] attrs = new String[] {Constants.PERM_NAME_ID,
+            Constants.DESCRIPTION_ID,
+            Constants.PERM_JAVA_CLASS_ID,
+            Constants.PERM_JAVA_NAME_ID,
+            Constants.PERM_JAVA_ACTIONS_ID};
+
+    private static final int PERMISSIONID_INDEX = 0;
+    private static final int DESCRIPTION_INDEX = 1;
+    private static final int JAVACLASS_INDEX = 2;
+    private static final int JAVANAME_INDEX = 3;
+    private static final int JAVAACTIONS_INDEX = 4;
+
+    private final StateManager stateManager;
+
+    public Permission()
+    {
+        stateManager = new StateManager( this );
+        stateManager.setRdn( new SimpleRdn( Constants.PERM_NAME_ID, null, "ou=permissions" ) );
+        stateManager.addField( new SingleValuedField<String>( Constants.DESCRIPTION_ID, null ) );
+        stateManager.addField( new SingleValuedField<String>( Constants.PERM_JAVA_CLASS_ID, null ) );
+        stateManager.addField( new SingleValuedField<String>( Constants.PERM_JAVA_NAME_ID, null ) );
+        stateManager.addField( new SingleValuedField<String>( Constants.PERM_JAVA_ACTIONS_ID, null ) );
+        stateManager.setState( State.EMPTY );
     }
-        
-    
-    public String getDescription()
+
+    public Permission( String permissionId, String description, String javaClass, String javaName, String javaActions )
     {
-        return description;
+        this();
+        setPermissionId( permissionId );
+        setDescription( description );
+        setJavaClass( javaClass );
+        setJavaName( javaName );
+        setJavaActions( javaActions );
     }
 
+    public void setApplication( Application application )
+    {
+        stateManager.setParent( application.getStateManager() );
+    }
 
-    public String getName()
+    public String getPermissionId()
     {
-        return name;
+        return stateManager.getId( );
     }
 
-    
+    public void setPermissionId( String permissionId )
+    {
+        stateManager.setId( permissionId );
+    }
+
+
+    public String getDescription()
+    {
+        return stateManager.getStringValue( DESCRIPTION_INDEX );
+    }
+
+    public void setDescription( String description )
+    {
+        stateManager.setStringValue( DESCRIPTION_INDEX, description );
+    }
+
+
     public String getApplicationRdn()
     {
-        return applicationRdn;
+        return null;
     }
-    
-    
-    public PermissionModifier modifier()
+
+    public String getJavaClass()
     {
-        return new PermissionModifier( dao, this );
+        return stateManager.getStringValue( JAVACLASS_INDEX );
     }
-    
-    
-    public String toString()
+
+    public void setJavaClass( String javaClass )
+    {
+        stateManager.setStringValue( JAVACLASS_INDEX, javaClass );
+    }
+
+    public String getJavaName()
+    {
+        return stateManager.getStringValue( JAVANAME_INDEX );
+    }
+
+    public void setJavaName( String javaName )
+    {
+        stateManager.setStringValue( JAVANAME_INDEX, javaName );
+    }
+
+    public String getJavaActions()
+    {
+        return stateManager.getStringValue( JAVAACTIONS_INDEX );
+    }
+
+    public void setJavaActions( String javaActions )
+    {
+        stateManager.setStringValue( JAVAACTIONS_INDEX, javaActions );
+    }
+
+    public StateManager getStateManager()
+    {
+        return stateManager;
+    }
+
+    public Attributes getAttributes()
+    {
+        BasicAttributes attrs = new BasicAttributes();
+        BasicAttribute oc = new BasicAttribute( Constants.OBJECT_CLASS_ID );
+        oc.add( Constants.POLICY_PERMISSION_OC );
+        oc.add( Constants.POLICY_JAVA_PERMISSION_OC );
+        attrs.put( oc );
+        return attrs;
+    }
+
+    public void parentSet( StateManager parentSm )
     {
-        return name;
     }
 }



Mime
View raw message