directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r564425 [3/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
Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java Thu Aug  9 16:40:15 2007
@@ -28,23 +28,32 @@
 import javax.naming.directory.SchemaViolationException;
 import javax.naming.directory.SearchControls;
 
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.FilterParserImpl;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+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.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+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.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.FilterParserImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 
 /**
  * An ApacheDS {@link Interceptor} that prevents users from deleting
- * (or renaming) policy entries (permissions and roles) used by roles and profiles.  
+ * (or renaming) policy entries (permissions and roles) used by roles and profiles.
+ *
+ * IN other words, programmatic referential integrity
  *
  * @author Trustin Lee
  * @version $Rev: 956 $, $Date: 2006-09-21 10:10:21 -0400 (Thu, 21 Sep 2006) $
@@ -67,11 +76,12 @@
     }
 
     
-    public void add( NextInterceptor next, LdapDN name, Attributes attrs ) throws NamingException
+    public void add( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         boolean policyEntry = false;
         boolean isApplication = false;
 
+        Attributes attrs = ((AddOperationContext)opContext).getEntry();
         Attribute attr = getObjectClass( attrs );
         NamingEnumeration ocList = attr.getAll();
         try
@@ -81,17 +91,17 @@
                 String value = String.valueOf( ocList.next() );
                 if( "policyPermission".equalsIgnoreCase( value ) )
                 {
-                    checkNewPolicyEntry( next, name, "2.5.4.11=permissions" );
+                    checkNewPolicyEntry( next, opContext.getDn(), "2.5.4.11=permissions" );
                     policyEntry = true;
                 }
                 else if( "policyRole".equalsIgnoreCase( value ) )
                 {
-                    checkNewPolicyEntry( next, name, "2.5.4.11=roles" );
+                    checkNewPolicyEntry( next, opContext.getDn(), "2.5.4.11=roles" );
                     policyEntry = true;
                 }
                 else if( "policyProfile".equalsIgnoreCase( value ) )
                 {
-                    checkNewPolicyEntry( next, name, "2.5.4.11=profiles" );
+                    checkNewPolicyEntry( next, opContext.getDn(), "2.5.4.11=profiles" );
                     policyEntry = true;
                 }
                 else if( "policyApplication".equalsIgnoreCase( value ) )
@@ -107,12 +117,12 @@
 
         if( !policyEntry )
         {
-            checkNewNonPolicyEntry( next, name );
+            checkNewNonPolicyEntry( next, opContext );
         }
         else
         {
             // Check if all grants, denials, and roles are valid.
-            LdapDN baseName = ( LdapDN ) name.clone();
+            LdapDN baseName = ( LdapDN ) opContext.getDn().clone();
             baseName.remove( baseName.size() -1 );
             baseName.remove( baseName.size() -1 );
             NamingEnumeration attrList = attrs.getAll();
@@ -130,88 +140,89 @@
             }
         }
 
-        next.add( name, attrs );
+        next.add( opContext);
 
         if( isApplication )
         {
-            aciManager.appAdded( name );
+            aciManager.appAdded( opContext );
         }
     }
 
     
-    public void delete( NextInterceptor next, LdapDN name ) throws NamingException
+    public void delete( NextInterceptor next, OperationContext operationContext ) throws NamingException
     {
-        boolean isApplication = isPolicyApplication( name );
+        boolean isApplication = isPolicyApplication( operationContext.getDn() );
 
-        LdapDN baseName = getBaseName( next, name );
+        LdapDN baseName = getBaseName( next, operationContext );
         if( baseName == null )
         {
-            next.delete( name );
+            next.delete( operationContext );
 
             if ( isApplication )
             {
-                aciManager.appRemoved( name );
+                aciManager.appRemoved( operationContext );
             }
             return;
         }
 
-        checkNotInUse( next, baseName, name );
-        next.delete( name );
+        checkNotInUse( next, baseName, operationContext.getDn() );
+        next.delete( operationContext );
         if ( isApplication )
         {
-            aciManager.appRemoved( name );
+            aciManager.appRemoved( operationContext );
         }
     }
 
     
-    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes attrs ) throws NamingException
-    {
-        LdapDN baseName = getBaseName( next, name );
-        if( baseName == null )
-        {
-            next.modify( name, modOp, attrs );
-            return;
-        }
-
-        NamingEnumeration e = attrs.getAll();
-        try
-        {
-            while( e.hasMore() )
-            {
-                Attribute attr = ( Attribute ) e.next();
-                if( attr != null )
-                {
-                    switch( modOp )
-                    {
-                    case DirContext.ADD_ATTRIBUTE:
-                    case DirContext.REPLACE_ATTRIBUTE:
-                        checkAttributeAddition( next, baseName, attr );
-                        break;
-                    case DirContext.REMOVE_ATTRIBUTE:
-                        checkAttributeRemoval( attr );
-                        break;
-                    }
-                }
-            }
-        }
-        finally
-        {
-            e.close();
-        }
-
-        next.modify( name, modOp, attrs );
-    }
+//    public void modify( NextInterceptor next, OperationContext name ) throws NamingException
+//    {
+//        LdapDN baseName = getBaseName( next, name );
+//        if( baseName == null )
+//        {
+//            next.modify( name, modOp, attrs );
+//            return;
+//        }
+//
+//        NamingEnumeration e = attrs.getAll();
+//        try
+//        {
+//            while( e.hasMore() )
+//            {
+//                Attribute attr = ( Attribute ) e.next();
+//                if( attr != null )
+//                {
+//                    switch( modOp )
+//                    {
+//                    case DirContext.ADD_ATTRIBUTE:
+//                    case DirContext.REPLACE_ATTRIBUTE:
+//                        checkAttributeAddition( next, baseName, attr );
+//                        break;
+//                    case DirContext.REMOVE_ATTRIBUTE:
+//                        checkAttributeRemoval( attr );
+//                        break;
+//                    }
+//                }
+//            }
+//        }
+//        finally
+//        {
+//            e.close();
+//        }
+//
+//        next.modify( name, modOp, attrs );
+//    }
 
     
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] modItems ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-        LdapDN baseName = getBaseName( next, name );
+        LdapDN baseName = getBaseName( next, opContext );
         if( baseName == null )
         {
-            next.modify( name, modItems );
+            next.modify( opContext );
             return;
         }
 
+        ModificationItem[] modItems = ((ModifyOperationContext)opContext).getModItems();
         for( int i = modItems.length - 1; i >= 0; i-- )
         {
             Attribute attr = modItems[ i ].getAttribute();
@@ -226,172 +237,127 @@
             }
         }
 
-        next.modify( name, modItems );
+        next.modify( opContext );
     }
 
     
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRN, boolean deleteOldRN ) throws NamingException
+    public void rename( NextInterceptor next, OperationContext operationContext ) throws NamingException
     {
-        PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
-        Attributes entry = proxy.lookup( name, ApplicationAciManager.LOOKUP_BYPASS );
-        Attribute oc = entry.get( "objectClass" );
-        boolean isApplication = false;
-
-        for ( int ii = 0; ii < oc.size(); ii++ )
-        {
-            String item = ( String ) oc.get( ii );
-            if ( item.equalsIgnoreCase( "policyApplication" ) )
-            {
-                isApplication = true;
-            }
-        }
-
-        // calculate the new name
-        LdapDN newNameUpDn = ( LdapDN ) name.clone();
-        newNameUpDn.remove( name.size() - 1 );
-        newNameUpDn.add( newRN );
-        LdapDN rdn = new LdapDN( newRN );
-        LdapDN newDn = ( LdapDN ) name.clone();
-        newDn.remove( name.size() - 1 );
-        newDn.add( rdn.get( 0 ) );
-
-        LdapDN baseName = getBaseName( next, name );
-        if( baseName == null )
-        {
-            if ( isApplication )
-            {
-                // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-                aciManager.removeApplicationSubentry( proxy, name );
-            }
-            next.modifyRn( name, newRN, deleteOldRN );
-            if ( isApplication )
-            {
-                aciManager.addApplicationSubentry( proxy, newDn );
-            }
-
-            return;
-        }
-
-        checkModification( next, baseName, name );
+        RenameOperationContext opContext = (RenameOperationContext) operationContext;
+        boolean isApplication = isPolicyApplication(operationContext.getDn());
+        LdapDN name = opContext.getDn();
 
-        if ( isApplication )
-        {
-            // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-            aciManager.removeApplicationSubentry( proxy, name );
-        }
-        next.modifyRn( name, newRN, deleteOldRN );
-        if ( isApplication )
-        {
-            aciManager.addApplicationSubentry( proxy, newDn );
-        }
-    }
 
-    public void move( NextInterceptor next, LdapDN name, LdapDN newParentName, String newRN, boolean deleteOldRN ) throws NamingException
-    {
         PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
-        Attributes entry = proxy.lookup( name, ApplicationAciManager.LOOKUP_BYPASS );
-        Attribute oc = entry.get( "objectClass" );
-        boolean isApplication = false;
+        LdapDN baseName = getBaseName( next, opContext );
 
-        for ( int ii = 0; ii < oc.size(); ii++ )
-        {
-            String item = ( String ) oc.get( ii );
-            if ( item.equalsIgnoreCase( "policyApplication" ) )
-            {
-                isApplication = true;
-            }
-        }
-
-        // calculate the new name
-        LdapDN newNameUpDn = ( LdapDN ) newParentName.clone();
-        newNameUpDn.add( newRN );
-        LdapDN rdn = new LdapDN( newRN );
-        LdapDN newDn = ( LdapDN ) newParentName.clone();
-        newDn.add( rdn.get( 0 ) );
+        checkModification( next, baseName, opContext.getDn() );
 
-        LdapDN baseName = getBaseName( next, name );
-        if( baseName == null )
-        {
-            if ( isApplication )
-            {
-                // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-                aciManager.removeApplicationSubentry( proxy, name );
-            }
-            next.move( name, newParentName, newRN, deleteOldRN );
-            if ( isApplication )
-            {
-                aciManager.addApplicationSubentry( proxy, newDn );
-            }
-            return;
-        }
-
-        checkModification( next, baseName, name );
         if ( isApplication )
         {
             // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-            aciManager.removeApplicationSubentry( proxy, name );
+            aciManager.removeApplicationSubentry( proxy, opContext );
         }
-        next.move( name, newParentName, newRN, deleteOldRN );
+        next.rename( opContext );
         if ( isApplication )
         {
-            aciManager.addApplicationSubentry( proxy, newDn );
+            // calculate the new name
+            LdapDN newNameUpDn = ( LdapDN ) name.clone();
+            newNameUpDn.remove( name.size() - 1 );
+            newNameUpDn.add( opContext.getNewRdn() );
+            LdapDN rdn = new LdapDN( opContext.getNewRdn() );
+            LdapDN newDn = ( LdapDN ) name.clone();
+            newDn.remove( name.size() - 1 );
+            newDn.add( rdn.get( 0 ) );
+            RenameOperationContext newOpContext = new RenameOperationContext(name, rdn.get(0), opContext.getDelOldDn());
+            aciManager.addApplicationSubentry( proxy, newOpContext );
         }
     }
 
-    public void move( NextInterceptor next, LdapDN name, LdapDN newParentName ) throws NamingException
+    public void move( NextInterceptor next, OperationContext operationContext ) throws NamingException
     {
-        PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
-        Attributes entry = proxy.lookup( name, ApplicationAciManager.LOOKUP_BYPASS );
-        Attribute oc = entry.get( "objectClass" );
-        boolean isApplication = false;
-
-        for ( int ii = 0; ii < oc.size(); ii++ )
-        {
-            String item = ( String ) oc.get( ii );
-            if ( item.equalsIgnoreCase( "policyApplication" ) )
-            {
-                isApplication = true;
-            }
-        }
+        boolean isApplication = isPolicyApplication(operationContext.getDn());
+        MoveOperationContext opContext = (MoveOperationContext) operationContext;
 
         // calculate the new name
-        LdapDN newDn = ( LdapDN ) newParentName.clone();
-        newDn.add( name.get( name.size() - 1 ) );
+//        LdapDN newNameUpDn = ( LdapDN ) opContext.getParent().clone();
+//        newNameUpDn.add( opContext.getDn().get(0) ); //?????
+//        LdapDN rdn = new LdapDN( newRN );
+        LdapDN newDn = ( LdapDN ) opContext.getParent().clone();
+        newDn.add( opContext.getDn().get( 0 ) );
+        MoveOperationContext newOpContext = new MoveOperationContext(newDn, opContext.getParent());//really?
 
-        LdapDN baseName = getBaseName( next, name );
-        if( baseName == null )
-        {
-            if ( isApplication )
-            {
-                // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-                aciManager.removeApplicationSubentry( proxy, name );
-            }
-            next.move( name, newParentName );
-            if ( isApplication )
-            {
-                aciManager.addApplicationSubentry( proxy, newDn );
-            }
-            return;
-        }
+        PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
+        LdapDN baseName = getBaseName( next, opContext );
 
-        checkModification( next, baseName, name );
+        checkModification( next, baseName, opContext.getDn() );
         if ( isApplication )
         {
             // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
-            aciManager.removeApplicationSubentry( proxy, name );
+            aciManager.removeApplicationSubentry( proxy, opContext );
         }
-        next.move( name, newParentName );
+        next.move( opContext );
         if ( isApplication )
         {
-            aciManager.addApplicationSubentry( proxy, newDn );
+            aciManager.addApplicationSubentry( proxy, newOpContext );
         }
     }
 
-    private LdapDN getBaseName( NextInterceptor next, LdapDN name ) throws NamingException
+//    public void move( NextInterceptor next, OperationContext name ) throws NamingException
+//    {
+//        PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
+//        Attributes entry = proxy.lookup( name, ApplicationAciManager.LOOKUP_BYPASS );
+//        Attribute oc = entry.get( "objectClass" );
+//        boolean isApplication = false;
+//
+//        for ( int ii = 0; ii < oc.size(); ii++ )
+//        {
+//            String item = ( String ) oc.get( ii );
+//            if ( item.equalsIgnoreCase( "policyApplication" ) )
+//            {
+//                isApplication = true;
+//            }
+//        }
+//
+//        // calculate the new name
+//        LdapDN newDn = ( LdapDN ) newParentName.clone();
+//        newDn.add( name.get( name.size() - 1 ) );
+//
+//        LdapDN baseName = getBaseName( next, name );
+//        if( baseName == null )
+//        {
+//            if ( isApplication )
+//            {
+//                // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
+//                aciManager.removeApplicationSubentry( proxy, name );
+//            }
+//            next.move( name, newParentName );
+//            if ( isApplication )
+//            {
+//                aciManager.addApplicationSubentry( proxy, newDn );
+//            }
+//            return;
+//        }
+//
+//        checkModification( next, baseName, name );
+//        if ( isApplication )
+//        {
+//            // we don't need to mess around with deleting and adding the admin group (don't want to loose info either)
+//            aciManager.removeApplicationSubentry( proxy, name );
+//        }
+//        next.move( name, newParentName );
+//        if ( isApplication )
+//        {
+//            aciManager.addApplicationSubentry( proxy, newDn );
+//        }
+//    }
+
+    private LdapDN getBaseName( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
+        LdapDN name = opContext.getDn();
         if( name.size() >= 3 )
         {
-            Attributes attrs = next.lookup( name );
+            Attributes attrs = next.lookup( opContext );
             Attribute attr = getObjectClass( attrs );
             NamingEnumeration e = attr.getAll();
             try
@@ -428,7 +394,7 @@
             {
                 name = ( LdapDN ) name.clone();
                 name.remove( name.size() - 1 );
-                Attributes attrs = next.lookup( name );
+                Attributes attrs = next.lookup( opContext );
                 Attribute attr = getObjectClass( attrs );
                 NamingEnumeration e = attr.getAll();
                 try
@@ -494,7 +460,8 @@
     private boolean isPolicyApplication( LdapDN dn ) throws NamingException
     {
         PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
-        Attributes entry = proxy.lookup( dn, OBJECT_CLASS_ATTRS, PartitionNexusProxy.LOOKUP_BYPASS );
+        OperationContext opContext = new LookupOperationContext(dn, OBJECT_CLASS_ATTRS);
+        Attributes entry = proxy.lookup( opContext, PartitionNexusProxy.LOOKUP_BYPASS );
         Attribute oc = getObjectClass( entry );
 
         NamingEnumeration list = oc.getAll();
@@ -502,7 +469,7 @@
         {
             while( list.hasMore() )
             {
-                if( "policyApplication".equalsIgnoreCase( String.valueOf( list.next() ) ) )
+                if( "policyApplication".equalsIgnoreCase( ( String ) list.next() ) )
                 {
                     return true;
                 }
@@ -516,8 +483,9 @@
     }
 
     
-    private void checkNewNonPolicyEntry( NextInterceptor next, LdapDN name ) throws NamingException
+    private void checkNewNonPolicyEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
+        LdapDN name = opContext.getDn();
         if( name.size() < 3 )
         {
             return;
@@ -538,7 +506,7 @@
         {
             try
             {
-                Attributes entry = next.lookup( name );
+                Attributes entry = next.lookup( opContext );
                 Attribute attr = getObjectClass( entry );
                 NamingEnumeration e = attr.getAll();
                 try
@@ -573,10 +541,10 @@
     }
     
 
-    private void checkAttributeAddition( NextInterceptor next, LdapDN baseName, Attribute attr ) 
+    private void checkAttributeAddition( NextInterceptor next, LdapDN baseName, Attribute attr )
         throws NamingException, SchemaViolationException
     {
-        
+
         // If the attribute is a permission
         if( "grants".equalsIgnoreCase( attr.getID() ) ||
             "denials".equalsIgnoreCase( attr.getID() ) )
@@ -593,7 +561,8 @@
                     name.add( "2.5.4.11=permissions" );
                     // permName=
                     name.add( "1.2.6.1.4.1.22555.1.1.1.3.201=" + value );
-                    if( !next.hasEntry( name ) ) {
+
+                    if( !next.hasEntry( new EntryOperationContext( name ) ) ) {
                         throw new SchemaViolationException( "No such permission: " + value );
                     }
                 }
@@ -618,7 +587,7 @@
                     
                     // roleName=
                     name.add( "1.2.6.1.4.1.22555.1.1.1.3.204=" + value );
-                    if( !next.hasEntry( name ) ) {
+                    if( !next.hasEntry( new EntryOperationContext( name ) ) ) {
                         throw new SchemaViolationException( "No such role: " + value );
                     }
                 }
@@ -661,7 +630,7 @@
     private static final String PERMNAME_ATTR_OID = "1.2.6.1.4.1.22555.1.1.1.3.201";
     private static final String ROLENAME_ATTR_OID = "1.2.6.1.4.1.22555.1.1.1.3.204";
     
-    private void checkNotInUse( NextInterceptor next, LdapDN baseName, LdapDN name ) 
+    private void checkNotInUse( NextInterceptor next, LdapDN baseName, LdapDN name )
         throws NamingException, SchemaViolationException
     {
         String nameType = NamespaceTools.getRdnAttribute( name.get( name.size() - 1 ) );
@@ -709,8 +678,8 @@
         if( filter != null )
         {
             // execute search
-            NamingEnumeration e = next.search( baseName, factoryConfiguration.getEnvironment(),
-                    filter, ctrl );
+            NamingEnumeration e = next.search( new SearchOperationContext( baseName, factoryConfiguration.getEnvironment(),
+                    filter, ctrl ) );
 
             // throw an exception if search returned more than 0 usage.
             try
@@ -735,7 +704,10 @@
         {
             throw new SchemaViolationException( "Entity groups are not allowed to move: " + name );
         }
-        checkNotInUse( next, baseName, name );
+        if (baseName != null)
+        {
+            checkNotInUse( next, baseName, name );
+        }
     }
 
 

Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/ServerProfileStoreITest.java Thu Aug  9 16:40:15 2007
@@ -38,8 +38,8 @@
 import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
 import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
-import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
+//import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
 import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
@@ -89,7 +89,9 @@
         MutableStartupConfiguration config = new MutableStartupConfiguration();
         config.setWorkingDirectory( workingDirectory );
         MutablePartitionConfiguration partConfig = new MutablePartitionConfiguration();
-        partConfig.setName( "example" );
+//        partConfig.setName( "example" );
+        //????
+        partConfig.setId( "example" );
 
         HashSet indices = new HashSet();
         indices.add( "dc" );
@@ -150,9 +152,9 @@
         store = new DefaultServerProfileStore( userContext );
         store.init();
 
-        List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
-        LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters, getClass().getClassLoader() );
-        ldifLoader.execute();
+//        List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
+//        LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters, getClass().getClassLoader() );
+//        ldifLoader.execute();
 
         assertNotNull( store );
     }

Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/ApplicationACIManagerITest.java Thu Aug  9 16:40:15 2007
@@ -79,14 +79,16 @@
         super.configuration.setShutdownHookEnabled( false );
         
         MutablePartitionConfiguration partitionCfg = new MutablePartitionConfiguration();
-        partitionCfg.setName( "example" );
+//        partitionCfg.setName( "example" );
+        //????
+        partitionCfg.setId( "example" );
         partitionCfg.setSuffix( "dc=example,dc=com" );
         Attributes ctxEntry = new AttributesImpl();
         ctxEntry.put( "objectClass", "top" );
         ctxEntry.put( "dc", "example" );
         ctxEntry.put( "administrativeRole", "accessControlSpecificArea" );
         partitionCfg.setContextEntry( ctxEntry );
-        partitionCfg.setContextPartition( new JdbmPartition() );
+//        partitionCfg.setContextPartition( new JdbmPartition() );
 
         Set partitions = super.configuration.getPartitionConfigurations();
         partitions.add( partitionCfg );
@@ -95,7 +97,7 @@
         List interceptors = super.configuration.getInterceptorConfigurations();
         MutableInterceptorConfiguration interceptorCfg = new MutableInterceptorConfiguration();
         interceptorCfg.setName( "protector" );
-        interceptorCfg.setInterceptor( new PolicyProtectionInterceptor() );
+        interceptorCfg.setInterceptorClassName( PolicyProtectionInterceptor.class.getName() );
         interceptors.add( interceptorCfg );
         super.configuration.setInterceptorConfigurations( interceptors );
         super.configuration.setAccessControlEnabled( true );

Modified: directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java Thu Aug  9 16:40:15 2007
@@ -20,10 +20,10 @@
 package org.safehaus.triplesec.store.interceptor;
 
 
+import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Set;
-import java.util.HashSet;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -37,19 +37,17 @@
 import javax.naming.directory.SchemaViolationException;
 
 import junit.framework.Assert;
-
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
 import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
+import org.apache.directory.server.core.unit.AbstractAdminTestCase;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.Krb5kdcSchema;
+import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
+import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.safehaus.triplesec.store.ProfileObjectFactory;
 import org.safehaus.triplesec.store.ProfileStateFactory;
 import org.safehaus.triplesec.store.schema.SafehausSchema;
@@ -81,13 +79,14 @@
         super.configuration.setAccessControlEnabled( true );
         
         MutablePartitionConfiguration partitionCfg = new MutablePartitionConfiguration();
-        partitionCfg.setName( "example" );
+        //?? was setName
+        partitionCfg.setId( "example" );
         partitionCfg.setSuffix( "dc=example,dc=com" );
         Attributes ctxEntry = new BasicAttributes();
         ctxEntry.put( "objectClass", "top" );
         ctxEntry.put( "dc", "example" );
         partitionCfg.setContextEntry( ctxEntry );
-        partitionCfg.setContextPartition( new JdbmPartition() );
+//        partitionCfg.setContextPartition( new JdbmPartition() );
 
         Set partitions = super.configuration.getPartitionConfigurations();
         partitions.add( partitionCfg );
@@ -96,7 +95,7 @@
         List interceptors = super.configuration.getInterceptorConfigurations();
         MutableInterceptorConfiguration interceptorCfg = new MutableInterceptorConfiguration();
         interceptorCfg.setName( "protector" );
-        interceptorCfg.setInterceptor( new PolicyProtectionInterceptor() );
+        interceptorCfg.setInterceptorClassName( PolicyProtectionInterceptor.class.getName() );
         interceptors.add( interceptorCfg );
         super.configuration.setInterceptorConfigurations( interceptors );
 

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ConnectionManager.java Thu Aug  9 16:40:15 2007
@@ -36,8 +36,6 @@
 import javax.security.auth.login.LoginException;
 
 import org.safehaus.triplesec.admin.TriplesecAdmin;
-import org.safehaus.triplesec.admin.dao.DaoFactory;
-import org.safehaus.triplesec.admin.dao.ldap.LdapDaoFactory;
 import org.safehaus.triplesec.configuration.TriplesecStartupConfiguration;
 import org.safehaus.triplesec.guardian.ApplicationPolicy;
 import org.safehaus.triplesec.guardian.Profile;
@@ -46,7 +44,6 @@
 import org.safehaus.triplesec.jaas.RealmCallback;
 import org.safehaus.triplesec.jaas.SafehausLoginModule;
 import org.safehaus.triplesec.jaas.SafehausPrincipal;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -115,7 +112,7 @@
         // -------------------------------------------------------------------
 
         Properties env = new Properties();
-        env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+//        env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
         StringBuffer buf = new StringBuffer();
         
@@ -181,10 +178,11 @@
         Properties props = new Properties();
         props.putAll( env );
         props.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
-        props.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+//        props.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
         StringBuffer buf = new StringBuffer();
-        buf.append( "ldap://localhost:" ).append( config.getLdapPort() );
-        buf.append( "/" ).append( props.getProperty( Context.PROVIDER_URL ) );
+        //TODO reenable
+//        buf.append( "ldap://localhost:" ).append( config.getLdapPort() );
+//        buf.append( "/" ).append( props.getProperty( Context.PROVIDER_URL ) );
         props.put( Context.PROVIDER_URL, buf.toString() );
         props.remove( "java.naming.factory.object" );
         props.remove( "java.naming.factory.state" );

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ExternalLinkPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ExternalLinkPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ExternalLinkPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ExternalLinkPanel.java Thu Aug  9 16:40:15 2007
@@ -34,7 +34,6 @@
 import javax.swing.JTextField;
 
 import org.safehaus.triplesec.admin.ExternalUser;
-import org.safehaus.triplesec.admin.ExternalUserModifier;
 
 
 public class ExternalLinkPanel extends JPanel implements StatusObject, KeyListener, FocusListener
@@ -169,7 +168,7 @@
     }
 
 
-    public void alterModifier( ExternalUserModifier modifier )
+    public void alterModifier( ExternalUser modifier )
     {
         modifier.setReferral( linkUrlTextField.getText() );
     }

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupPanel.java Thu Aug  9 16:40:15 2007
@@ -20,28 +20,27 @@
 package org.safehaus.triplesec.admin.swing;
 
 
-import javax.swing.JPanel;
 import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
 
+import javax.naming.NamingException;
 import javax.swing.ImageIcon;
+import javax.swing.JButton;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
+import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.JTree;
-
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
-
-import javax.swing.JTextField;
 import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTree;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
 
-import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Group;
-import org.safehaus.triplesec.admin.GroupModifier;
+import org.safehaus.triplesec.admin.User;
+import org.safehaus.triplesec.admin.persistence.PCException;
 
 
 public class GroupPanel extends JPanel
@@ -397,7 +396,7 @@
     
     private void setGroupFields()
     {
-        generalPanel.setFields( group );
+//        generalPanel.setFields( group );
         groupNameTextField.setText( group.getName() );
         // group does not have a description field and perhaps it should even
         // if we need to use extensibleObject
@@ -462,47 +461,37 @@
         //            node.setUserObject( group );
         //        }
 
-        GroupModifier modifier = group.modifier();
         for ( int ii = 0; ii < groupUsersPanel.getUsersInGroupModel().size(); ii++ )
         {
-            modifier.addMember( ( String ) groupUsersPanel.getUsersInGroupModel().getElementAt( ii ) );
+            group.addMember( getUserByName(( String ) groupUsersPanel.getUsersInGroupModel().getElementAt( ii )) );
         }
         for ( int ii = 0; ii < groupUsersPanel.getAvailableUsersModel().size(); ii++ )
         {
-            modifier.removeMember( ( String ) groupUsersPanel.getAvailableUsersModel().getElementAt( ii ) );
+            group.removeMember( getUserByName(( String ) groupUsersPanel.getAvailableUsersModel().getElementAt( ii ) ));
         }
-        if ( modifier.isUpdateNeeded() )
+        group.setName( groupNameTextField.getText() );
+        try
         {
-            try
-            {
-                group = modifier.modify();
-            }
-            catch ( DataAccessException e )
-            {
-                JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify group members:\n" 
-                    + e.getMessage(), 79 ), "Group save failure!", JOptionPane.ERROR_MESSAGE );
-                return;
-            }
-        }
-        
-        if ( !group.getName().equals( groupNameTextField.getText() ) )
+            group.getStateManager().commit();
+        } catch ( NamingException e )
         {
-            try
-            {
-                group = group.modifier().rename( groupNameTextField.getText() );
-            }
-            catch ( DataAccessException e )
-            {
-                JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to rename group:\n" + e.getMessage(), 79 ),
-                    "Group rename failure!", JOptionPane.ERROR_MESSAGE );
+
+                JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify group members:\n"
+                    + e.getMessage(), 79 ), "Group save failure!", JOptionPane.ERROR_MESSAGE );
                 return;
-            }
         }
 
         node.setUserObject( group );
         setGroupFields();
-        ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), group );
+        tree.getModel().valueForPathChanged( new TreePath( node.getPath() ), group );
     }
+
+    private User getUserByName( String userName )
+    {
+        //TODO implement this
+        return null;
+    }
+
     /**
      * This method initializes jTextField	
      * 	
@@ -551,14 +540,14 @@
                 {
                     try
                     {
-                        group.modifier().delete();
+                        group.getStateManager().getEntityManager().remove( group);
                         DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) node.getParent();
                         DefaultTreeModel treeModel = ( DefaultTreeModel ) tree.getModel();
                         treeModel.removeNodeFromParent( node );
                         TreePath path = new TreePath( parentNode.getPath() );
                         tree.setSelectionPaths( new TreePath[] { path } );
                     }
-                    catch ( DataAccessException e1 )
+                    catch ( PCException e1 )
                     {
                         JOptionPane.showMessageDialog( GroupPanel.this, 
                             "Failed to delete group: " + e1.getMessage(), "Delete Failed", 

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupUsersPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupUsersPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupUsersPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/GroupUsersPanel.java Thu Aug  9 16:40:15 2007
@@ -26,6 +26,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.DefaultListModel;
 import javax.swing.ImageIcon;
@@ -65,14 +66,14 @@
     }
 
     
-    public void populateLists( DefaultMutableTreeNode rootNode, Set users )
+    public void populateLists( DefaultMutableTreeNode rootNode, Collection<User> users )
     {
         clear();
-        for ( Iterator ii = users.iterator(); ii.hasNext(); /**/)
+        for ( User user1 : users )
         {
-            usersInGroupListModel.add( 0, ii.next() );
+            usersInGroupListModel.add( 0, user1 );
         }
-        
+
         if ( rootNode == null )
         {
             return;

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/HotpSettingsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/HotpSettingsPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/HotpSettingsPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/HotpSettingsPanel.java Thu Aug  9 16:40:15 2007
@@ -33,7 +33,6 @@
 import javax.swing.JTextField;
 
 import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
 
 
 public class HotpSettingsPanel extends JPanel implements StatusObject, KeyListener, FocusListener
@@ -65,15 +64,15 @@
     }
     
     
-    public void alterModifier( Object unkownModifier )
+    public void alterUser( Object object )
     {
-        if ( unkownModifier instanceof HauskeysUserModifier )
+        if ( object instanceof HauskeysUser )
         {
-            HauskeysUserModifier modifier = ( HauskeysUserModifier ) unkownModifier;
-            modifier.setSecret( new String( secretPasswordField.getPassword() ) );
-            modifier.setMovingFactor( movingFactorTextField.getText() );
-            modifier.setActivationKey( activationKeyTextField.getText() );
-            modifier.setFailuresInEpoch( failuresInEpochTextField.getText() );
+            HauskeysUser user = ( HauskeysUser ) object;
+            user.setSecret( new String( secretPasswordField.getPassword() ) );
+            user.setMovingFactor( movingFactorTextField.getText() );
+            user.setActivationKey( activationKeyTextField.getText() );
+            user.setFailuresInEpoch( failuresInEpochTextField.getText() );
         }
     }
     

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java Thu Aug  9 16:40:15 2007
@@ -50,6 +50,7 @@
 import org.safehaus.triplesec.admin.Profile;
 import org.safehaus.triplesec.admin.Role;
 import org.safehaus.triplesec.admin.TriplesecAdmin;
+
 import javax.swing.JPasswordField;
 import javax.naming.NamingException;
 
@@ -111,7 +112,6 @@
 
     /**
      * This method initializes this
-     * 
      */
     private void initialize()
     {
@@ -125,15 +125,15 @@
         this.setLayout( new GridBagLayout() );
         this.setSize( 550, 417 );
         this.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "New Application",
-            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
-            null, null ) );
+                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
+                null, null ) );
         this.add( getMainPanel(), gridBagConstraints );
     }
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getMainPanel()
@@ -150,8 +150,8 @@
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getButtonPanel()
@@ -168,8 +168,8 @@
 
 
     /**
-     * This method initializes jButton	
-     * 	
+     * This method initializes jButton
+     *
      * @return javax.swing.JButton
      */
     private JButton getCopyButton()
@@ -180,7 +180,7 @@
             copyButton.setText( "Copy" );
             copyButton.addActionListener( new java.awt.event.ActionListener()
             {
-                public void actionPerformed(java.awt.event.ActionEvent e)
+                public void actionPerformed( java.awt.event.ActionEvent e )
                 {
                     try
                     {
@@ -190,7 +190,7 @@
                     {
                         String msg = UiUtils.wrap( "Failed to copy application: " + e1.getMessage(), 79 );
                         JOptionPane.showMessageDialog( NewApplicationPanel.this, msg,
-                            "Failed to copy application!", JOptionPane.ERROR_MESSAGE );
+                                "Failed to copy application!", JOptionPane.ERROR_MESSAGE );
                     }
                 }
 
@@ -205,7 +205,7 @@
         String msg = UiUtils.wrap( "This copy operation will persist immediately replicating the entire " +
                 "application subtree.  Would you still like to continue?", 79 );
         int response = JOptionPane.showOptionDialog( this, msg, "Continue?", JOptionPane.YES_NO_OPTION,
-            JOptionPane.QUESTION_MESSAGE, null, null, null );
+                JOptionPane.QUESTION_MESSAGE, null, null, null );
         if ( response == JOptionPane.NO_OPTION )
         {
             return;
@@ -274,8 +274,8 @@
                     copiedPermission.getDescription(),
                     copiedPermission.getJavaClass(),
                     copiedPermission.getJavaName(),
-                    copiedPermission.getJavaActions());
-            newApplication.addPermission( newPermission);
+                    copiedPermission.getJavaActions() );
+            newApplication.addPermission( newPermission );
             model.insertNodeInto( new DefaultMutableTreeNode( newPermission ), newPermsNode, 0 );
         }
 
@@ -305,15 +305,15 @@
         {
             DefaultMutableTreeNode copiedRoleNode = ( DefaultMutableTreeNode ) ii.nextElement();
             Role copiedRole = ( Role ) copiedRoleNode.getUserObject();
-            Role newRole = new Role(copiedRole.getRoleName(), copiedRole.getDescription());
-            newApplication.addRole( newRole);
-            for (Permission grant: copiedRole.getGrants())
+            Role newRole = new Role( copiedRole.getRoleName(), copiedRole.getDescription() );
+            newApplication.addRole( newRole );
+            for ( Permission grant : copiedRole.getGrants() )
             {
-                newRole.addGrant( grant);
+                newRole.addGrant( grant );
             }
-            for (Permission denial: copiedRole.getDenials())
+            for ( Permission denial : copiedRole.getDenials() )
             {
-                newRole.addDenial( denial);
+                newRole.addDenial( denial );
             }
             model.insertNodeInto( new DefaultMutableTreeNode( newRole ), newRolesNode, 0 );
         }
@@ -344,14 +344,16 @@
         {
             DefaultMutableTreeNode copiedProfileNode = ( DefaultMutableTreeNode ) ii.nextElement();
             Profile copiedProfile = ( Profile ) copiedProfileNode.getUserObject();
-            Profile newProfile = new Profile(copiedProfile.getProfileId(),
-                    copiedProfile.getDescription(),
-                    new HashSet<Permission>(copiedProfile.getGrants()),
-                    new HashSet<Permission>(copiedProfile.getDenials()),
-                    new HashSet<Role>(copiedProfile.getRoles()),
-                    copiedProfile.isDisabled(),
-                    copiedProfile.getUser());
-            newApplication.addProfile( newProfile);
+            Profile newProfile = new Profile();
+            newProfile.setProfileId( copiedProfile.getProfileId() );
+            newProfile.setDescription( copiedProfile.getDescription() );
+            //TODO does this work?
+            newProfile.getGrants().addAll( new HashSet<Permission>( copiedProfile.getGrants() ) );
+            newProfile.getDenials().addAll( new HashSet<Permission>( copiedProfile.getDenials() ) );
+            newProfile.getRoles().addAll( new HashSet<Role>( copiedProfile.getRoles() ) );
+            newProfile.setDisabled( copiedProfile.isDisabled() );
+            newProfile.setUser( copiedProfile.getUser() );
+            newApplication.addProfile( newProfile );
             model.insertNodeInto( new DefaultMutableTreeNode( newProfile ), newProfilesNode, 0 );
         }
 
@@ -361,8 +363,8 @@
 
 
     /**
-     * This method initializes jButton	
-     * 	
+     * This method initializes jButton
+     *
      * @return javax.swing.JButton
      */
     private JButton getCreateButton()
@@ -384,8 +386,8 @@
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getAboveButtonPanel()
@@ -403,8 +405,8 @@
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getNorthPanel()
@@ -430,8 +432,8 @@
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getSouthPanel()
@@ -441,8 +443,8 @@
             southPanel = new JPanel();
             southPanel.setLayout( new BorderLayout() );
             southPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Description",
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
             southPanel.add( getDescriptionTextArea(), java.awt.BorderLayout.NORTH );
         }
         return southPanel;
@@ -451,7 +453,7 @@
 
     /**
      * This method initializes iconLabel
-     * 	
+     *
      * @return javax.swing.JLabel
      */
     private JLabel getIconLabel()
@@ -460,7 +462,7 @@
         {
             iconLabel = new JLabel();
             iconLabel.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/new_application_48x48.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/new_application_48x48.png" ) ) );
             iconLabel.setPreferredSize( new java.awt.Dimension( 48, 48 ) );
             iconLabel.setText( "" );
             iconLabel.setVerticalTextPosition( javax.swing.SwingConstants.BOTTOM );
@@ -472,8 +474,8 @@
 
 
     /**
-     * This method initializes jPanel	
-     * 	
+     * This method initializes jPanel
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getJPanel()
@@ -482,17 +484,17 @@
         {
             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
             gridBagConstraints8.gridx = 1;
-            gridBagConstraints8.insets = new java.awt.Insets(0,0,0,0);
+            gridBagConstraints8.insets = new java.awt.Insets( 0, 0, 0, 0 );
             gridBagConstraints8.fill = java.awt.GridBagConstraints.BOTH;
             gridBagConstraints8.gridy = 2;
             GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
             gridBagConstraints7.gridx = 0;
             gridBagConstraints7.fill = java.awt.GridBagConstraints.HORIZONTAL;
-            gridBagConstraints7.insets = new java.awt.Insets(0,0,0,5);
+            gridBagConstraints7.insets = new java.awt.Insets( 0, 0, 0, 5 );
             gridBagConstraints7.gridy = 2;
             jLabel2 = new JLabel();
-            jLabel2.setText("Password:");
-            jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
+            jLabel2.setText( "Password:" );
+            jLabel2.setHorizontalAlignment( javax.swing.SwingConstants.RIGHT );
             GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
             gridBagConstraints6.fill = java.awt.GridBagConstraints.HORIZONTAL;
             gridBagConstraints6.insets = new java.awt.Insets( 0, 0, 5, 5 );
@@ -500,12 +502,12 @@
             gridBagConstraints5.fill = java.awt.GridBagConstraints.HORIZONTAL;
             gridBagConstraints5.gridy = 1;
             gridBagConstraints5.weightx = 1.0;
-            gridBagConstraints5.insets = new java.awt.Insets(0,0,5,0);
+            gridBagConstraints5.insets = new java.awt.Insets( 0, 0, 5, 0 );
             gridBagConstraints5.gridx = 1;
             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
             gridBagConstraints3.gridx = 0;
             gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
-            gridBagConstraints3.insets = new java.awt.Insets(0,0,5,5);
+            gridBagConstraints3.insets = new java.awt.Insets( 0, 0, 5, 5 );
             gridBagConstraints3.gridy = 1;
             jLabel1 = new JLabel();
             jLabel1.setText( "Application Name:" );
@@ -524,18 +526,18 @@
             jPanel.setPreferredSize( new java.awt.Dimension( 131, 88 ) );
             jPanel.add( jLabel, gridBagConstraints6 );
             jPanel.add( getStatusTextField(), gridBagConstraints2 );
-            jPanel.add(jLabel1, gridBagConstraints3);
-            jPanel.add(getApplicationNameTextField(), gridBagConstraints5);
-            jPanel.add(jLabel2, gridBagConstraints7);
-            jPanel.add(getJPanel1(), gridBagConstraints8);
+            jPanel.add( jLabel1, gridBagConstraints3 );
+            jPanel.add( getApplicationNameTextField(), gridBagConstraints5 );
+            jPanel.add( jLabel2, gridBagConstraints7 );
+            jPanel.add( getJPanel1(), gridBagConstraints8 );
         }
         return jPanel;
     }
 
 
     /**
-     * This method initializes jTextArea	
-     * 	
+     * This method initializes jTextArea
+     *
      * @return javax.swing.JTextArea
      */
     private JTextArea getDescriptionTextArea()
@@ -550,8 +552,8 @@
 
 
     /**
-     * This method initializes jPanel4	
-     * 	
+     * This method initializes jPanel4
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getIconPanel()
@@ -560,7 +562,7 @@
         {
             iconPanel = new JPanel();
             iconPanel
-                .setBorder( javax.swing.BorderFactory.createEtchedBorder( javax.swing.border.EtchedBorder.RAISED ) );
+                    .setBorder( javax.swing.BorderFactory.createEtchedBorder( javax.swing.border.EtchedBorder.RAISED ) );
             iconPanel.add( getIconLabel(), null );
         }
         return iconPanel;
@@ -604,26 +606,27 @@
         String passwordStr = new String( passwordChars );
         String confirmStr = new String( confirmChars );
 
-        if ( ! passwordStr.equals( confirmStr ) )
+        if ( !passwordStr.equals( confirmStr ) )
         {
             JOptionPane.showMessageDialog( this, "Passwords do not match." );
             return null;
         }
 
         DefaultMutableTreeNode appNode;
-        Application application = new Application(applicationNameTextField.getText(), descriptionTextArea.getText(), passwordStr);
-        triplesecAdmin.getEntityManager().persist( application, null);
+        Application application = new Application( applicationNameTextField.getText(), descriptionTextArea.getText(), passwordStr );
+        triplesecAdmin.getEntityManager().persist( application, null );
         try
         {
             application.getStateManager().commit();
         } catch ( NamingException e )
         {
             JOptionPane.showMessageDialog( this,
-                UiUtils.wrap( "Failed to create application:\n" + e.getMessage(), 79 ),
-                "Application creation failure!", JOptionPane.ERROR_MESSAGE );
+                    UiUtils.wrap( "Failed to create application:\n" + e.getMessage(), 79 ),
+                    "Application creation failure!", JOptionPane.ERROR_MESSAGE );
             return null;
         }
-        try {
+        try
+        {
             appNode = new DefaultMutableTreeNode( application );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( appNode, node, 0 );
@@ -634,8 +637,8 @@
         catch ( DataAccessException e )
         {
             JOptionPane.showMessageDialog( this,
-                UiUtils.wrap( "Failed to create application:\n" + e.getMessage(), 79 ),
-                "Application creation failure!", JOptionPane.ERROR_MESSAGE );
+                    UiUtils.wrap( "Failed to create application:\n" + e.getMessage(), 79 ),
+                    "Application creation failure!", JOptionPane.ERROR_MESSAGE );
             return null;
         }
         applicationNameTextField.setText( null );
@@ -645,8 +648,8 @@
 
 
     /**
-     * This method initializes jTabbedPane	
-     * 	
+     * This method initializes jTabbedPane
+     *
      * @return javax.swing.JTabbedPane
      */
     private JTabbedPane getCenterTabbedPane()
@@ -655,15 +658,15 @@
         {
             centerTabbedPane = new JTabbedPane();
             centerTabbedPane.addTab( "Existing", null, getExistingPanelTab(),
-                "Copy an application from any one of these existing applications." );
+                    "Copy an application from any one of these existing applications." );
         }
         return centerTabbedPane;
     }
 
 
     /**
-     * This method initializes jPanel3	
-     * 	
+     * This method initializes jPanel3
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getExistingPanelTab()
@@ -685,8 +688,8 @@
 
 
     /**
-     * This method initializes jScrollPane	
-     * 	
+     * This method initializes jScrollPane
+     *
      * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane()
@@ -701,8 +704,8 @@
 
 
     /**
-     * This method initializes jTable	
-     * 	
+     * This method initializes jTable
+     *
      * @return javax.swing.JTable
      */
     private JTable getExistingAppsTable()
@@ -732,8 +735,8 @@
 
 
     /**
-     * This method initializes defaultTableModel	
-     * 	
+     * This method initializes defaultTableModel
+     *
      * @return javax.swing.table.DefaultTableModel
      */
     private ExistingApplicationsTableModel getExistingAppsTableModel()
@@ -776,7 +779,7 @@
             DefaultMutableTreeNode child = ( DefaultMutableTreeNode ) node.getChildAt( rowIndex );
             switch ( columnIndex )
             {
-                case ( 0 ):
+                case( 0 ):
                     return child.getUserObject();
 //                case ( 1 ):
 //                    return ( ( Application ) child.getUserObject() ).getCreatorsName();
@@ -791,11 +794,11 @@
         {
             switch ( columnIndex )
             {
-                case ( 0 ):
+                case( 0 ):
                     return "Existing Application";
-                case ( 1 ):
+                case( 1 ):
                     return "Creator's Name";
-                case ( 2 ):
+                case( 2 ):
                     return "Create Timestamp";
                 default:
                     throw new IndexOutOfBoundsException();
@@ -805,8 +808,8 @@
 
 
     /**
-     * This method initializes jTextField	
-     * 	
+     * This method initializes jTextField
+     *
      * @return javax.swing.JTextField
      */
     private JTextField getStatusTextField()
@@ -821,8 +824,8 @@
 
 
     /**
-     * This method initializes jTextField1	
-     * 	
+     * This method initializes jTextField1
+     *
      * @return javax.swing.JTextField
      */
     private JTextField getApplicationNameTextField()
@@ -836,8 +839,8 @@
 
 
     /**
-     * This method initializes jPanel1	
-     * 	
+     * This method initializes jPanel1
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getJPanel1()
@@ -845,30 +848,30 @@
         if ( jPanel1 == null )
         {
             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
-            gridBagConstraints11.insets = new java.awt.Insets(0,5,0,5);
+            gridBagConstraints11.insets = new java.awt.Insets( 0, 5, 0, 5 );
             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
             gridBagConstraints10.fill = java.awt.GridBagConstraints.HORIZONTAL;
             gridBagConstraints10.weightx = 1.0;
             jLabel3 = new JLabel();
-            jLabel3.setText("Confirm");
+            jLabel3.setText( "Confirm" );
             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
             gridBagConstraints9.fill = java.awt.GridBagConstraints.HORIZONTAL;
             gridBagConstraints9.gridy = 0;
             gridBagConstraints9.weightx = 1.0;
             gridBagConstraints9.gridx = 0;
             jPanel1 = new JPanel();
-            jPanel1.setLayout(new GridBagLayout());
-            jPanel1.add(getApplicationPasswordField(), gridBagConstraints9);
-            jPanel1.add(jLabel3, gridBagConstraints11);
-            jPanel1.add(getConfirmPasswordField(), gridBagConstraints10);
+            jPanel1.setLayout( new GridBagLayout() );
+            jPanel1.add( getApplicationPasswordField(), gridBagConstraints9 );
+            jPanel1.add( jLabel3, gridBagConstraints11 );
+            jPanel1.add( getConfirmPasswordField(), gridBagConstraints10 );
         }
         return jPanel1;
     }
 
 
     /**
-     * This method initializes jPasswordField	
-     * 	
+     * This method initializes jPasswordField
+     *
      * @return javax.swing.JPasswordField
      */
     private JPasswordField getApplicationPasswordField()
@@ -882,8 +885,8 @@
 
 
     /**
-     * This method initializes jPasswordField1	
-     * 	
+     * This method initializes jPasswordField1
+     *
      * @return javax.swing.JPasswordField
      */
     private JPasswordField getConfirmPasswordField()

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewGroupPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewGroupPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewGroupPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewGroupPanel.java Thu Aug  9 16:40:15 2007
@@ -26,6 +26,7 @@
 import java.util.Collections;
 import java.util.Enumeration;
 
+import javax.naming.NamingException;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JLabel;
@@ -43,10 +44,9 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 
-import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Group;
-import org.safehaus.triplesec.admin.GroupModifier;
 import org.safehaus.triplesec.admin.TriplesecAdmin;
+import org.safehaus.triplesec.admin.User;
 
 
 public class NewGroupPanel extends JPanel
@@ -387,22 +387,22 @@
         {
             return;
         }
-        Group group;
-        GroupModifier modifier = triplesecAdmin.newGroup( groupNameTextField.getText(), "admin" );
+        Group group = new Group( );
+        group.setName( groupNameTextField.getText() );
         for ( Enumeration ii = groupUsersPanel.getUsersInGroupModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.addMember( ( String ) ii.nextElement() );
+            group.addMember( getUserByName(( String ) ii.nextElement()) );
         }
      //       .setDescription( descriptionTextArea.getText() );
         try
         {
-            group = modifier.add();
+            group.getStateManager().commit();
             DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode( group );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( groupNode, node, 0 );
             existingGroupsTableModel.fireTableDataChanged();
         }
-        catch ( DataAccessException e )
+        catch ( NamingException e )
         {
             JOptionPane.showMessageDialog( this,
                 UiUtils.wrap( "Failed to create group:\n" + e.getMessage(), 79 ),
@@ -413,6 +413,12 @@
         statusTextField.setText( null );
     }
 
+    private User getUserByName( String userName )
+    {
+        //TODO Implement this
+        return null;
+    }
+
 
     /**
      * This method initializes jTabbedPane	
@@ -551,10 +557,10 @@
             {
                 case ( 0 ):
                     return child.getUserObject();
-                case ( 1 ):
-                    return ( ( Group ) child.getUserObject() ).getCreatorsName();
-                case ( 2 ):
-                    return ( ( Group) child.getUserObject() ).getCreateTimestamp();
+//                case ( 1 ):
+//                    return ( ( Group ) child.getUserObject() ).getCreatorsName();
+//                case ( 2 ):
+//                    return ( ( Group) child.getUserObject() ).getCreateTimestamp();
             }
             return child.getUserObject();
         }

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java Thu Aug  9 16:40:15 2007
@@ -45,15 +45,12 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 
-import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.ExternalUser;
-import org.safehaus.triplesec.admin.ExternalUserModifier;
 import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
 import org.safehaus.triplesec.admin.LocalUser;
-import org.safehaus.triplesec.admin.LocalUserModifier;
 import org.safehaus.triplesec.admin.TriplesecAdmin;
 import org.safehaus.triplesec.admin.User;
+import org.safehaus.triplesec.admin.persistence.PCException;
 
 
 public class NewUserPanel extends JPanel implements StatusListener, StatusObject, KeyListener, FocusListener
@@ -72,7 +69,6 @@
     private JPanel existingPanelTab = null;
     private JScrollPane jScrollPane = null;
     private JTable existingUsersTable = null;
-    private TriplesecAdmin triplesecAdmin;
     private ExistingUsersTableModel existingUsersTableModel = null; //  @jve:decl-index=0:visual-constraint=""
     private ImageIcon newUserIcon = new ImageIcon( getClass().getResource(
         "/org/safehaus/triplesec/admin/swing/new_user_48x48.png" ) );
@@ -92,7 +88,6 @@
 
     public void setTriplesecAdmin( TriplesecAdmin triplesecAdmin )
     {
-        this.triplesecAdmin = triplesecAdmin;
     }
 
 
@@ -306,23 +301,18 @@
 
     public void createExternalUser()
     {
-        ExternalUser user;
-        ExternalUserModifier modifier = triplesecAdmin.newExternalUser( userNorthPanel.getId(),
-            externalLinkPanel.getReferral() ).setDescription( descriptionTextArea.getText() );
-        try
-        {
-            user = modifier.add();
+        ExternalUser user = new ExternalUser( );
+        user.setId(userNorthPanel.getId());
+            user.setReferral( externalLinkPanel.getReferral() );
+        user.setDescription( descriptionTextArea.getText() );
+        //TODO save user
             DefaultMutableTreeNode userNode = new DefaultMutableTreeNode( user );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( userNode, node, 0 );
             existingUsersTableModel.fireTableDataChanged();
-        }
-        catch ( DataAccessException e )
-        {
-            JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to create user:\n" + e.getMessage(), 79 ),
-                "User creation failure!", JOptionPane.ERROR_MESSAGE );
-            return;
-        }
+//            JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to create user:\n" + e.getMessage(), 79 ),
+//                "User creation failure!", JOptionPane.ERROR_MESSAGE );
+//            return;
     }
 
 
@@ -334,23 +324,25 @@
             return;
         }
         
-        LocalUser user;
-        LocalUserModifier modifier = triplesecAdmin.newLocalUser( userNorthPanel.getId(), userInfoPanel.getFirstName(), 
-                userInfoPanel.getLastName(), userInfoPanel.getPassword() );
-        modifier.setDescription( descriptionTextArea.getText() );
+        LocalUser user = new LocalUser();
+        user.setId( userNorthPanel.getId());
+        user.setFirstName( userInfoPanel.getFirstName());
+        user.setLastName(  userInfoPanel.getLastName());
+        user.setPassword( userInfoPanel.getPassword() );
+        user.setDescription( descriptionTextArea.getText() );
         try
         {
-            user = modifier.add();
+ //TODO persist me!
+//            user = modifier.add();
             DefaultMutableTreeNode userNode = new DefaultMutableTreeNode( user );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( userNode, node, 0 );
             existingUsersTableModel.fireTableDataChanged();
         }
-        catch ( DataAccessException e )
+        catch ( PCException e )
         {
             JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to create user:\n" + e.getMessage(), 79 ),
                 "User creation failure!", JOptionPane.ERROR_MESSAGE );
-            return;
         }
     }
 
@@ -363,36 +355,31 @@
             return;
         }
 
-        HauskeysUser user;
-        HauskeysUserModifier modifier = triplesecAdmin
-            .newHauskeysUser( userNorthPanel.getId(), userInfoPanel.getFirstName(), 
-                userInfoPanel.getLastName(), userInfoPanel.getPassword() )
-            .setDescription( descriptionTextArea.getText() ).setPassword( userInfoPanel.getPassword() )
-            .setActivationKey( hotpSettingsPanel.getActivationKey() )
-            .setSecret( hotpSettingsPanel.getSecret() )
-            .setMovingFactor( hotpSettingsPanel.getMovingFactor() )
-            .setFailuresInEpoch( hotpSettingsPanel.getFailuresInEpoch() )
-            .setEmail( provisioningPanel.getEmail() )
-            .setMidletName( provisioningPanel.getMidletName() )
-            .setMobile( provisioningPanel.getMobile() )
-            .setMobileCarrier( String.valueOf( provisioningPanel.getMobileCarrier() ) )
-            .setNotifyBy( provisioningPanel.getNotifyBy() )
-            .setRealm( userInfoPanel.getRealm() )
-            .setTokenPin( provisioningPanel.getTokenPin() );
-        try
-        {
-            user = modifier.add();
+        HauskeysUser user = new HauskeysUser();
+        user.setId(userNorthPanel.getId());
+        user.setFirstName( userInfoPanel.getFirstName());
+                user.setLastName( userInfoPanel.getLastName());
+        user.setPassword(  userInfoPanel.getPassword() );
+            user.setDescription( descriptionTextArea.getText() );
+            user.setActivationKey( hotpSettingsPanel.getActivationKey() );
+            user.setSecret( hotpSettingsPanel.getSecret() );
+            user.setMovingFactor( hotpSettingsPanel.getMovingFactor() );
+            user.setFailuresInEpoch( hotpSettingsPanel.getFailuresInEpoch() );
+            user.setEmail( provisioningPanel.getEmail() );
+            user.setMidletName( provisioningPanel.getMidletName() );
+            user.setMobile( provisioningPanel.getMobile() );
+            user.setMobileCarrier( String.valueOf( provisioningPanel.getMobileCarrier() ) );
+            user.setNotifyBy( provisioningPanel.getNotifyBy() );
+            user.setRealm( userInfoPanel.getRealm() );
+            user.setTokenPin( provisioningPanel.getTokenPin() );
+        //TODO save user
             DefaultMutableTreeNode userNode = new DefaultMutableTreeNode( user );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( userNode, node, 0 );
             existingUsersTableModel.fireTableDataChanged();
-        }
-        catch ( DataAccessException e )
-        {
-            JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to create user:\n" + e.getMessage(), 79 ),
-                "User creation failure!", JOptionPane.ERROR_MESSAGE );
-            return;
-        }
+//            JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to create user:\n" + e.getMessage(), 79 ),
+//                "User creation failure!", JOptionPane.ERROR_MESSAGE );
+//            return;
     }
 
 
@@ -568,31 +555,31 @@
                     if ( archetype instanceof ExternalUser )
                     {
                         externalLinkPanel.setFields( ( ExternalUser ) archetype );
-                        descriptionTextArea.setText( ( ( ExternalUser ) archetype ).getDescription() );
+                        descriptionTextArea.setText( archetype.getDescription() );
                         centerTabbedPane.removeAll();
                         centerTabbedPane.addTab( "Existing", null, existingPanelTab );
                         centerTabbedPane.addTab( "External Link", null, externalLinkPanel );
                     }
-                    else if ( archetype instanceof LocalUser )
-                    {
-                        userInfoPanel.setFields( ( LocalUser ) archetype, "Not implemented" );
-                        descriptionTextArea.setText( ( ( LocalUser ) archetype ).getDescription() );
-                        centerTabbedPane.removeAll();
-                        centerTabbedPane.addTab( "Existing", null, existingPanelTab );
-                        centerTabbedPane.addTab( "User Info", null, userInfoPanel );
-                    }
                     else if ( archetype instanceof HauskeysUser )
                     {
                         userInfoPanel.setFields( ( HauskeysUser ) archetype );
                         hotpSettingsPanel.setFields( ( HauskeysUser ) archetype );
                         provisioningPanel.setFields( ( HauskeysUser ) archetype );
-                        descriptionTextArea.setText( ( ( HauskeysUser ) archetype ).getDescription() );
+                        descriptionTextArea.setText( archetype.getDescription() );
                         centerTabbedPane.removeAll();
                         centerTabbedPane.addTab( "Existing", null, existingPanelTab );
                         centerTabbedPane.addTab( "User Info", null, userInfoPanel );
                         centerTabbedPane.addTab( "Provisioning", null, provisioningPanel );
                         centerTabbedPane.addTab( "HOTP Settings", null, hotpSettingsPanel );
                     }
+                    else if ( archetype instanceof LocalUser )
+                    {
+                        userInfoPanel.setFields( ( LocalUser ) archetype, "Not implemented" );
+                        descriptionTextArea.setText( archetype.getDescription() );
+                        centerTabbedPane.removeAll();
+                        centerTabbedPane.addTab( "Existing", null, existingPanelTab );
+                        centerTabbedPane.addTab( "User Info", null, userInfoPanel );
+                    }
 //                    userNorthPanel.setStatus( Color.RED, "Create operation needed!" );
                 }});
         }
@@ -647,10 +634,10 @@
             {
                 case ( 0 ):
                     return child.getUserObject();
-                case ( 1 ):
-                    return ( ( User ) child.getUserObject() ).getCreatorsName();
-                case ( 2 ):
-                    return ( ( User ) child.getUserObject() ).getCreateTimestamp();
+//                case ( 1 ):
+//                    return ( ( User ) child.getUserObject() ).getCreatorsName();
+//                case ( 2 ):
+//                    return ( ( User ) child.getUserObject() ).getCreateTimestamp();
             }
             return child.getUserObject();
         }

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java Thu Aug  9 16:40:15 2007
@@ -40,6 +40,7 @@
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 import javax.swing.ButtonGroup;
+import javax.swing.JButton;
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -48,19 +49,15 @@
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 
+import com.sun.mail.smtp.SMTPTransport;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
 import org.safehaus.triplesec.configuration.MutableTriplesecStartupConfiguration;
 
-import com.sun.mail.smtp.SMTPTransport;
-
-import javax.swing.JButton;
-
 
 public class ProvisioningPanel extends JPanel implements StatusObject, KeyListener, FocusListener
 {
@@ -155,7 +152,7 @@
     }
     
     
-    public void alterModifier( HauskeysUserModifier modifier )
+    public void alterModifier( HauskeysUser modifier )
     {
         modifier.setEmail( emailTextField.getText() );
         modifier.setMobile( mobileTextField.getText() );

Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserDependentsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserDependentsPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserDependentsPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserDependentsPanel.java Thu Aug  9 16:40:15 2007
@@ -20,17 +20,9 @@
 package org.safehaus.triplesec.admin.swing;
 
 
-import javax.swing.JPanel;
 import java.awt.BorderLayout;
-import javax.swing.JButton;
-import java.awt.GridBagLayout;
-
-import javax.swing.JOptionPane;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTree;
-
 import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -38,16 +30,21 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTree;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 
-import org.safehaus.triplesec.admin.DataAccessException;
+import org.safehaus.triplesec.admin.Application;
 import org.safehaus.triplesec.admin.Group;
-import org.safehaus.triplesec.admin.GroupModifier;
 import org.safehaus.triplesec.admin.Profile;
 import org.safehaus.triplesec.admin.User;
-import org.safehaus.triplesec.admin.Application;
+import org.safehaus.triplesec.admin.persistence.PCException;
 
 
 public class UserDependentsPanel extends JPanel
@@ -254,13 +251,14 @@
                                 Group group = ( Group ) dependent;
                                 if ( group.getMembers().size() == 1 )
                                 {
-                                    group.modifier().delete();
+                                    //TODO REALLY??
+                                    group.getStateManager().getEntityManager().remove( group);
                                     model.removeNodeFromParent( dependentNode );
                                 }
                                 else
                                 {
-                                    GroupModifier modifier = group.modifier().removeMember( user.getId() );
-                                    dependentNode.setUserObject( modifier.modify() );
+                                    group.removeMember( user );
+                                    dependentNode.setUserObject( group );
                                 }
                                 removed.add( dependentNode );
                             }
@@ -272,7 +270,7 @@
                                 model.removeNodeFromParent( dependentNode );
                             }
                         }
-                        catch ( DataAccessException dae )
+                        catch ( PCException dae )
                         {
                             msg = UiUtils.wrap( "Failed to remove all dependency relationships for user: "
                                 + dae.getMessage(), 79 );



Mime
View raw message