You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tb...@apache.org on 2006/12/12 16:24:14 UTC

svn commit: r486187 [8/49] - in /directory/trunks/triplesec: ./ admin-api/ admin-api/src/ admin-api/src/main/ admin-api/src/main/java/ admin-api/src/main/java/org/ admin-api/src/main/java/org/safehaus/ admin-api/src/main/java/org/safehaus/triplesec/ ad...

Added: directory/trunks/triplesec/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/ChangeEventType.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/ChangeEventType.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/ChangeEventType.java (added)
+++ directory/trunks/triplesec/changelog/src/main/java/org/safehaus/triplesec/changelog/beta/support/ChangeEventType.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.safehaus.triplesec.changelog.beta.support;
+
+/**
+ * An enumaration type for representing the actual type of a 
+ * {@link org.safehaus.sandbox.triplesec.change.ChangeOperation}.
+ * 
+ * @author <a href="mailto:ersiner@safehaus.org">Ersin Er</a>
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ */
+public abstract class ChangeEventType
+{    
+    /**
+     * Static Enumeration Members
+     */
+    public static final int ADD_CHANGE_EVENT    = 0;
+    public static final int DELETE_CHANGE_EVENT = 1;
+    public static final int MODIFY_CHANGE_EVENT = 2;
+    public static final int MODRDN_CHANGE_EVENT = 3;
+    public static final int MODDN_CHANGE_EVENT  = 4;
+    
+    public static String getChangeEventTypeNameByIntEnum( int intType )
+    {
+        switch ( intType )
+        {
+            case ADD_CHANGE_EVENT:
+                return "add";
+            case DELETE_CHANGE_EVENT:
+                return "delete";
+            case MODIFY_CHANGE_EVENT:
+                return "modify";
+            case MODRDN_CHANGE_EVENT:
+                return "modrdn";
+            case MODDN_CHANGE_EVENT:
+                return "moddn";
+            default:
+                throw new IllegalArgumentException( "Unmatched Change Event Type: " + intType );
+        }
+    }
+    
+        
+    public static int getIntEnumChangeEventTypeByName( String name )
+    {
+        
+        if ( name.equals( "add" ) )
+        {
+            return ADD_CHANGE_EVENT;
+        }
+        else if ( name.equals( "delete" ) )
+        {
+            return DELETE_CHANGE_EVENT;
+        }
+        else if ( name.equals( "modify" ) )
+        {
+            return MODIFY_CHANGE_EVENT;
+        }
+        else if ( name.equals( "modrdn" ) )
+        {
+            return MODRDN_CHANGE_EVENT;
+        }
+        else if ( name.equals( "moddn" ) )
+        {
+            return MODDN_CHANGE_EVENT;
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Unmatched Change Event Type Name: " + name );
+        }
+    }
+    
+    private ChangeEventType()
+    {
+    }
+}

Added: directory/trunks/triplesec/changelog/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/changelog/src/main/resources/log4j.properties?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/changelog/src/main/resources/log4j.properties (added)
+++ directory/trunks/triplesec/changelog/src/main/resources/log4j.properties Tue Dec 12 07:23:31 2006
@@ -0,0 +1,6 @@
+log4j.rootCategory=ERROR, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+log4j.logger.org.apache.ldap.common.name=WARN

Added: directory/trunks/triplesec/configuration-io/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/pom.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/pom.xml (added)
+++ directory/trunks/triplesec/configuration-io/pom.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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. 
+-->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.safehaus.triplesec</groupId>
+    <artifactId>build</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>triplesec-configuration-io</artifactId>
+  <name>Triplesec Configuration IO Utilities</name>
+  <description>
+    Triplesec Configuration IO Utilities
+  </description>
+  <packaging>jar</packaging>  
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>triplesec-configuration</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>triplesec-verifier</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-jndi</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>dom4j</groupId>
+      <artifactId>dom4j</artifactId>
+      <version>1.6</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.25</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.2</version>
+    </dependency>
+
+    <!-- =============================================== -->
+    <!-- START: Dependencies needed for Spring Framework -->
+    <!-- =============================================== -->
+
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>1.2.6</version>
+    </dependency>
+
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>1.2.6</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>1.2.6</version>
+    </dependency>
+
+    <!-- ============================================= -->
+    <!-- END: Dependencies needed for Spring Framework -->
+    <!-- ============================================= -->
+
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>workingDirectory</name>
+              <value>${basedir}/target/server-work</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ContextParameter.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ContextParameter.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ContextParameter.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ContextParameter.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,61 @@
+/*
+ *  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.configuration;
+
+
+import org.dom4j.Element;
+
+
+/**
+ * A wrapper around a context parameter elements in a web.xml document.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class ContextParameter
+{
+    private final Element parameter;
+
+    
+    public ContextParameter( Element parameter )
+    {
+        this.parameter = parameter;
+    }
+    
+    
+    public String getName()
+    {
+        return this.parameter.elementTextTrim( "param-name" );
+    }
+    
+    
+    public String getValue()
+    {
+        return this.parameter.elementTextTrim( "param-value" );
+    }
+    
+    
+    public String setValue( String value )
+    {
+        String old = getValue();
+        this.parameter.element( "param-value" ).setText( value );
+        return old;
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/FilterConfiguration.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/FilterConfiguration.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/FilterConfiguration.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/FilterConfiguration.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,107 @@
+/*
+ *  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.configuration;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.dom4j.Element;
+
+
+/**
+ * A filter element wrapper from a web.xml document.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class FilterConfiguration
+{
+    private final Element filter;
+    private final Map parameters = new HashMap();
+    
+
+    public FilterConfiguration( Element filter )
+    {
+        this.filter = filter;
+        
+        // load all init params 
+        for ( Iterator ii = filter.elementIterator( "init-param" ); ii.hasNext(); /**/ )
+        {
+            InitParameter parameter = new InitParameter ( ( Element ) ii.next() );
+            parameters.put( parameter.getName(), parameter );
+        }
+    }
+    
+    
+    private InitParameter getInitParameter( String name )
+    {
+        return ( InitParameter ) parameters.get( name );
+    }
+    
+    
+    public String getInitParameterValue( String name )
+    {
+        return getInitParameter( name ).getValue();
+    }
+    
+    
+    public String setInitParameterValue( String name, String value )
+    {
+        InitParameter parameter = getInitParameter( name );
+        return parameter.setValue( value );
+    }
+
+
+    public String addInitParameter( String name, String value )
+    {
+        InitParameter parameter = getInitParameter( name );
+        
+        if ( parameter == null )
+        {
+            Element parameterElement = filter.addElement( "init-param" );
+            parameterElement.addElement( "param-name" ).setText( name );
+            parameterElement.addElement( "param-value" );
+            parameter = new InitParameter( parameterElement );
+            parameters.put( parameter.getName(), parameter );
+        }
+        
+        return parameter.setValue( value );
+    }
+    
+    
+    public String getFilterName()
+    {
+        return filter.elementText( "filter-name" );
+    }
+    
+    
+    public String getFilterClass()
+    {
+        return filter.elementText( "filter-class" );
+    }
+
+
+    public boolean hasInitParameter( String name )
+    {
+        return parameters.containsKey( name );
+    }
+}
+

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/InitParameter.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/InitParameter.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/InitParameter.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/InitParameter.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,62 @@
+/*
+ *  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.configuration;
+
+
+import org.dom4j.Element;
+
+
+/**
+ * A wrapper around a filter initialization parameter element in a 
+ * web.xml document.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class InitParameter
+{
+    private final Element parameter;
+
+    
+    public InitParameter( Element parameter )
+    {
+        this.parameter = parameter;
+    }
+    
+    
+    public String getName()
+    {
+        return this.parameter.elementTextTrim( "param-name" );
+    }
+    
+    
+    public String getValue()
+    {
+        return this.parameter.elementTextTrim( "param-value" );
+    }
+    
+    
+    public String setValue( String value )
+    {
+        String old = getValue();
+        this.parameter.element( "param-value" ).setText( value );
+        return old;
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServerXmlUtils.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,398 @@
+/*
+ *  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.configuration;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attribute;
+
+import org.apache.directory.server.core.configuration.AttributesPropertyEditor;
+import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
+import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.beans.factory.config.CustomEditorConfigurer;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+
+/**
+ * Utilities for reading and writing Spring configuration files for ApacheDS.
+ * 
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class ServerXmlUtils
+{
+    private static final Logger log = LoggerFactory.getLogger( ServerXmlUtils.class );
+
+    
+    public static MutableTriplesecStartupConfiguration readConfiguration( URL url ) throws IOException
+    {
+        ApplicationContext factory = null;
+        factory = new FileSystemXmlApplicationContext( url.toString() );
+        return ( MutableTriplesecStartupConfiguration ) factory.getBean( "configuration" );
+    }
+    
+    
+    public static void writeConfiguration( File configurationFile, TriplesecStartupConfiguration configuration, 
+        Properties environment ) throws Exception
+    {
+        Document document = DocumentHelper.createDocument();
+        document.addDocType( "beans", "-//SPRING//DTD BEAN//EN", 
+            "http://www.springframework.org/dtd/spring-beans.dtd" );
+        Element beans = document.addElement( "beans" );
+        
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "adding environment properties: " + environment );
+        }
+        addEnvironmentBean( beans, environment );
+        addConfigurationBean( beans, configuration );
+        addCustomEditorsBean( beans );
+        
+        OutputFormat format = OutputFormat.createPrettyPrint();
+        format.setTrimText( false );
+        XmlUtils.writeDocument( document, configurationFile, format );
+    }
+
+
+    // -----------------------------------------------------------------------
+    // Package Friendly Methods (non-exposed but PF for testing)
+    // -----------------------------------------------------------------------
+
+    
+    private static void addCustomEditorsBean( Element beans )
+    {
+        Element bean = beans.addElement( "bean" ).addAttribute( "class", CustomEditorConfigurer.class.getName() );
+        Element property = bean.addElement( "property" ).addAttribute( "name", "customEditors" );
+        Element map = property.addElement( "map" );
+        Element entry = map.addElement( "entry" ).addAttribute( "key", "javax.naming.directory.Attributes" );
+        entry.addElement( "bean" ).addAttribute( "class", AttributesPropertyEditor.class.getName() );
+    }
+
+
+    static void addConfigurationBean( Element beansElement, TriplesecStartupConfiguration configuration )
+        throws Exception
+    {
+        Element bean = beansElement.addElement( "bean" );
+        bean.addAttribute( "id", "configuration" );
+        bean.addAttribute( "class", 
+            "org.safehaus.triplesec.configuration.MutableTriplesecStartupConfiguration" );
+        
+        if ( configuration.getPresentationBaseUrl() != null )
+        {
+            addProperty( bean, "presentationBaseUrl", configuration.getPresentationBaseUrl() );
+        }
+        
+        addProperty( bean, "allowAnonymousAccess", configuration.isAllowAnonymousAccess() );
+        addProperty( bean, "accessControlEnabled", configuration.isAccessControlEnabled() );
+        addProperty( bean, "ldapPort", configuration.getLdapPort() );
+        addProperty( bean, "ldapsCertificateFile", configuration.getLdapsCertificateFile() );
+        addProperty( bean, "ldapsCertificatePassword", configuration.getLdapsCertificatePassword() );
+        addProperty( bean, "ldapsPort", configuration.getLdapsPort() );
+        addProperty( bean, "httpPort", configuration.getHttpPort() );
+        
+        if ( configuration.getLdifDirectory() != null )
+        {
+            addProperty( bean, "ldifDirectory", configuration.getLdifDirectory() );
+        }
+        
+        addProperty( bean, "workingDirectory", configuration.getWorkingDirectory() );
+        addProperty( bean, "enableChangePassword", configuration.isEnableChangePassword() );
+        addProperty( bean, "enableKerberos", configuration.isEnableKerberos() );
+        addProperty( bean, "enableLdaps", configuration.isEnableLdaps() );
+        addProperty( bean, "enableNetworking", configuration.isEnableNetworking() );
+        addProperty( bean, "enableNtp", configuration.isEnableNtp() );
+        addProperty( bean, "enableHttp", configuration.isEnableHttp() );
+        addProperty( bean, "exitVmOnShutdown", configuration.isExitVmOnShutdown() );
+        addProperty( bean, "shutdownHookEnabled", configuration.isShutdownHookEnabled() );
+        
+        if ( configuration.getLdifFilters() != null && configuration.getLdifFilters().size() > 0 )
+        {
+            addBeans( "ldifFilters", bean, configuration.getLdifFilters() );
+        }
+        
+        addBeans( "extendedOperationHandlers", bean, ( List ) configuration.getExtendedOperationHandlers() );
+        addBeans( "bootstrapSchemas", bean, configuration.getBootstrapSchemas() );
+        
+        if ( configuration.getAuthenticatorConfigurations() != null && 
+            configuration.getAuthenticatorConfigurations().size() > 0 )
+        {
+            // addBeans( "authenticatorConfigurations", bean, configuration.getAuthenticatorConfigurations() );
+        }
+        
+        addInterceptorBeans( "interceptorConfigurations", bean, configuration.getInterceptorConfigurations() );
+        addPartitionRefs( bean, configuration.getContextPartitionConfigurations() );
+        
+        for ( Iterator ii = configuration.getContextPartitionConfigurations().iterator(); ii.hasNext(); /**/ )
+        {
+            addPartitionConfiguration( beansElement, ( MutablePartitionConfiguration ) ii.next() );
+        }
+        
+        addProperty( bean, configuration.getSmsConfiguration() );
+        addProperty( bean, configuration.getSmtpConfiguration() );
+    }
+    
+    
+    private static void addProperty( Element bean, SmsConfiguration smsConfiguration )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", "smsConfiguration" );
+        Element smsBean = property.addElement( "bean" );
+        smsBean.addAttribute( "class", SmsConfiguration.class.getName() );
+        addProperty( smsBean, "smsUsername", smsConfiguration.getSmsUsername() );
+        addProperty( smsBean, "smsPassword", smsConfiguration.getSmsPassword() );
+        addProperty( smsBean, "smsAccountName", smsConfiguration.getSmsAccountName() );
+        addProperty( smsBean, "smsTransportUrl", smsConfiguration.getSmsTransportUrl() );
+    }
+
+
+    private static void addProperty( Element bean, SmtpConfiguration smtpConfiguration )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", "smtpConfiguration" );
+        Element smsBean = property.addElement( "bean" );
+        smsBean.addAttribute( "class", SmtpConfiguration.class.getName() );
+        addProperty( smsBean, "smtpAuthenticate", smtpConfiguration.isSmtpAuthenticate() );
+        if ( smtpConfiguration.isSmtpAuthenticate() )
+        {
+            addProperty( smsBean, "smtpUsername", smtpConfiguration.getSmtpUsername() );
+            addProperty( smsBean, "smtpPassword", smtpConfiguration.getSmtpPassword() );
+        }
+        addProperty( smsBean, "smtpHost", smtpConfiguration.getSmtpHost() );
+        addProperty( smsBean, "smtpFrom", smtpConfiguration.getSmtpFrom() );
+        addProperty( smsBean, "smtpSubject", smtpConfiguration.getSmtpSubject() );
+    }
+
+
+    static void addPartitionConfiguration( Element beansElement, 
+        MutablePartitionConfiguration configuration ) throws Exception
+    {
+        Element bean = beansElement.addElement( "bean" );
+        bean.addAttribute( "id", configuration.getName() + "PartitionConfiguration" );
+        bean.addAttribute( "class", MutablePartitionConfiguration.class.getName() );
+        addProperty( bean, "name", configuration.getName() );
+        addProperty( bean, "suffix", configuration.getSuffix() );
+        
+        // Add the contextEntry property by building the partial LDIF
+        StringBuffer contextEntry = new StringBuffer();
+        contextEntry.append( "\n" );
+        NamingEnumeration enumeration = configuration.getContextEntry().getAll();
+        while ( enumeration.hasMore() )
+        {
+            Attribute attr = ( Attribute ) enumeration.next();
+            for ( int ii = 0; ii < attr.size(); ii++ )
+            {
+                contextEntry.append( attr.getID() ).append( ": " ).append( attr.get( ii ) ).append( "\n" );
+            }
+        }
+        addProperty( bean, "contextEntry", contextEntry.toString() );
+        
+        // Build the indexedAttributes property 
+        Element property = bean.addElement( "property" ).addAttribute( "name", "indexedAttributes" );
+        Element indexSet = property.addElement( "set" );
+        Set excludes = new HashSet();
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.1" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.2" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.3" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.4" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.5" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.6" );
+        excludes.add( "1.2.6.1.4.1.18060.1.1.1.3.7" );
+        for ( Iterator ii = configuration.getIndexedAttributes().iterator(); ii.hasNext(); /**/ )
+        {
+            String index = ( String ) ii.next();
+            
+            if ( excludes.contains( index ) )
+            {
+                continue;
+            }
+            
+            indexSet.addElement( "value" ).addText( index );
+        }
+    }
+
+
+    static void addInterceptorBeans( String propertyKey, Element bean, List interceptorConfigurations )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", propertyKey );
+        Element list = property.addElement( "list" );
+        
+        for ( int ii = 0; ii < interceptorConfigurations.size(); ii++ )
+        {
+            InterceptorConfiguration configuration = ( InterceptorConfiguration ) interceptorConfigurations.get( ii );
+            Element interceptorBean = list.addElement( "bean" ).addAttribute( "class", 
+                MutableInterceptorConfiguration.class.getName() );
+            addProperty( interceptorBean, "name", configuration.getName() );
+            addBeanProperty( interceptorBean, "interceptor", configuration.getInterceptor().getClass() );
+        }
+    }
+
+
+    static void addPartitionRefs( Element bean, Set partitions )
+    {
+        Element property = bean.addElement( "property" ).addAttribute( "name", "contextPartitionConfigurations" );
+        Element set = property.addElement( "set" );
+        
+        for ( Iterator ii = partitions.iterator(); ii.hasNext(); /**/ )
+        {
+            MutablePartitionConfiguration configuration = ( MutablePartitionConfiguration ) ii.next();
+            set.addElement( "ref" ).addAttribute( "bean", configuration.getName() + "PartitionConfiguration" );
+        }
+    }
+    
+    
+    static void addBeanProperty( Element bean, String key, Class clazz )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", key );
+        property.addElement( "bean" ).addAttribute( "class", clazz.getName() );
+    }
+
+
+    static void addBeans( String propertyKey, Element bean, List objects )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", propertyKey );
+        Element list = property.addElement( "list" );
+        
+        for ( int ii = 0; ii < objects.size(); ii++ )
+        {
+            Object object = objects.get( ii );
+            list.addElement( "bean" ).addAttribute( "class", object.getClass().getName() );
+        }
+    }
+
+
+    static void addBeans( String propertyKey, Element bean, Set objects )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", propertyKey );
+        Element set = property.addElement( "set" );
+        
+        for ( Iterator ii = objects.iterator(); ii.hasNext(); /**/ )
+        {
+            Object object = ii.next();
+            set.addElement( "bean" ).addAttribute( "class", object.getClass().getName() );
+        }
+    }
+
+
+    static void addProperty( Element bean, String key, File value )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", key );
+        property.addElement( "value" ).addText( value.getPath() );
+    }
+    
+    
+    static void addProperty( Element bean, String key, boolean value )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", key );
+        property.addElement( "value" ).addText( String.valueOf( value ) );
+    }
+    
+    
+    static void addProperty( Element bean, String key, int value )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", key );
+        property.addElement( "value" ).addText( String.valueOf( value ) );
+    }
+    
+    
+    static void addProperty( Element bean, String key, String value )
+    {
+        Element property = bean.addElement( "property" );
+        property.addAttribute( "name", key );
+        property.addElement( "value" ).addText( value );
+    }
+    
+    
+    /**
+     * Adds the properties bean to the configuration.  The section appears like so:
+     * 
+     * <pre>
+     *     &lt;property name="properties"&gt;
+     *       &lt;props&gt;
+     *         &lt;prop key="java.naming.security.authentication"&gt;simple&lt;/prop&gt;
+     *         &lt;prop key="java.naming.security.principal"&gt;uid=admin,ou=system&lt;/prop&gt;
+     *         ...
+     *       &lt;/props&gt;
+     *     &lt;/property&gt;
+     * </pre>
+     * @param beansElement the top most root &lt;beans&gt; tag
+     * @param environment the properties to add to this section
+     */
+    static void addEnvironmentBean( Element beansElement, Properties environment )
+    {
+        Element beanElement = beansElement.addElement( "bean" );
+        beanElement.addAttribute( "id", "environment" );
+        beanElement.addAttribute( "class", "org.springframework.beans.factory.config.PropertiesFactoryBean" );
+        Element propertyElement = beanElement.addElement( "property" );
+        propertyElement.addAttribute( "name", "properties" ) ;
+        Element propsElement = propertyElement.addElement( "props" );
+        
+        List keys = new ArrayList( environment.keySet() );
+        Collections.sort( keys );
+        for ( int ii = 0; ii < keys.size(); ii++ )
+        {
+            String key = ( String ) keys.get( ii );
+            String value = environment.getProperty( key );
+            
+            Element prop = propsElement.addElement( "prop" );
+            prop.addAttribute( "key", key );
+            prop.addText( value );
+        }
+    }
+    
+    
+    static Document readDocument( URL url ) throws IOException, DocumentException
+    {
+        Document document = null;
+        SAXReader reader = new SAXReader();
+        document = reader.read( url );
+        return document;
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServletConfiguration.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServletConfiguration.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServletConfiguration.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/ServletConfiguration.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,108 @@
+/*
+ *  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.configuration;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.dom4j.Element;
+
+
+/**
+ * A servlet element wrapper from a web.xml document.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class ServletConfiguration
+{
+    private final Element servlet;
+    private final Map parameters = new HashMap();
+    
+
+    public ServletConfiguration( Element servlet )
+    {
+        this.servlet = servlet;
+        
+        // load all init params 
+        for ( Iterator ii = servlet.elementIterator( "init-param" ); ii.hasNext(); /**/ )
+        {
+            InitParameter parameter = new InitParameter ( ( Element ) ii.next() );
+            parameters.put( parameter.getName(), parameter );
+        }
+    }
+    
+    
+    private InitParameter getInitParameter( String name )
+    {
+        return ( InitParameter ) parameters.get( name );
+    }
+    
+    
+    public String getInitParameterValue( String name )
+    {
+        return getInitParameter( name ).getValue();
+    }
+    
+    
+    public String setInitParameterValue( String name, String value )
+    {
+        InitParameter parameter = getInitParameter( name );
+        return parameter.setValue( value );
+    }
+
+
+    public String addInitParameter( String name, String value )
+    {
+        InitParameter parameter = getInitParameter( name );
+        
+        if ( parameter == null )
+        {
+            Element parameterElement = servlet.addElement( "init-param" );
+            parameterElement.addElement( "param-name" ).setText( name );
+            parameterElement.addElement( "param-value" );
+            parameter = new InitParameter( parameterElement );
+            parameters.put( parameter.getName(), parameter );
+        }
+        
+        return parameter.setValue( value );
+    }
+    
+    
+    public String getServletName()
+    {
+        return servlet.elementText( "servlet-name" );
+    }
+    
+    
+    public String getServletClass()
+    {
+        return servlet.elementText( "servlet-class" );
+    }
+
+
+    public boolean hasInitParameter( String name )
+    {
+        return parameters.containsKey( name );
+    }
+}
+

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/WebappConfiguration.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/WebappConfiguration.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/WebappConfiguration.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/WebappConfiguration.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,164 @@
+/*
+ *  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.configuration;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+
+
+/**
+ * A wrapper around the web.xml document allowing for alterations.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class WebappConfiguration
+{
+    /** the web.xml parsed document */
+    Document webxml;
+    
+    /** filter configuration objects by name */
+    Map filters = new HashMap();
+    Map servlets = new HashMap();
+    Map contextParameters = new HashMap();
+    
+    
+    public WebappConfiguration( Document webxml )
+    {
+        this.webxml = webxml;
+        
+        for ( Iterator ii = webxml.getRootElement().elementIterator( "filter" ); ii.hasNext(); /**/ )
+        {
+            FilterConfiguration filterConfig = new FilterConfiguration( ( Element ) ii.next() );
+            filters.put( filterConfig.getFilterName(), filterConfig );
+        }
+
+        for ( Iterator ii = webxml.getRootElement().elementIterator( "servlet" ); ii.hasNext(); /**/ )
+        {
+            ServletConfiguration servletConfig = new ServletConfiguration( ( Element ) ii.next() );
+            servlets.put( servletConfig.getServletName(), servletConfig );
+        }
+
+        for ( Iterator ii = webxml.getRootElement().elementIterator( "context-param" ); ii.hasNext(); /**/ )
+        {
+            ContextParameter parameter = new ContextParameter ( ( Element ) ii.next() );
+            contextParameters.put( parameter.getName(), parameter );
+        }
+    }
+    
+    
+    public WebappConfiguration( File webxmlFile ) throws IOException, DocumentException
+    {
+        this ( XmlUtils.readDocument( webxmlFile.toURL() ) );
+    }
+    
+    
+    public WebappConfiguration( String webxmlPath ) throws IOException, DocumentException
+    {
+        this ( XmlUtils.readDocument( new File( webxmlPath ).toURL() ) );
+    }
+    
+    
+    public WebappConfiguration( URL webxmlUrl ) throws IOException, DocumentException
+    {
+        this ( XmlUtils.readDocument( webxmlUrl ) );
+    }
+    
+    
+    public FilterConfiguration getFilterConfiguration( String name )
+    {
+        return ( FilterConfiguration ) filters.get( name );
+    }
+    
+    
+    public ServletConfiguration getServletConfiguration( String name )
+    {
+        return ( ServletConfiguration ) servlets.get( name );
+    }
+    
+    
+    public Iterator getServletConfigurations()
+    {
+        return servlets.values().iterator();
+    }
+    
+    
+    public Iterator getFilterConfigurations()
+    {
+        return filters.values().iterator();
+    }
+    
+    
+    public Iterator getContextParameters()
+    {
+        return contextParameters.values().iterator();
+    }
+    
+    
+    private ContextParameter getContextParameter( String name )
+    {
+        return ( ContextParameter ) contextParameters.get( name );
+    }
+    
+    
+    public String getContextParameterValue( String name )
+    {
+        return getContextParameter( name ).getValue();
+    }
+    
+    
+    public String setContextParameterValue( String name, String value )
+    {
+        ContextParameter parameter = getContextParameter( name );
+        return parameter.setValue( value );
+    }
+
+
+    public String addContextParameter( String name, String value )
+    {
+        ContextParameter parameter = getContextParameter( name );
+        
+        if ( parameter == null )
+        {
+            Element parameterElement = webxml.getRootElement().addElement( "contet-param" );
+            parameterElement.addElement( "param-name" ).setText( name );
+            parameterElement.addElement( "param-value" );
+            parameter = new ContextParameter( parameterElement );
+            contextParameters.put( parameter.getName(), parameter );
+        }
+        
+        return parameter.setValue( value );
+    }
+    
+    
+    public Document getDocument()
+    {
+        return webxml;
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/XmlUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/XmlUtils.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/XmlUtils.java (added)
+++ directory/trunks/triplesec/configuration-io/src/main/java/org/safehaus/triplesec/configuration/XmlUtils.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,101 @@
+/*
+ *  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.configuration;
+
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.URL;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+
+
+/**
+ * Utilities for reading and writing xml files.
+ * 
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class XmlUtils
+{
+    public static void writeDocument( Document document, File configurationFile, OutputFormat format ) throws IOException
+    {
+        XMLWriter writer = null;
+        
+        if ( format == null )
+        {
+            writer = new XMLWriter( new FileWriter( configurationFile ) );
+        }
+        else
+        {
+            writer = new XMLWriter( new FileWriter( configurationFile ), format );
+        }
+        
+        writer.write( document );
+        writer.flush();
+        writer.close();
+    }
+
+
+    public static void writeDocument( Document document, StringWriter out, OutputFormat format ) throws IOException
+    {
+        XMLWriter writer = null;
+        
+        if ( format == null )
+        {
+            writer = new XMLWriter( out );
+        }
+        else
+        {
+            writer = new XMLWriter( out, format );
+        }
+        
+        writer.write( document );
+        writer.flush();
+        writer.close();
+    }
+    
+    
+    public static void writeDocument( Document document, StringWriter out ) throws IOException
+    {
+    	writeDocument( document, out, null );
+    }
+    
+    
+    public static void writeDocument( Document document, File configurationFile ) throws IOException
+    {
+    	writeDocument( document, configurationFile, null );
+    }
+
+    
+    public static Document readDocument( URL url ) throws IOException, DocumentException
+    {
+        Document document = null;
+        SAXReader reader = new SAXReader();
+        document = reader.read( url );
+        return document;
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java (added)
+++ directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/ServerXmlUtilsTest.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,337 @@
+/*
+ *  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.configuration;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.authn.AuthenticationService;
+import org.apache.directory.server.core.authz.AuthorizationService;
+import org.apache.directory.server.core.authz.DefaultAuthorizationService;
+import org.apache.directory.server.core.collective.CollectiveAttributeService;
+import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
+import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
+import org.apache.directory.server.core.event.EventService;
+import org.apache.directory.server.core.exception.ExceptionService;
+import org.apache.directory.server.core.normalization.NormalizationService;
+import org.apache.directory.server.core.operational.OperationalAttributeService;
+import org.apache.directory.server.core.referral.ReferralService;
+import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.server.core.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.core.schema.bootstrap.CollectiveSchema;
+import org.apache.directory.server.core.schema.bootstrap.CorbaSchema;
+import org.apache.directory.server.core.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.core.schema.bootstrap.CosineSchema;
+import org.apache.directory.server.core.schema.bootstrap.InetorgpersonSchema;
+import org.apache.directory.server.core.schema.bootstrap.JavaSchema;
+import org.apache.directory.server.core.schema.bootstrap.Krb5kdcSchema;
+import org.apache.directory.server.core.schema.bootstrap.SystemSchema;
+import org.apache.directory.server.core.subtree.SubentryService;
+import org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler;
+import org.apache.directory.server.ldap.support.extended.LaunchDiagnosticUiHandler;
+import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.safehaus.triplesec.store.interceptor.PolicyProtectionInterceptor;
+import org.safehaus.triplesec.store.schema.SafehausSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests the ServerXmlUtils class.
+ * 
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class ServerXmlUtilsTest extends TestCase
+{
+    private static final Logger log = LoggerFactory.getLogger( ServerXmlUtilsTest.class );
+    private File workingDirectory = null;
+
+    
+    public void setUp() throws Exception
+    {
+        String wkdirProp = System.getProperty( "workingDirectory" );
+        log.debug( "workingDirectory system property = " + wkdirProp );
+        if ( wkdirProp == null || wkdirProp.equals( "" ) )
+        {
+            wkdirProp = System.getProperty( "java.io.tmpdir" ) + File.separator + "target";
+        }
+        
+        workingDirectory = new File( wkdirProp );
+        if ( workingDirectory.exists() )
+        {
+            log.debug( "deleteing workingDirectory = " + workingDirectory );
+            FileUtils.forceDelete( workingDirectory );
+        }
+
+        log.debug( "creating workingDirectory = " + workingDirectory );
+        workingDirectory.mkdirs();
+        super.setUp();
+    }
+    
+    
+    public void tearDown() throws Exception
+    {
+        workingDirectory = null;
+        super.tearDown();
+    }
+    
+    
+    public void testAddEnvironment0() throws Exception
+    {
+        Document document = DocumentHelper.createDocument();
+        document.addDocType( "beans", "-//SPRING//DTD BEAN//EN", 
+            "http://www.springframework.org/dtd/spring-beans.dtd" );
+        Element beans = document.addElement( "beans" );
+        ServerXmlUtils.addEnvironmentBean( beans, new Properties() );
+        checkDocument( document );
+    }
+    
+    
+    public void testAddEnvironment1() throws Exception
+    {
+        Document document = DocumentHelper.createDocument();
+        document.addDocType( "beans", "-//SPRING//DTD BEAN//EN", 
+            "http://www.springframework.org/dtd/spring-beans.dtd" );
+        Element beans = document.addElement( "beans" );
+        Properties props = new Properties();
+        props.put( "property1key", "property1value" );
+        ServerXmlUtils.addEnvironmentBean( beans, props );
+        checkDocument( document );
+    }
+    
+    
+    public void testWriteConfiguration0() throws Exception
+    {
+        MutableTriplesecStartupConfiguration configuration = new MutableTriplesecStartupConfiguration();
+        configuration.setLdapPort( 10389 );
+        configuration.setAccessControlEnabled( true );
+        configuration.setShutdownHookEnabled( true );
+        configuration.setAllowAnonymousAccess( false );
+        configuration.setEnableChangePassword( true );
+        configuration.setEnableKerberos( true );
+        configuration.setEnableNetworking( true );
+        configuration.setEnableLdaps( false );
+        configuration.setEnableNtp( true );
+        configuration.setExitVmOnShutdown( true );
+        configuration.setLdifDirectory( new File( "conf" ) );
+        configuration.setWorkingDirectory( new File( "var/partitions" ) );
+        
+        List filters = new ArrayList();
+        filters.add( new Krb5KdcEntryFilter() );
+        configuration.setLdifFilters( filters );
+        
+        List interceptors = new ArrayList();
+        MutableInterceptorConfiguration interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new NormalizationService() );
+        interceptorConfiguration.setName( "normalizationService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new AuthenticationService() );
+        interceptorConfiguration.setName( "authenticationService" );
+        interceptors.add( interceptorConfiguration );
+
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new ReferralService() );
+        interceptorConfiguration.setName( "referralService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new AuthorizationService() );
+        interceptorConfiguration.setName( "authorizationService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new DefaultAuthorizationService() );
+        interceptorConfiguration.setName( "defaultAuthorizationService" ); 
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration(); 
+        interceptorConfiguration.setInterceptor( new ExceptionService() );
+        interceptorConfiguration.setName( "exceptionService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new SchemaService() );
+        interceptorConfiguration.setName( "schemaService" ); 
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new SubentryService() );
+        interceptorConfiguration.setName( "subentryService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new OperationalAttributeService() );
+        interceptorConfiguration.setName( "operationalAttributeService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new CollectiveAttributeService() );
+        interceptorConfiguration.setName( "collectiveAttributeService" );
+        interceptors.add( interceptorConfiguration );
+
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new EventService() );
+        interceptorConfiguration.setName( "eventService" );
+        interceptors.add( interceptorConfiguration );
+        
+        interceptorConfiguration = new MutableInterceptorConfiguration();
+        interceptorConfiguration.setInterceptor( new PolicyProtectionInterceptor() );
+        interceptorConfiguration.setName( "policyProtectionInterceptor" );
+        interceptors.add( interceptorConfiguration );
+        
+        configuration.setInterceptorConfigurations( interceptors );
+        
+        List extendedHandlers = new ArrayList();
+        extendedHandlers.add( new GracefulShutdownHandler() );
+        extendedHandlers.add( new LaunchDiagnosticUiHandler() );
+        configuration.setExtendedOperationHandlers( extendedHandlers );
+
+        configuration.getSmsConfiguration().setSmsAccountName( "foo" );
+        configuration.getSmsConfiguration().setSmsUsername( "bar" );
+        configuration.getSmsConfiguration().setSmsTransportUrl( "http://google.com" );
+        configuration.getSmsConfiguration().setSmsPassword( "secret" );
+        
+        configuration.getSmtpConfiguration().setSmtpAuthenticate( false );
+        configuration.getSmtpConfiguration().setSmtpFrom( "dev@safehaus.org" );
+        configuration.getSmtpConfiguration().setSmtpHost( "localhost" );
+        configuration.getSmtpConfiguration().setSmtpSubject( "Triplesec account activated" );
+        
+        Set partitions = new HashSet( configuration.getContextPartitionConfigurations() );
+        MutablePartitionConfiguration partitionConfiguration = new MutablePartitionConfiguration();
+        partitionConfiguration.setName( "example" );
+        partitionConfiguration.setSuffix( "dc=example,dc=com" );
+        Set indices = new HashSet();
+        indices.add( "objectClass" );
+        indices.add( "ou" ) ;
+        indices.add( "dc" ) ;
+        indices.add( "uid" ) ;
+        indices.add( "profileId" ) ;
+        indices.add( "roles" ) ;
+        indices.add( "grants" ) ;
+        indices.add( "denials" ) ;
+        indices.add( "krb5PrincipalName" ) ;
+        partitionConfiguration.setIndexedAttributes( indices );
+        Attributes contextEntry = new BasicAttributes( "objectClass", "top", true );
+        contextEntry.get( "objectClass" ).add( "domain" );
+        contextEntry.get( "objectClass" ).add( "extensibleObject" );
+        contextEntry.put( "dc", "example" );
+        contextEntry.put( "administrativeRole", "accessControlSpecificArea" );
+        contextEntry.get( "administrativeRole" ).add( "collectiveAttributeSpecificArea" );
+        partitionConfiguration.setContextEntry( contextEntry );
+        partitions.add( partitionConfiguration );
+        configuration.setContextPartitionConfigurations( partitions );
+        
+        Set schemas = new HashSet();
+        schemas.add( new CorbaSchema() );
+        schemas.add( new CoreSchema() );
+        schemas.add( new CosineSchema() );
+        schemas.add( new ApacheSchema() );
+        schemas.add( new CollectiveSchema() );
+        schemas.add( new InetorgpersonSchema() );
+        schemas.add( new JavaSchema() );
+        schemas.add( new Krb5kdcSchema() );
+        schemas.add( new SystemSchema() );
+        schemas.add( new SafehausSchema() );
+        configuration.setBootstrapSchemas( schemas );
+        
+        File outputFile = new File( workingDirectory, getName() + ".xml" );
+        log.debug( getName() + "(): outputing document to file: " + outputFile.getCanonicalPath() );
+        Properties props = new Properties();
+        props.put( "java.naming.security.authentication", "simple" );
+        props.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        props.put( "java.naming.security.credentials", "secret" );
+        props.put( "java.naming.provider.url", "dc=example,dc=com" );
+        props.put( "java.naming.factory.state", "org.safehaus.triplesec.store.ProfileStateFactory" );
+        props.put( "java.naming.factory.object", "org.safehaus.triplesec.store.ProfileObjectFactory" );
+        props.put( "kdc.primary.realm", "EXAMPLE.COM" );
+        props.put( "kdc.principal", "krbtgt/EXAMPLE.COM@EXAMPLE.COM" );
+        props.put( "kdc.encryption.types", "des-cbc-md5 des3-cbc-sha1 des3-cbc-md5 des-cbc-md4 des-cbc-crc" );
+        props.put( "kdc.entryBaseDn", "ou=users,dc=example,dc=com" );
+        props.put( "kdc.java.naming.security.credentials", "secret" );
+        props.put( "changepw.entryBaseDn", "ou=users,dc=example,dc=com" );
+        props.put( "changepw.java.naming.security.credentials", "secret" );
+        props.put( "changepw.principal", "kadmin/changepw@EXAMPLE.COM" );
+        props.put( "kdc.allowable.clockskew", "5" );
+        props.put( "kdc.tgs.maximum.ticket.lifetime", "1440" );
+        props.put( "kdc.tgs.maximum.renewable.lifetime", "10080" );
+        props.put( "kdc.pa.enc.timestamp.required", "true" );
+        props.put( "kdc.tgs.empty.addresses.allowed", "true" );
+        props.put( "kdc.tgs.forwardable.allowed", "true" );
+        props.put( "kdc.tgs.proxiable.allowed", "true" );
+        props.put( "kdc.tgs.postdate.allowed", "true" );
+        props.put( "kdc.tgs.renewable.allowed", "true" );
+        props.put( "safehaus.entry.basedn", "ou=Users,dc=example,dc=com" );
+        props.put( "safehaus.load.testdata", "true" );
+        props.put( "kerberos.sam.type.7", "org.safehaus.triplesec.verifier.hotp.DefaultHotpSamVerifier" );
+        ServerXmlUtils.writeConfiguration( outputFile, configuration, props );
+    }
+    
+    
+    // -----------------------------------------------------------------------
+    // Private Utility Methods 
+    // -----------------------------------------------------------------------
+
+    
+    private void checkDocument( Document document ) throws IOException
+    {
+        File outputFile = new File( workingDirectory, getName() + ".xml" );
+        log.debug( getName() + "(): outputing document to file: " + outputFile.getCanonicalPath() );
+        XmlUtils.writeDocument( document, outputFile, OutputFormat.createPrettyPrint() );
+        checkFile( getClass().getResource( getName() + ".xml" ), outputFile );
+    }
+    
+    
+    private void checkFile( URL expected, File generated ) throws IOException
+    {
+        InputStream generatedIn = new FileInputStream( generated );
+        InputStream expectedIn = expected.openStream();
+        while ( generatedIn.available() > 0 )
+        {
+            int generatedByte = generatedIn.read();
+            int expectedByte = expectedIn.read();
+            assertEquals( generatedByte, expectedByte );
+        }
+        expectedIn.close();
+        generatedIn.close();
+        log.debug( "generated output " + generated.getCanonicalPath() + " == expected output " + expected.toString() );
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/WebappConfigurationTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/WebappConfigurationTest.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/WebappConfigurationTest.java (added)
+++ directory/trunks/triplesec/configuration-io/src/test/java/org/safehaus/triplesec/configuration/WebappConfigurationTest.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,152 @@
+/*
+ *  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.configuration;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.commons.io.FileUtils;
+import org.dom4j.Document;
+import org.dom4j.io.OutputFormat;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests the ServerXmlUtils class.
+ * 
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class WebappConfigurationTest extends TestCase
+{
+    private static final Logger log = LoggerFactory.getLogger( WebappConfigurationTest.class );
+    private File workingDirectory = null;
+
+    
+    public void setUp() throws Exception
+    {
+        String wkdirProp = System.getProperty( "workingDirectory" );
+        log.debug( "workingDirectory system property = " + wkdirProp );
+        if ( wkdirProp == null || wkdirProp.equals( "" ) )
+        {
+            wkdirProp = System.getProperty( "java.io.tmpdir" ) + File.separator + "target";
+        }
+        
+        workingDirectory = new File( wkdirProp );
+        if ( workingDirectory.exists() )
+        {
+            log.debug( "deleteing workingDirectory = " + workingDirectory );
+            FileUtils.forceDelete( workingDirectory );
+        }
+
+        log.debug( "creating workingDirectory = " + workingDirectory );
+        workingDirectory.mkdirs();
+        super.setUp();
+    }
+    
+    
+    public void tearDown() throws Exception
+    {
+        workingDirectory = null;
+        super.tearDown();
+    }
+    
+    
+    public void testSetInitParameterValue() throws Exception
+    {
+        Document initial = XmlUtils.readDocument( WebappConfigurationTest.class.getResource( getName() 
+            + "Initial.xml" ) );
+        WebappConfiguration config = new WebappConfiguration( initial );
+        FilterConfiguration activation = config.getFilterConfiguration( "activation" );
+        activation.setInitParameterValue( "smtpSubject", "blah blah bork bork" );
+        checkDocument( initial );
+    }
+    
+    
+    public void testAddInitParameterValue() throws Exception
+    {
+        Document initial = XmlUtils.readDocument( WebappConfigurationTest.class.getResource( getName() 
+            + "Initial.xml" ) );
+        WebappConfiguration config = new WebappConfiguration( initial );
+        FilterConfiguration activation = config.getFilterConfiguration( "activation" );
+        activation.addInitParameter( "newInitParameter", "testing123" );
+        checkDocument( initial );
+    }
+    
+    
+    public void testSetServletInitParameterValue() throws Exception
+    {
+        Document initial = XmlUtils.readDocument( WebappConfigurationTest.class.getResource( getName() 
+            + "Initial.xml" ) );
+        WebappConfiguration config = new WebappConfiguration( initial );
+        ServletConfiguration servlet = config.getServletConfiguration( "TripleSecConfigApplication" );
+        servlet.setInitParameterValue( "applicationClassName", "blah blah bork bork" );
+        checkDocument( initial );
+    }
+    
+    
+    public void testAddServletInitParameterValue() throws Exception
+    {
+        Document initial = XmlUtils.readDocument( WebappConfigurationTest.class.getResource( getName() 
+            + "Initial.xml" ) );
+        WebappConfiguration config = new WebappConfiguration( initial );
+        ServletConfiguration servlet = config.getServletConfiguration( "TripleSecConfigApplication" );
+        servlet.addInitParameter( "newInitParameter", "testing123" );
+        checkDocument( initial );
+    }
+    
+    
+    // -----------------------------------------------------------------------
+    // Private Utility Methods 
+    // -----------------------------------------------------------------------
+
+    
+    private void checkDocument( Document document ) throws IOException
+    {
+        File outputFile = new File( workingDirectory, getName() + ".xml" );
+        log.debug( getName() + "(): outputing document to file: " + outputFile.getCanonicalPath() );
+        XmlUtils.writeDocument( document, outputFile, OutputFormat.createPrettyPrint() );
+        checkFile( getClass().getResource( getName() + ".xml" ), outputFile );
+    }
+    
+    
+    private void checkFile( URL expected, File generated ) throws IOException
+    {
+        InputStream generatedIn = new FileInputStream( generated );
+        InputStream expectedIn = expected.openStream();
+        while ( generatedIn.available() > 0 )
+        {
+            int generatedByte = generatedIn.read();
+            int expectedByte = expectedIn.read();
+            assertEquals( generatedByte, expectedByte );
+        }
+        expectedIn.close();
+        generatedIn.close();
+        log.debug( "generated output " + generated.getCanonicalPath() + " == expected output " + expected.toString() );
+    }
+}

Added: directory/trunks/triplesec/configuration-io/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/log4j.properties?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/log4j.properties (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/log4j.properties Tue Dec 12 07:23:31 2006
@@ -0,0 +1,6 @@
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment0.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment0.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment0.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment0.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+  <bean id="environment" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+    <property name="properties">
+      <props/>
+    </property>
+  </bean>
+</beans>

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment1.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment1.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment1.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddEnvironment1.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+  <bean id="environment" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+    <property name="properties">
+      <props>
+        <prop key="property1key">property1value</prop>
+      </props>
+    </property>
+  </bean>
+</beans>

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValue.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValue.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValue.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValue.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
+  <filter> 
+    <filter-name>activation</filter-name>  
+    <filter-class>org.safehaus.triplesec.activation.ActivateAccountFilter</filter-class>  
+    <init-param> 
+      <param-name>PROVIDER_URL</param-name>  
+      <param-value>ldap://localhost:10389/ou=users,dc=example,dc=com</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>SECURITY_PRINCIPAL</param-name>  
+      <param-value>uid=admin,ou=system</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>SECURITY_CREDENTIALS</param-name>  
+      <param-value>secret</param-value> 
+    </init-param>  
+    <!-- sms and smtp configuration -->  
+    <init-param> 
+      <param-name>smtpHost</param-name>  
+      <param-value>hertz</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smtpSubject</param-name>  
+      <param-value>Triplesec account activated</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smtpFrom</param-name>  
+      <param-value>dev@safehaus.org</param-value> 
+    </init-param>  
+    <!-- 
+      <init-param>
+          <param-name>smtpUsername</param-name>
+          <param-value>tsec</param-value>
+      </init-param>
+      <init-param>
+          <param-name>smtpPassword</param-name>
+          <param-value>secret</param-value>
+      </init-param>
+       -->  
+    <init-param> 
+      <param-name>smsUsername</param-name>  
+      <param-value>hauskeys</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsPassword</param-name>  
+      <param-value>*****</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsAccount</param-name>  
+      <param-value>demo</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsNmsiHttpUrl</param-name>  
+      <param-value>http://www.nbroadcasting.com/customers/messages/Sender.asp</param-value> 
+    </init-param>  
+    <!-- optional parameter overrides -->  
+    <!-- Uncomment this to make the activation filter generate an error message instead -->  
+    <!-- of generating a decoy midlet for requests with unknown activation keys.  This  -->  
+    <!-- is done by default to prevent trolling applications/bots from being successful.-->  
+    <init-param> 
+      <param-name>doDecoyMidlet</param-name>  
+      <param-value>false</param-value> 
+    </init-param>  
+    <!-- Uncomment this to override the default length of the OTP values generated by   -->  
+    <!-- the midlet produced: 6 by default.  In the future there a per account attrib   -->  
+    <!-- can be used instead of this default value for account specific behavoir.       -->  
+    <!-- 
+      <init-param>
+        <param-name>otpLength</param-name>
+        <param-value>8</param-value>
+      </init-param>
+      -->  
+    <!-- Uncomment this to have the filter use an attribute within the user's entry to  -->  
+    <!-- get the name of the midlet for the user.  The first value of this attribute is -->  
+    <!-- used to set the name of the midlet suite within the MANIFEST and the JAD files -->  
+    <!-- If not set this defaults to the krb5PrincipalRealm for the users account.      -->  
+    <!-- 
+      <init-param>
+        <param-name>midletNameAttribute</param-name>
+        <param-value>safehausMidletName</param-value>
+      </init-param>
+      -->  
+    <!-- Uncomment this to override cleanup time for sweeper; this will be deprecated   -->  
+    <!-- The default is 90000 milliseconds or 90 seconds                                -->  
+    <!-- 
+      <init-param>
+        <param-name>cleanupAfterMillis</param-name>
+        <param-value>120000</param-value>
+      </init-param>
+      -->  
+    <init-param>
+      <param-name>newInitParameter</param-name>
+      <param-value>testing123</param-value>
+    </init-param>
+  </filter>  
+  <filter-mapping> 
+    <filter-name>activation</filter-name>  
+    <url-pattern>/*</url-pattern> 
+  </filter-mapping> 
+</web-app>

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValueInitial.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValueInitial.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValueInitial.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddInitParameterValueInitial.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
+  <filter> 
+    <filter-name>activation</filter-name>  
+    <filter-class>org.safehaus.triplesec.activation.ActivateAccountFilter</filter-class>  
+    <init-param> 
+      <param-name>PROVIDER_URL</param-name>  
+      <param-value>ldap://localhost:10389/ou=users,dc=example,dc=com</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>SECURITY_PRINCIPAL</param-name>  
+      <param-value>uid=admin,ou=system</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>SECURITY_CREDENTIALS</param-name>  
+      <param-value>secret</param-value> 
+    </init-param>  
+    <!-- sms and smtp configuration -->  
+    <init-param> 
+      <param-name>smtpHost</param-name>  
+      <param-value>hertz</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smtpSubject</param-name>  
+      <param-value>Triplesec account activated</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smtpFrom</param-name>  
+      <param-value>dev@safehaus.org</param-value> 
+    </init-param>  
+    <!-- 
+      <init-param>
+          <param-name>smtpUsername</param-name>
+          <param-value>tsec</param-value>
+      </init-param>
+      <init-param>
+          <param-name>smtpPassword</param-name>
+          <param-value>secret</param-value>
+      </init-param>
+       -->  
+    <init-param> 
+      <param-name>smsUsername</param-name>  
+      <param-value>hauskeys</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsPassword</param-name>  
+      <param-value>*****</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsAccount</param-name>  
+      <param-value>demo</param-value> 
+    </init-param>  
+    <init-param> 
+      <param-name>smsNmsiHttpUrl</param-name>  
+      <param-value>http://www.nbroadcasting.com/customers/messages/Sender.asp</param-value> 
+    </init-param>  
+    <!-- optional parameter overrides -->  
+    <!-- Uncomment this to make the activation filter generate an error message instead -->  
+    <!-- of generating a decoy midlet for requests with unknown activation keys.  This  -->  
+    <!-- is done by default to prevent trolling applications/bots from being successful.-->  
+    <init-param> 
+      <param-name>doDecoyMidlet</param-name>  
+      <param-value>false</param-value> 
+    </init-param>  
+    <!-- Uncomment this to override the default length of the OTP values generated by   -->  
+    <!-- the midlet produced: 6 by default.  In the future there a per account attrib   -->  
+    <!-- can be used instead of this default value for account specific behavoir.       -->  
+    <!-- 
+      <init-param>
+        <param-name>otpLength</param-name>
+        <param-value>8</param-value>
+      </init-param>
+      -->  
+    <!-- Uncomment this to have the filter use an attribute within the user's entry to  -->  
+    <!-- get the name of the midlet for the user.  The first value of this attribute is -->  
+    <!-- used to set the name of the midlet suite within the MANIFEST and the JAD files -->  
+    <!-- If not set this defaults to the krb5PrincipalRealm for the users account.      -->  
+    <!-- 
+      <init-param>
+        <param-name>midletNameAttribute</param-name>
+        <param-value>safehausMidletName</param-value>
+      </init-param>
+      -->  
+    <!-- Uncomment this to override cleanup time for sweeper; this will be deprecated   -->  
+    <!-- The default is 90000 milliseconds or 90 seconds                                -->  
+    <!-- 
+      <init-param>
+        <param-name>cleanupAfterMillis</param-name>
+        <param-value>120000</param-value>
+      </init-param>
+      --> 
+  </filter>  
+  <filter-mapping> 
+    <filter-name>activation</filter-name>  
+    <url-pattern>/*</url-pattern> 
+  </filter-mapping> 
+</web-app>

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValue.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValue.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValue.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValue.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>Triplesec Configuration</display-name>
+  <servlet>
+    <servlet-name>TripleSecConfigApplication</servlet-name>
+    <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
+    <init-param>
+      <param-name>applicationClassName</param-name>
+      <param-value>org.safehaus.triplesec.configui.view.TripleSecConfigApplication</param-value>
+    </init-param>
+    <init-param>
+      <param-name>newInitParameter</param-name>
+      <param-value>testing123</param-value>
+    </init-param>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>TripleSecConfigApplication</servlet-name>
+    <url-pattern>/config/*</url-pattern>
+  </servlet-mapping>
+</web-app>

Added: directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValueInitial.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValueInitial.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValueInitial.xml (added)
+++ directory/trunks/triplesec/configuration-io/src/test/resources/org/safehaus/triplesec/configuration/testAddServletInitParameterValueInitial.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app
+      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+      "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>Triplesec Configuration</display-name>
+  <servlet>
+    <servlet-name>TripleSecConfigApplication</servlet-name>
+    <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
+    <init-param>
+      <param-name>applicationClassName</param-name>
+      <param-value>org.safehaus.triplesec.configui.view.TripleSecConfigApplication</param-value>
+    </init-param>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>TripleSecConfigApplication</servlet-name>
+    <url-pattern>/config/*</url-pattern>
+  </servlet-mapping>
+</web-app>