directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r498893 - in /directory/sandbox/triplesec-jacc2: ./ admin-api2/src/main/java/org/safehaus/triplesec/admin/ admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ itest-data/ itest-data/src/main/resources/ jaas/src/test/java/org/...
Date Tue, 23 Jan 2007 02:22:59 GMT
Author: djencks
Date: Mon Jan 22 18:22:55 2007
New Revision: 498893

URL: http://svn.apache.org/viewvc?view=rev&rev=498893
Log:
Use the bootstrap partition jar proposed in DIRSERVER-834 to install the tsec schema for integration
tests.  Most itests work, a few still fail erratically

Added:
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
  (with props)
Modified:
    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/TriplesecAdmin.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java
    directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
    directory/sandbox/triplesec-jacc2/itest-data/pom.xml
    directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.xml
    directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java
    directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
    directory/sandbox/triplesec-jacc2/main/pom.xml
    directory/sandbox/triplesec-jacc2/pom.xml
    directory/sandbox/triplesec-jacc2/store/pom.xml
    directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/LeftTreeNavigation.java
    directory/sandbox/triplesec-jacc2/verifier/pom.xml

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=498893&r1=498892&r2=498893
==============================================================================
--- 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
Mon Jan 22 18:22:55 2007
@@ -63,7 +63,7 @@
 
     public Application()
     {
-        stateManager = new StateManager( this );
+        stateManager = new StateManager<Application>( this );
         stateManager.setRdn( new SimpleRdn( "appName", null, PARENT_APPLICATION_RDN ) );
         stateManager.addField( new SingleValuedField<String>( "description", null )
);
         stateManager.addField( new SingleValuedField<String>( "userPassword", null
) );

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
(original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/TriplesecAdmin.java
Mon Jan 22 18:22:55 2007
@@ -21,14 +21,13 @@
 
 
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-import java.util.Collection;
-import java.util.ArrayList;
 
+import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.InitialLdapContext;
-import javax.naming.NamingException;
 
 import org.safehaus.triplesec.admin.dao.DaoFactory;
 import org.safehaus.triplesec.admin.dao.ExternalUserDao;
@@ -38,6 +37,7 @@
 import org.safehaus.triplesec.admin.dao.UserDao;
 import org.safehaus.triplesec.admin.persistence.EntityManager;
 import org.safehaus.triplesec.admin.persistence.EntityManagerImpl;
+import org.safehaus.triplesec.admin.persistence.Query;
 
 
 public class TriplesecAdmin
@@ -49,6 +49,8 @@
      * for top level apps, ou=applications
      */
     private String appDn;
+    private Query<Application> appQuery;
+    //deprecated
     private DaoFactory factory;
     private GroupDao groupDao;
     private ExternalUserDao externalUserDao;
@@ -61,12 +63,14 @@
     {
         this.entityManager = entityManager;
         this.appDn = appDn;
+        appQuery = ( Query<Application> ) entityManager.createQuery( appDn, Application.class,
"(& (appName=*) (objectClass=policyApplication) )");
     }
 
     /**
      *
-     * @param dirContext
+     * @param dirContext DirContext that all info will come from
      * @param rootDn "realm", e.g. dc=example,dc=com
+     * @param appDn offset to level of applications administered
      */
     public TriplesecAdmin( DirContext dirContext, String rootDn, String appDn)
     {
@@ -77,7 +81,7 @@
     {
         String rootDn = ( String ) props.remove("org.apache.directory.triplesec.admin.RootDn");
         appDn = ( String ) props.remove("org.apache.directory.triplesec.admin.AppDn");
-        DirContext dirContext = null;
+        DirContext dirContext;
         try
         {
             dirContext = new InitialLdapContext( props, null );
@@ -143,16 +147,15 @@
 
 
     // -----------------------------------------------------------------------
-    // Application and ApplicationModifier Read Operations
+    // Application Operations
     // -----------------------------------------------------------------------
 
     /**
-     * TODO implement me somehow
      * @return all the applications in scope.
      */
-    public Collection<Application> getApplications()
+    public Map<String, Application> getApplications()
     {
-        return new ArrayList<Application>();
+        return appQuery.execute( );
     }
 
     public Application getApplication( String name ) throws DataAccessException

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java
(original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManager.java
Mon Jan 22 18:22:55 2007
@@ -21,7 +21,7 @@
 package org.safehaus.triplesec.admin.persistence;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public interface EntityManager
 {
@@ -43,7 +43,9 @@
 
 //    boolean contains(java.lang.Object object);
 
-    Query createQuery(String appRdn);
+    Query<?> createQuery(String rdn, Class<?> aClass, String query );
+    Query createQuery(PersistenceCapable parent, Class aClass, String query );
+    Query createQuery(Class aClass, String query );
 
     void close();
 

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java
(original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/EntityManagerImpl.java
Mon Jan 22 18:22:55 2007
@@ -28,7 +28,7 @@
 import javax.naming.directory.DirContext;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class EntityManagerImpl implements EntityManager
 {
@@ -136,9 +136,23 @@
         dirty.clear();
     }
 
-    public Query createQuery( String appRdn )
+    public Query createQuery( String rdn, Class aClass, String queryString )
     {
-        return null;
+        QueryImpl query = new QueryImpl( this, aClass, queryString);
+        query.setRdn( rdn );
+        return query;
+    }
+
+    public Query createQuery( PersistenceCapable parent, Class aClass, String queryString
)
+    {
+        QueryImpl query = new QueryImpl( this, aClass, queryString);
+        query.setParent( parent );
+        return query;
+    }
+
+    public Query createQuery( Class aClass, String queryString )
+    {
+        return new QueryImpl( this, aClass, queryString);
     }
 
     public void close()

Modified: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
(original)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/Query.java
Mon Jan 22 18:22:55 2007
@@ -20,9 +20,19 @@
 
 package org.safehaus.triplesec.admin.persistence;
 
+import java.util.Collection;
+import java.util.Map;
+
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
-public interface Query
+public interface Query<T extends PersistenceCapable>
 {
+
+    Map<String, T> execute();
+
+    Map<String, T> execute(String rdn);
+
+    Map<String, T> execute(PersistenceCapable parent);
+   
 }

Added: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java?view=auto&rev=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
(added)
+++ directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
Mon Jan 22 18:22:55 2007
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.safehaus.triplesec.admin.persistence;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.reflect.*;
+
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.Attributes;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class QueryImpl<T extends PersistenceCapable> implements Query<T>, ChangeListener<T>
+{
+    private final EntityManagerImpl em;
+    private final Class<T> pcClass;
+    private final String query;
+    private final SearchControls controls;
+    private String rdn;
+    private PersistenceCapable parent;
+
+
+    public QueryImpl( EntityManagerImpl em, Class<T> pcClass, String query )
+    {
+        this.em = em;
+        this.pcClass = pcClass;
+        this.query = query;
+        try
+        {
+            java.lang.reflect.Field field = pcClass.getField("attrs");
+            String[] attrs = ( String[] ) field.get( null );
+            controls = new SearchControls( SearchControls.ONELEVEL_SCOPE, 0, 0, attrs, false,
false);
+        } catch ( NoSuchFieldException e )
+        {
+            throw new PCException("No attrs field in class " + pcClass, e );
+        } catch ( IllegalAccessException e )
+        {
+            throw new PCException("Could not access field attrs in class: " + pcClass, e);
+        }
+
+    }
+
+    public void setRdn( String rdn )
+    {
+        this.rdn = rdn;
+    }
+
+    public void setParent( PersistenceCapable parent )
+    {
+        this.parent = parent;
+    }
+
+    public Map<String, T> execute()
+    {
+        Map<String, T> map = new HashMap<String, T>();
+        DirContext ctx = em.getDirContext();
+        StringBuffer buf = rdn == null? new StringBuffer(): new StringBuffer(rdn).append(",");
+        if ( parent != null )
+        {
+            buf = parent.getStateManager().getNewName( buf );
+        }
+        String name = buf.toString();
+        try
+        {
+            for ( NamingEnumeration ne = ctx.search( name, query, controls) ; ne.hasMoreElements();
) {
+                SearchResult result = ( SearchResult ) ne.nextElement();
+                Attributes attrs = result.getAttributes();
+                String dn = result.getName();
+                String pcRdn = dn + "," + rdn;
+                T pc = pcClass.newInstance();
+                StateManager<T> sm = pc.getStateManager();
+                sm.load( em, parent.getStateManager(), pcRdn, attrs);
+                String key = sm.getId();
+                map.put(key, (T)pc);
+                sm.addListener( this );
+            }
+        } catch ( NamingException e )
+        {
+            throw new PCException( e);
+        } catch ( InstantiationException e )
+        {
+            throw new PCException( e);
+        } catch ( IllegalAccessException e )
+        {
+            throw new PCException( e);
+        }
+
+        return map;
+    }
+
+    public Map<String, T> execute( String rdn )
+    {
+        setRdn( rdn );
+        return execute();
+    }
+
+    public Map<String, T> execute( PersistenceCapable parent )
+    {
+        setParent( parent );
+        return execute();
+    }
+
+    public void changed( String oldId, String newId, T t )
+    {
+    }
+}

Propchange: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: directory/sandbox/triplesec-jacc2/admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/QueryImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: directory/sandbox/triplesec-jacc2/itest-data/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/itest-data/pom.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/itest-data/pom.xml (original)
+++ directory/sandbox/triplesec-jacc2/itest-data/pom.xml Mon Jan 22 18:22:55 2007
@@ -27,5 +27,12 @@
   <artifactId>triplesec-itest-data</artifactId>
   <name>Triplesec Itest Data</name>
   <packaging>jar</packaging>  
+  <dependencies>
 
+    <dependency>
+      <groupId>org.apache.directory.triplesec</groupId>
+      <artifactId>triplesec-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
 </project>

Modified: directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.xml (original)
+++ directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.xml Mon Jan 22
18:22:55 2007
@@ -105,11 +105,12 @@
            </bean>  
          </property>    
          
-    <property name="contextPartitionConfigurations">
+    <property name="partitionConfigurations">
       <set>
         <ref bean="examplePartitionConfiguration"/>
       </set>
     </property>
+<!--
     <property name="bootstrapSchemas">
       <set>
         <bean class="org.apache.directory.server.core.schema.bootstrap.CorbaSchema"/>
@@ -124,7 +125,8 @@
         <bean class="org.safehaus.triplesec.store.schema.SafehausSchema"/>
       </set>
     </property>
-    
+-->
+
     <property name="extendedOperationHandlers">
       <list>
         <bean class="org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler"/>

Modified: directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java
(original)
+++ directory/sandbox/triplesec-jacc2/jaas/src/test/java/org/safehaus/triplesec/jaas/LdapBindLoginModuleIntegrationTest.java
Mon Jan 22 18:22:55 2007
@@ -35,7 +35,7 @@
 import org.apache.directory.triplesec.jaas.TestLoginConfiguration;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class LdapBindLoginModuleIntegrationTest extends TriplesecIntegration
 {
@@ -84,7 +84,7 @@
         Subject subject = new Subject();
         LoginContext loginContext = new LoginContext( "testRealm", subject, new UPCallbackHandler(
"akarasulu", "maxwell" ) );
         loginContext.login();
-        assertEquals(2, StateRetrievingLoginModule.sharedState.size());
+        assertEquals("shared state: " + StateRetrievingLoginModule.sharedState, 4, StateRetrievingLoginModule.sharedState.size());
         assertEquals( "akarasulu@EXAMPLE.COM", StateRetrievingLoginModule.sharedState.get(LdapBindLoginModule.PREFIX
+ "krb5PrincipalName"));
         assertEquals( "akarasulu", StateRetrievingLoginModule.sharedState.get(LdapBindLoginModule.PREFIX
+ "uid"));
         loginContext.logout();

Modified: directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
(original)
+++ directory/sandbox/triplesec-jacc2/jacc/src/main/java/org/apache/directory/triplesec/jacc/TripleSecPolicyConfigurationFactory.java
Mon Jan 22 18:22:55 2007
@@ -30,6 +30,8 @@
 import javax.security.jacc.PolicyConfigurationFactory;
 import javax.security.jacc.PolicyContextException;
 import javax.naming.directory.DirContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.NamingException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -41,105 +43,138 @@
 /**
  * @version $Rev$ $Date$
  */
-public class TripleSecPolicyConfigurationFactory extends PolicyConfigurationFactory {
+public class TripleSecPolicyConfigurationFactory extends PolicyConfigurationFactory
+{
 
-    private final Log log = LogFactory.getLog(TripleSecPolicyConfigurationFactory.class);
+    private final Log log = LogFactory.getLog( TripleSecPolicyConfigurationFactory.class
);
     private static TripleSecPolicyConfigurationFactory singleton;
 
     private Properties ldapProperties;
-    private DaoFactory daoFactory;
+    private DirContext ctx;
+    private String rootDn;
 
     private Map<String, TripleSecPolicyConfiguration> configurations = new HashMap<String,
TripleSecPolicyConfiguration>();
     private static final String LDAP_PROPERTIES_LOCATON_KEY = "org.apache.directory.triplesec.jacc.ldap.properties";
+    private static final String LDAP_ROOT_DN_KEY = "org.apache.directory.triplesec.jacc.ldap.rootdn";
     private static final String LDAP_PROPERTIES_LOCATION_DEFAULT = "triplesec_jacc_ldap.properties";
 
-    public TripleSecPolicyConfigurationFactory() {
-        synchronized (TripleSecPolicyConfigurationFactory.class) {
-            if (singleton != null) {
-                log.error("Singleton already assigned.  There may be more than one TripleSecPolicyConfigurationFactory
being used.");
-                throw new IllegalStateException("Singleton already assigned");
+    public TripleSecPolicyConfigurationFactory()
+    {
+        synchronized ( TripleSecPolicyConfigurationFactory.class )
+        {
+            if ( singleton != null )
+            {
+                log.error( "Singleton already assigned.  There may be more than one TripleSecPolicyConfigurationFactory
being used." );
+                throw new IllegalStateException( "Singleton already assigned" );
             }
             singleton = this;
         }
     }
 
-    public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove) throws
PolicyContextException {
-        TripleSecPolicyConfiguration configuration = configurations.get(contextID);
+    public PolicyConfiguration getPolicyConfiguration( String contextID, boolean remove )
throws PolicyContextException
+    {
+        TripleSecPolicyConfiguration configuration = configurations.get( contextID );
 
-        if (configuration == null) {
-            configuration = new TripleSecPolicyConfiguration(contextID, this);
-            configurations.put(contextID, configuration);
-        } else {
-            configuration.open(remove);
+        if ( configuration == null )
+        {
+            configuration = new TripleSecPolicyConfiguration( contextID, this );
+            configurations.put( contextID, configuration );
+        } else
+        {
+            configuration.open( remove );
         }
 
-        log.trace("Get " + (remove ? "CLEANED" : "") + " policy configuration " + contextID);
+        log.trace( "Get " + ( remove ? "CLEANED" : "" ) + " policy configuration " + contextID
);
         return configuration;
     }
 
-    public boolean inService(String contextID) throws PolicyContextException {
-        PolicyConfiguration configuration = getPolicyConfiguration(contextID, false);
+    public boolean inService( String contextID ) throws PolicyContextException
+    {
+        PolicyConfiguration configuration = getPolicyConfiguration( contextID, false );
 
-        log.trace("Policy configuration " + contextID + " put into service");
+        log.trace( "Policy configuration " + contextID + " put into service" );
         return configuration.inService();
     }
 
-    static TripleSecPolicyConfigurationFactory getSingleton() {
+    static TripleSecPolicyConfigurationFactory getSingleton()
+    {
         return singleton;
     }
 
-    public TripleSecPolicyConfiguration getTripleSecPolicyConfiguration(String contextID)
{
-        return configurations.get(contextID);
+    public TripleSecPolicyConfiguration getTripleSecPolicyConfiguration( String contextID
)
+    {
+        return configurations.get( contextID );
     }
 
-    public synchronized void setLdapProperties(Properties ldapProperties) {
+    public synchronized void setLdapProperties( Properties ldapProperties )
+    {
         this.ldapProperties = ldapProperties;
     }
 
-    public synchronized DaoFactory getDaoFactory() throws PolicyContextException {
-        if (daoFactory == null) {
-            if (ldapProperties == null) {
+    public synchronized DirContext getDirContext() throws PolicyContextException
+    {
+        if ( ctx == null )
+        {
+            if ( ldapProperties == null )
+            {
                 InputStream in = null;
-                String fileLocation = System.getProperty(LDAP_PROPERTIES_LOCATON_KEY, LDAP_PROPERTIES_LOCATION_DEFAULT);
-                File propertiesFile = new File(fileLocation);
-                if (propertiesFile.exists()) {
-                    try {
-                        in = new FileInputStream(propertiesFile);
-                    } catch (FileNotFoundException e) {
+                String fileLocation = System.getProperty( LDAP_PROPERTIES_LOCATON_KEY, LDAP_PROPERTIES_LOCATION_DEFAULT
);
+                File propertiesFile = new File( fileLocation );
+                if ( propertiesFile.exists() )
+                {
+                    try
+                    {
+                        in = new FileInputStream( propertiesFile );
+                    } catch ( FileNotFoundException e )
+                    {
                         //should not happen.... we just checked
                     }
                 }
-                if (in == null) {
+                if ( in == null )
+                {
                     ClassLoader cl = Thread.currentThread().getContextClassLoader();
-                    if (cl == null) {
+                    if ( cl == null )
+                    {
                         cl = this.getClass().getClassLoader();
                     }
-                    in = cl.getResourceAsStream(fileLocation);
+                    in = cl.getResourceAsStream( fileLocation );
                 }
-                if (in == null) {
-                    throw new PolicyContextException("Could not find properties to initialize
ldap");
+                if ( in == null )
+                {
+                    throw new PolicyContextException( "Could not find properties to initialize
ldap" );
                 }
                 ldapProperties = new Properties();
-                try {
-                    ldapProperties.load(in);
-                } catch (IOException e) {
-                    throw new PolicyContextException("Could not load ldap properties from
" + fileLocation, e);
+                try
+                {
+                    ldapProperties.load( in );
+                } catch ( IOException e )
+                {
+                    throw new PolicyContextException( "Could not load ldap properties from
" + fileLocation, e );
                 }
+                rootDn = ldapProperties.getProperty( LDAP_ROOT_DN_KEY );
+                if ( rootDn == null )
+                {
+                    throw new PolicyContextException( "No rootdn specified at key " + LDAP_ROOT_DN_KEY
);
+                }
+            }
+            try
+            {
+                ctx = new InitialLdapContext( ldapProperties, null );
             }
-            try {
-                daoFactory = DaoFactory.createInstance(ldapProperties);
-            } catch (DataAccessException e) {
-                throw new PolicyContextException("Could not construct dir context", e);
+            catch ( NamingException e )
+            {
+                String msg = "Failed to initialize LDAP context: " + e.getMessage();
+                log.error( msg, e );
+                throw new PolicyContextException( msg, e );
             }
         }
 
-        return daoFactory;
+        return ctx;
     }
 
-    public EntityManager getEntityManager()
+    public EntityManager getEntityManager() throws PolicyContextException
     {
-        DirContext ctx = null;
-        String rootDn = null;
-        return new EntityManagerImpl( ctx, rootDn);
+        DirContext ctx = getDirContext();
+        return new EntityManagerImpl( ctx, rootDn );
     }
 }

Modified: directory/sandbox/triplesec-jacc2/main/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/main/pom.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/main/pom.xml (original)
+++ directory/sandbox/triplesec-jacc2/main/pom.xml Mon Jan 22 18:22:55 2007
@@ -30,6 +30,11 @@
   <dependencies>
     <dependency>
       <groupId>${pom.groupId}</groupId>
+      <artifactId>triplesec-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
       <artifactId>triplesec-configuration-io</artifactId>
       <version>${pom.version}</version>
     </dependency>

Modified: directory/sandbox/triplesec-jacc2/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/pom.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/pom.xml (original)
+++ directory/sandbox/triplesec-jacc2/pom.xml Mon Jan 22 18:22:55 2007
@@ -147,6 +147,12 @@
         <groupId>org.apache.directory.server</groupId>
         <artifactId>apacheds-core</artifactId>
         <version>1.5.0-SNAPSHOT</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.apache.directory.server</groupId>
+                <artifactId>apacheds-bootstrap-partition</artifactId>
+            </exclusion>
+        </exclusions>
       </dependency>
 
       <dependency>
@@ -185,6 +191,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-bootstrap-extract</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-jdbm-store</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
         <artifactId>apacheds-schema-registries</artifactId>
         <version>1.5.0-SNAPSHOT</version>
       </dependency>
@@ -649,6 +665,7 @@
       </activation>
     
       <modules>
+        <module>bootstrap-partition</module>
         <module>changelog</module>
         <module>configuration</module>
         <module>configuration-io</module>
@@ -691,6 +708,7 @@
       </activation>
     
       <modules>
+        <module>bootstrap-partition</module>
         <module>changelog</module>
         <module>configuration</module>
         <module>configuration-io</module>
@@ -699,9 +717,7 @@
         <module>profile</module>
         <module>testdata</module>
         <module>jaas</module>
-<!--
         <module>jacc</module>
--->
         <module>sms</module>
         <module>store</module>
         <module>verifier</module>
@@ -750,6 +766,7 @@
       </activation>
       
       <modules>
+        <module>bootstrap-partition</module>
         <module>changelog</module>
         <module>configuration</module>
         <module>configuration-io</module>

Modified: directory/sandbox/triplesec-jacc2/store/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/store/pom.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/store/pom.xml (original)
+++ directory/sandbox/triplesec-jacc2/store/pom.xml Mon Jan 22 18:22:55 2007
@@ -28,12 +28,14 @@
   <name>Triplesec Store</name>
   <packaging>jar</packaging>  
   <dependencies>
+<!--
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>triplesec-itest-data</artifactId>
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+-->
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>triplesec-testdata</artifactId>
@@ -190,6 +192,11 @@
           <plugin>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
+              <!-- temporary exclusion while I work on bootstrap schemas -->
+              <excludes>
+                <exclude>**/*ITest.java</exclude>
+                <exclude>**/*IntegrationTest.java</exclude>
+              </excludes>
               <systemProperties>
                 <property>
                   <name>workingDirectory</name>

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/LeftTreeNavigation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/LeftTreeNavigation.java?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/LeftTreeNavigation.java
(original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/LeftTreeNavigation.java
Mon Jan 22 18:22:55 2007
@@ -20,6 +20,11 @@
 package org.safehaus.triplesec.admin.swing;
 
 
+import java.awt.GridLayout;
+import java.util.Enumeration;
+import java.util.Observable;
+import java.util.Observer;
+
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -30,19 +35,13 @@
 
 import org.safehaus.triplesec.admin.Application;
 import org.safehaus.triplesec.admin.DataAccessException;
-import org.safehaus.triplesec.admin.TriplesecAdmin;
+import org.safehaus.triplesec.admin.Permission;
 import org.safehaus.triplesec.admin.Profile;
 import org.safehaus.triplesec.admin.Role;
-import org.safehaus.triplesec.admin.Permission;
+import org.safehaus.triplesec.admin.TriplesecAdmin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.awt.GridLayout;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Observable;
-import java.util.Observer;
-
 
 /**
  * The left tree navigation.
@@ -200,7 +199,7 @@
 //            model.insertNodeInto( new DefaultMutableTreeNode( ii.next() ), usersNode, 0
);
 //        }
         
-        for ( Application app: admin.getApplications())
+        for ( Application app: admin.getApplications().values())
         {
             DefaultMutableTreeNode appNode = new DefaultMutableTreeNode( app );
             model.insertNodeInto( appNode, applicationsNode, 0 );

Modified: directory/sandbox/triplesec-jacc2/verifier/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/verifier/pom.xml?view=diff&rev=498893&r1=498892&r2=498893
==============================================================================
--- directory/sandbox/triplesec-jacc2/verifier/pom.xml (original)
+++ directory/sandbox/triplesec-jacc2/verifier/pom.xml Mon Jan 22 18:22:55 2007
@@ -33,6 +33,11 @@
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
+      <artifactId>triplesec-bootstrap-partition</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
       <artifactId>triplesec-store</artifactId>
       <version>${project.version}</version>
     </dependency>



Mime
View raw message