geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@apache.org>
Subject Re: LDAP Change
Date Sun, 28 Aug 2005 20:23:58 GMT
Ceki is a good guy...

On Aug 28, 2005, at 1:30 PM, Jeff Genender wrote:

> Ceki (the author) stepped up...I tried his new beta7 jar and it  
> works...the Sysouts are gone ;-)
>
> I'll see about getting these into the maven repo.
>
> Jeff
>
> Jeff Genender wrote:
>
>> Aaron Mulder wrote:
>>
>>>     I don't mind if we get the source, recompile that one class,  
>>> and then distribute the JAR ourselves as a Geronimo modified JAR.
>>>
>>>     Though for the benefit of those not on IRC, I submitted this  
>>> as bug #3 at SLF4J.
>>>
>>>     Jeff, if you know exactly where the output comes from, can  
>>> you either update the bug at SLF4J or tell me and I'll update it?
>>>
>> Its in the src/filtered-java/org/slf4j/LoggerFactory.java.  This  
>> class actually has several locations where they do a  
>> System.out.println.  All of those should be removed as they are  
>> especially not appropriate for a logger facade.
>> It looks like Ceki (the author) has been receptive as he has  
>> alluded to the fact its fixed.  My only concern is he said "It  
>> spurred a number of refactorings in SLF4J code. I think the  
>> resulting code is both easier to understand and modify."  I hope  
>> he didn't change the API, but only removed the  
>> System.out.println.  At worst case, yes, I can pull in his source  
>> as its only a handful of classes and remove the Sysouts myself.
>> Jeff
>>
>>>
>>> Thanks,
>>>     Aaron
>>>
>>> On Sat, 27 Aug 2005, Jeff Genender wrote:
>>>
>>>
>>>> We'll have to get a little creative here...thats deep in the  
>>>> SLF4J.  We may need to AOP it or override it with package  
>>>> visibility.  I'll find a solution.
>>>>
>>>> Jeff
>>>>
>>>> Aaron Mulder wrote:
>>>>
>>>>
>>>>>     Also, the progress bar is interrupted by the following output:
>>>>>
>>>>> SLF4J built for org.slf4j.impl.SimpleLoggerFA
>>>>>
>>>>>     We need to find a way to disable that.
>>>>>
>>>>> Aaron
>>>>>
>>>>> On Sat, 27 Aug 2005, Aaron Mulder wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Jeff,
>>>>>>     This looks like a neat change, but there are several  
>>>>>> things that
>>>>>> need to be done.  It introduces a hardcoded port number.   
>>>>>> Further, the
>>>>>> port is not marked as manageable.  And finally, it doesn't  
>>>>>> list itself in
>>>>>> the progress bar port list.  Please:
>>>>>>
>>>>>> - replace the 1389 with a substitution variable in the plan
>>>>>>
>>>>>> - add the variable to assembly/maven.xml (line 255 or so)
>>>>>>
>>>>>> - mark the port property as manageable (add ", true" to the  
>>>>>> end of
>>>>>>  the info builder addAttribute call)
>>>>>>
>>>>>> - add an attribute of type InetSocketAddress, returning a host  
>>>>>> of  "0.0.0.0" and the proper port, for now.
>>>>>>
>>>>>> - add a block on this GBean to assembly/src/var/config/ 
>>>>>> config.xml  including the substitution variable
>>>>>>
>>>>>>     Also, I'll want to see if we can add a listen host  
>>>>>> attribute and add the configurable properties to the installer.
>>>>>>
>>>>>> Thanks,
>>>>>>     Aaron
>>>>>>
>>>>>> On Sat, 27 Aug 2005 jgenender@apache.org wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Author: jgenender
>>>>>>> Date: Sat Aug 27 16:56:19 2005
>>>>>>> New Revision: 247522
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewcvs?rev=247522&view=rev
>>>>>>> Log:
>>>>>>> New addition - Apache Directory Server
>>>>>>>
>>>>>>> Added:
>>>>>>>   geronimo/trunk/modules/assembly/src/plan/directory-server- 
>>>>>>> plan.xml
>>>>>>>   geronimo/trunk/modules/directory/
>>>>>>>   geronimo/trunk/modules/directory/maven.xml
>>>>>>>   geronimo/trunk/modules/directory/project.properties
>>>>>>>   geronimo/trunk/modules/directory/project.xml
>>>>>>>   geronimo/trunk/modules/directory/src/
>>>>>>>   geronimo/trunk/modules/directory/src/java/
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/geronimo/
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/DirectoryGBean.java
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/MutableServerStartupConfiguration.java
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerContextFactory.java
>>>>>>>   geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerStartupConfiguration.java
>>>>>>>   geronimo/trunk/modules/directory/src/test/
>>>>>>>   geronimo/trunk/modules/directory/src/test/org/
>>>>>>>   geronimo/trunk/modules/directory/src/test/org/apache/
>>>>>>>   geronimo/trunk/modules/directory/src/test/org/apache/geronimo/
>>>>>>>   geronimo/trunk/modules/directory/src/test/org/apache/ 
>>>>>>> geronimo/directory/
>>>>>>>   geronimo/trunk/modules/directory/src/test/org/apache/ 
>>>>>>> geronimo/directory/RunningTest.java
>>>>>>> Modified:
>>>>>>>   geronimo/trunk/modules/assembly/maven.xml
>>>>>>>   geronimo/trunk/modules/assembly/project.xml
>>>>>>>
>>>>>>> Modified: geronimo/trunk/modules/assembly/maven.xml
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> assembly/maven.xml?rev=247522&r1=247521&r2=247522&view=diff
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/assembly/maven.xml (original)
>>>>>>> +++ geronimo/trunk/modules/assembly/maven.xml Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -181,6 +181,9 @@
>>>>>>>            <ant:fileset dir="src/var"/>
>>>>>>>        </ant:copy>
>>>>>>>
>>>>>>> +        <!-- For LDAP -->
>>>>>>> +        <ant:mkdir dir="${distDir}/var/ldap"/>
>>>>>>> +
>>>>>>>        <j:if test="${context.getVariable 
>>>>>>> ('geronimo.web.container').equals('tomcat')}">
>>>>>>>            <ant:copy todir="${distDir}/var/catalina/conf"  
>>>>>>> file="${project.root}/modules/tomcat/src/var/web.xml"/>
>>>>>>>            <ant:copy todir="${distDir}/var/catalina/ROOT">
>>>>>>> @@ -513,6 +516,18 @@
>>>>>>>                <ant:arg value="manager"/>
>>>>>>>                <ant:arg value="distribute"/>
>>>>>>>                <ant:arg value="target/plan/j2ee-client- 
>>>>>>> plan.xml"/>
>>>>>>> +            </ant:java>
>>>>>>> +
>>>>>>> +            <!-- build the directory server configuration -->
>>>>>>> +            <ant:echo>Building directory server  
>>>>>>> configuration</ant:echo>
>>>>>>> +            <ant:java fork="true" jar="${distDir}/bin/ 
>>>>>>> deployer.jar" failonerror="true">
>>>>>>> +                <ant:jvmarg value="-ea"/>
>>>>>>> +                <ant:arg value="--user"/>
>>>>>>> +                <ant:arg value="system"/>
>>>>>>> +                <ant:arg value="--password"/>
>>>>>>> +                <ant:arg value="manager"/>
>>>>>>> +                <ant:arg value="distribute"/>
>>>>>>> +                <ant:arg value="target/plan/directory-server- 
>>>>>>> plan.xml"/>
>>>>>>>            </ant:java>
>>>>>>>
>>>>>>>            <!-- build the Demo configuration -->
>>>>>>>
>>>>>>> Modified: geronimo/trunk/modules/assembly/project.xml
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> assembly/project.xml?rev=247522&r1=247521&r2=247522&view=diff
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/assembly/project.xml (original)
>>>>>>> +++ geronimo/trunk/modules/assembly/project.xml Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -205,6 +205,15 @@
>>>>>>>        </dependency>
>>>>>>>
>>>>>>>        <dependency>
>>>>>>> +            <groupId>geronimo</groupId>
>>>>>>> +            <artifactId>geronimo-directory</artifactId>
>>>>>>> +            <version>${pom.currentVersion}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>>            <groupId>geronimo-spec</groupId>
>>>>>>>            <artifactId>geronimo-spec-corba</artifactId>
>>>>>>>            <version>${geronimo_spec_corba_version}</version>
>>>>>>> @@ -1095,6 +1104,144 @@
>>>>>>>                 <repository>true</repository>
>>>>>>>             </properties>
>>>>>>>         </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory</groupId>
>>>>>>> +            <artifactId>apacheds-core</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory</groupId>
>>>>>>> +            <artifactId>apacheds-shared</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-codec</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>apache-ldapber-provider</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-ber</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-der</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>org.slf4j</groupId>
>>>>>>> +            <artifactId>slf4j-simple</artifactId>
>>>>>>> +            <version>${slf4j_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>ldap-common</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>kerberos-common</artifactId>
>>>>>>> +            <version>${kerberos_common_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-network</groupId>
>>>>>>> +            <artifactId>mina</artifactId>
>>>>>>> +            <version>${mina_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-protocols</groupId>
>>>>>>> +            <artifactId>kerberos-protocol</artifactId>
>>>>>>> +            <version>${kerberos_protocols_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-protocols</groupId>
>>>>>>> +            <artifactId>ldap-protocol</artifactId>
>>>>>>> +            <version>${ldap_protocols_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>jdbm</groupId>
>>>>>>> +            <artifactId>jdbm</artifactId>
>>>>>>> +            <version>${jdbm_version}</version>
>>>>>>> +            <url>http://jdbm.sourceforge.net</url>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-lang</groupId>
>>>>>>> +            <artifactId>commons-lang</artifactId>
>>>>>>> +            <version>${commons_lang_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/lang/api</ 
>>>>>>> url>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-io</groupId>
>>>>>>> +            <artifactId>commons-io</artifactId>
>>>>>>> +            <version>${commons_io_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/io</url>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>>
>>>>>>>        <dependency>
>>>>>>>            <groupId>axis</groupId>
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/assembly/src/plan/directory- 
>>>>>>> server-plan.xml
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> assembly/src/plan/directory-server-plan.xml?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/assembly/src/plan/directory-server- 
>>>>>>> plan.xml (added)
>>>>>>> +++ geronimo/trunk/modules/assembly/src/plan/directory-server- 
>>>>>>> plan.xml Sat Aug 27 16:56:19 2005
>>>>>>> @@ -0,0 +1,112 @@
>>>>>>> +<?xml version="1.0" encoding="UTF-8"?>
>>>>>>> +<!--
>>>>>>> +
>>>>>>> +    Copyright 2004 The Apache Software Foundation
>>>>>>> +
>>>>>>> +    Licensed 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.
>>>>>>> +-->
>>>>>>> +
>>>>>>> +<!-- $Rev: 239926 $ $Date: 2005-08-24 15:05:38 -0600 (Wed,  
>>>>>>> 24 Aug 2005) $ -->
>>>>>>> +
>>>>>>> +<!--
>>>>>>> +Configuration for the main ring of a Geronimo server.
>>>>>>> +
>>>>>>> +This configuration should contain those services normally  
>>>>>>> provided
>>>>>>> +by the server.
>>>>>>> +-->
>>>>>>> +<configuration
>>>>>>> +    xmlns="http://geronimo.apache.org/xml/ns/deployment"
>>>>>>> +    configId="org/apache/geronimo/Directory"
>>>>>>> +    parentId="org/apache/geronimo/Server"
>>>>>>> +    >
>>>>>>> +
>>>>>>> +    <dependency>
>>>>>>> +        <uri>antlr/jars/antlr-${antlr_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +
>>>>>>> +    <!-- required for rar 1.5 to load realms -->
>>>>>>> +    <dependency>
>>>>>>> +        <uri>regexp/jars/regexp-${regexp_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +
>>>>>>> +    <!-- Directory -->
>>>>>>> +    <dependency>
>>>>>>> +        <uri>geronimo/jars/geronimo-directory-$ 
>>>>>>> {geronimo_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>org.slf4j/jars/slf4j-simple-$ 
>>>>>>> {slf4j_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory/jars/apacheds-core-$ 
>>>>>>> {apacheds_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory/jars/apacheds-shared-$ 
>>>>>>> {apacheds_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-protocols/jars/ldap-protocol-$ 
>>>>>>> {ldap_protocols_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-protocols/jars/kerberos-protocol-$ 
>>>>>>> {kerberos_protocols_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-network/jars/mina-$ 
>>>>>>> {mina_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-asn1/jars/asn1-ber-$ 
>>>>>>> {asn1_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-asn1/jars/asn1-codec-$ 
>>>>>>> {asn1_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-asn1/jars/asn1-der-$ 
>>>>>>> {asn1_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-shared/jars/apache-ldapber-provider-$ 
>>>>>>> {apacheds_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-shared/jars/kerberos-common-$ 
>>>>>>> {kerberos_common_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>directory-shared/jars/ldap-common-$ 
>>>>>>> {apacheds_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>commons-io/jars/commons-io-$ 
>>>>>>> {commons_io_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>commons-primitives/jars/commons-primitives-$ 
>>>>>>> {commons_primitives_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>commons-collections/jars/commons-collections-$ 
>>>>>>> {commons_collections_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>commons-lang/jars/commons-lang-$ 
>>>>>>> {commons_lang_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>oro/jars/oro-${oro_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +    <dependency>
>>>>>>> +        <uri>jdbm/jars/jdbm-${jdbm_version}.jar</uri>
>>>>>>> +    </dependency>
>>>>>>> +
>>>>>>> +    <gbean  
>>>>>>> gbeanName="geronimo.server:type=Server,name=Directory"  
>>>>>>> class="org.apache.geronimo.directory.DirectoryGBean">
>>>>>>> +        <attribute name="providerURL">ou=system</attribute>
>>>>>>> +        <attribute name="securityAuthentication">simple</ 
>>>>>>> attribute>
>>>>>>> +        <attribute  
>>>>>>> name="securityPrincipal">uid=admin,ou=system</attribute>
>>>>>>> +        <attribute name="securityCredentials">secret</ 
>>>>>>> attribute>
>>>>>>> +        <attribute name="anonymousAccess">true</attribute>
>>>>>>> +        <attribute name="enableNetworking">true</attribute>
>>>>>>> +        <attribute name="ldapPort">1389</attribute>
>>>>>>> +        <reference name="ServerInfo"><module>org/apache/ 
>>>>>>> geronimo/System</module><name>ServerInfo</name></reference>
>>>>>>> +    </gbean>
>>>>>>> +
>>>>>>> +</configuration>
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/maven.xml
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/maven.xml?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/maven.xml (added)
>>>>>>> +++ geronimo/trunk/modules/directory/maven.xml Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -0,0 +1,48 @@
>>>>>>> +<?xml version="1.0" encoding="ISO-8859-1"?>
>>>>>>> +<!--
>>>>>>> +
>>>>>>> +    Copyright 2004 The Apache Software Foundation
>>>>>>> +
>>>>>>> +    Licensed 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.
>>>>>>> +-->
>>>>>>> +
>>>>>>> +<!-- $Rev: 219424 $ $Date: 2005-07-17 17:19:16 -0600 (Sun,  
>>>>>>> 17 Jul 2005) $ -->
>>>>>>> +
>>>>>>> +<project default="default"
>>>>>>> +    xmlns:j="jelly:core"
>>>>>>> +    xmlns:define="jelly:define"
>>>>>>> +    xmlns:velocity="jelly:velocity">
>>>>>>> +
>>>>>>> +    <!-- ==================== -->
>>>>>>> +    <!-- Default Global Goals -->
>>>>>>> +    <!-- ==================== -->
>>>>>>> +
>>>>>>> +    <goal name="default">
>>>>>>> +        <attainGoal name="build"/>
>>>>>>> +    </goal>
>>>>>>> +
>>>>>>> +    <goal name="build">
>>>>>>> +        <attainGoal name="jar:install"/>
>>>>>>> +    </goal>
>>>>>>> +
>>>>>>> +    <goal name="rebuild">
>>>>>>> +        <attainGoal name="clean"/>
>>>>>>> +        <attainGoal name="build"/>
>>>>>>> +    </goal>
>>>>>>> +
>>>>>>> +    <preGoal name="test:test">
>>>>>>> +        <mkdir dir="${maven.build.dir}/var"/>
>>>>>>> +        <mkdir dir="${maven.build.dir}/var/ldap"/>
>>>>>>> +    </preGoal>
>>>>>>> +
>>>>>>> +</project>
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/project.properties
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/project.properties?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/project.properties (added)
>>>>>>> +++ geronimo/trunk/modules/directory/project.properties Sat  
>>>>>>> Aug 27 16:56:19 2005
>>>>>>> @@ -0,0 +1,6 @@
>>>>>>> +##
>>>>>>> +## $Rev: 219424 $ $Date: 2005-07-17 17:19:16 -0600 (Sun, 17  
>>>>>>> Jul 2005) $
>>>>>>> +##
>>>>>>> +
>>>>>>> +maven.junit.jvmargs=-Djava.endorsed.dirs=${maven.build.dir}/ 
>>>>>>> endorsed -ea +maven.junit.fork=true
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/project.xml
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/project.xml?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/project.xml (added)
>>>>>>> +++ geronimo/trunk/modules/directory/project.xml Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -0,0 +1,230 @@
>>>>>>> +<?xml version="1.0" encoding="UTF-8"?>
>>>>>>> +<!--
>>>>>>> +
>>>>>>> +Copyright 2003-2004 The Apache Software Foundation
>>>>>>> +
>>>>>>> +Licensed 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.
>>>>>>> +-->
>>>>>>> +
>>>>>>> +<!-- $Rev: 233346 $ $Date: 2005-08-18 12:08:26 -0600 (Thu,  
>>>>>>> 18 Aug 2005) $ -->
>>>>>>> +
>>>>>>> +<project>
>>>>>>> +    <pomVersion>3</pomVersion>
>>>>>>> +    <extend>../../etc/project.xml</extend>
>>>>>>> +
>>>>>>> +    <!-- ===================== -->
>>>>>>> +    <!-- Module Identification -->
>>>>>>> +    <!-- ===================== -->
>>>>>>> +
>>>>>>> +    <name>Geronimo :: Directory</name>
>>>>>>> +    <id>geronimo-directory</id>
>>>>>>> +    <shortDescription>Geronimo Directory</shortDescription>
>>>>>>> +    <description>Geronimo Directory integration</description>
>>>>>>> +    <url>http://geronimo.apache.org/modules/directory</url>
>>>>>>> +    <siteDirectory>/www/geronimo.apache.org/modules/ 
>>>>>>> directory</siteDirectory>
>>>>>>> +    <distributionDirectory>/www/www.apache.org/projects/ 
>>>>>>> geronimo/builds/directory</distributionDirectory>
>>>>>>> +
>>>>>>> +    <package>org.apache.geronimo.directory</package>
>>>>>>> +
>>>>>>> +    <!-- ============ -->
>>>>>>> +    <!-- Dependencies -->
>>>>>>> +    <!-- ============ -->
>>>>>>> +
>>>>>>> +    <dependencies>
>>>>>>> +        <!-- temporary solution until appropriate xmlbeans  
>>>>>>> code is ready -->
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>cglib</groupId>
>>>>>>> +            <artifactId>cglib-nodep</artifactId>
>>>>>>> +            <version>${cglib_version}</version>
>>>>>>> +            <url>http://cglib.sf.net/</url>
>>>>>>> +        </dependency>
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>concurrent</groupId>
>>>>>>> +            <artifactId>concurrent</artifactId>
>>>>>>> +            <version>${concurrent_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <!-- Used for preprocessing our plans -->
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-jelly</groupId>
>>>>>>> +            <artifactId>commons-jelly-tags-velocity</ 
>>>>>>> artifactId>
>>>>>>> +            <version>${jelly_velocity_tags_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +        <dependency>
>>>>>>> +            <groupId> velocity</groupId>
>>>>>>> +            <artifactId>velocity</artifactId>
>>>>>>> +            <version>${velocity_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>geronimo</groupId>
>>>>>>> +            <artifactId>geronimo-common</artifactId>
>>>>>>> +            <version>${pom.currentVersion}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>geronimo</groupId>
>>>>>>> +            <artifactId>geronimo-kernel</artifactId>
>>>>>>> +            <version>${pom.currentVersion}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>geronimo</groupId>
>>>>>>> +            <artifactId>geronimo-system</artifactId>
>>>>>>> +            <version>${pom.currentVersion}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory</groupId>
>>>>>>> +            <artifactId>apacheds-core</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory</groupId>
>>>>>>> +            <artifactId>apacheds-shared</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-codec</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>apache-ldapber-provider</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-ber</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-asn1</groupId>
>>>>>>> +            <artifactId>asn1-der</artifactId>
>>>>>>> +            <version>${asn1_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>jdbm</groupId>
>>>>>>> +            <artifactId>jdbm</artifactId>
>>>>>>> +            <version>${jdbm_version}</version>
>>>>>>> +            <url>http://jdbm.sourceforge.net</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>regexp</groupId>
>>>>>>> +            <artifactId>regexp</artifactId>
>>>>>>> +            <version>${regexp_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/regexp/ 
>>>>>>> index.html</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>oro</groupId>
>>>>>>> +            <artifactId>oro</artifactId>
>>>>>>> +            <version>${oro_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/oro</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-lang</groupId>
>>>>>>> +            <artifactId>commons-lang</artifactId>
>>>>>>> +            <version>${commons_lang_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/lang/api</ 
>>>>>>> url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-collections</groupId>
>>>>>>> +            <artifactId>commons-collections</artifactId>
>>>>>>> +            <version>${commons_collections_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/ 
>>>>>>> collections</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-io</groupId>
>>>>>>> +            <artifactId>commons-io</artifactId>
>>>>>>> +            <version>${commons_io_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/io</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-primitives</groupId>
>>>>>>> +            <artifactId>commons-primitives</artifactId>
>>>>>>> +            <version>${commons_primitives_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/ 
>>>>>>> primitives</url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>ldap-common</artifactId>
>>>>>>> +            <version>${apacheds_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-shared</groupId>
>>>>>>> +            <artifactId>kerberos-common</artifactId>
>>>>>>> +            <version>${kerberos_common_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-network</groupId>
>>>>>>> +            <artifactId>mina</artifactId>
>>>>>>> +            <version>${mina_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-protocols</groupId>
>>>>>>> +            <artifactId>kerberos-protocol</artifactId>
>>>>>>> +            <version>${kerberos_protocols_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>directory-protocols</groupId>
>>>>>>> +            <artifactId>ldap-protocol</artifactId>
>>>>>>> +            <version>${ldap_protocols_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>antlr</groupId>
>>>>>>> +            <artifactId>antlr</artifactId>
>>>>>>> +            <version>${antlr_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>org.slf4j</groupId>
>>>>>>> +            <artifactId>slf4j-simple</artifactId>
>>>>>>> +            <version>${slf4j_version}</version>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>commons-logging</groupId>
>>>>>>> +            <artifactId>commons-logging</artifactId>
>>>>>>> +            <version>${commons_logging_version}</version>
>>>>>>> +            <url>http://jakarta.apache.org/commons/logging</ 
>>>>>>> url>
>>>>>>> +        </dependency>
>>>>>>> +
>>>>>>> +        <dependency>
>>>>>>> +            <groupId>mx4j</groupId>
>>>>>>> +            <artifactId>mx4j</artifactId>
>>>>>>> +            <version>${mx4j_version}</version>
>>>>>>> +            <properties>
>>>>>>> +                <repository>true</repository>
>>>>>>> +            </properties>
>>>>>>> +        </dependency>
>>>>>>> +    </dependencies>
>>>>>>> +</project>
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/DirectoryGBean.java
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/src/java/org/apache/geronimo/directory/ 
>>>>>>> DirectoryGBean.java?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/DirectoryGBean.java (added)
>>>>>>> +++ geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/DirectoryGBean.java Sat Aug 27 16:56:19 2005
>>>>>>> @@ -0,0 +1,220 @@
>>>>>>> +/**
>>>>>>> + *
>>>>>>> + * Copyright 2003-2004 The Apache Software Foundation
>>>>>>> + *
>>>>>>> + *  Licensed 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.apache.geronimo.directory;
>>>>>>> +
>>>>>>> +import java.util.Properties;
>>>>>>> +
>>>>>>> +import javax.naming.Context;
>>>>>>> +import javax.naming.directory.InitialDirContext;
>>>>>>> +
>>>>>>> +import org.apache.commons.logging.Log;
>>>>>>> +import org.apache.commons.logging.LogFactory;
>>>>>>> +import org.apache.geronimo.gbean.GBeanInfo;
>>>>>>> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
>>>>>>> +import org.apache.geronimo.gbean.GBeanLifecycle;
>>>>>>> +import org.apache.geronimo.system.serverinfo.ServerInfo;
>>>>>>> +import  
>>>>>>> org.apache.ldap.server.configuration.ShutdownConfiguration;
>>>>>>> +import org.apache.ldap.server.jndi.CoreContextFactory;
>>>>>>> +
>>>>>>> +/**
>>>>>>> + * Directory GBean
>>>>>>> + *
>>>>>>> + * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600  
>>>>>>> (Thu, 18 Aug 2005) $
>>>>>>> + */
>>>>>>> +public class DirectoryGBean implements GBeanLifecycle {
>>>>>>> +
>>>>>>> +    private static final Log log = LogFactory.getLog 
>>>>>>> (DirectoryGBean.class);
>>>>>>> +    +    private final ServerInfo serverInfo;
>>>>>>> +    private final String workingDir;
>>>>>>> +    private final boolean anonymousAccess;
>>>>>>> +    private String providerURL;
>>>>>>> +    private String securityPrincipal;
>>>>>>> +    private String securityCredentials;
>>>>>>> +    private String securityAuthentication;
>>>>>>> +    private int ldapPort = 389;
>>>>>>> +    private boolean enableNetworking;
>>>>>>> +    +    /**
>>>>>>> +     * Geronimo class loader
>>>>>>> +     **/
>>>>>>> +    private ClassLoader classLoader;
>>>>>>> +
>>>>>>> +    public DirectoryGBean(ClassLoader classLoader, String  
>>>>>>> workingDir, +            boolean anonymousAccess,  
>>>>>>> +            ServerInfo serverInfo) {
>>>>>>> +        +        if (serverInfo == null)
>>>>>>> +            throw new IllegalArgumentException("Must have a  
>>>>>>> ServerInfo value in initParams.");
>>>>>>> +        +        if (workingDir == null)
>>>>>>> +            this.workingDir = "var/ldap";
>>>>>>> +        else
>>>>>>> +            this.workingDir = workingDir;
>>>>>>> +        +        this.classLoader = classLoader;
>>>>>>> +        this.anonymousAccess = anonymousAccess;
>>>>>>> +        this.serverInfo = serverInfo;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public String getProviderURL() {
>>>>>>> +        return providerURL;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setProviderURL(String providerURL) {
>>>>>>> +        this.providerURL = providerURL;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public String getSecurityAuthentication() {
>>>>>>> +        return securityAuthentication;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setSecurityAuthentication(String  
>>>>>>> securityAuthentication) {
>>>>>>> +        this.securityAuthentication = securityAuthentication;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public String getSecurityCredentials() {
>>>>>>> +        return securityCredentials;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setSecurityCredentials(String  
>>>>>>> securityCredentials) {
>>>>>>> +        this.securityCredentials = securityCredentials;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public String getSecurityPrincipal() {
>>>>>>> +        return securityPrincipal;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setSecurityPrincipal(String  
>>>>>>> securityPrincipal) {
>>>>>>> +        this.securityPrincipal = securityPrincipal;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public boolean isEnableNetworking() {
>>>>>>> +        return enableNetworking;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setEnableNetworking(boolean enableNetworking) {
>>>>>>> +        this.enableNetworking = enableNetworking;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public int getLdapPort() {
>>>>>>> +        return ldapPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setLdapPort(int ldapPort) {
>>>>>>> +        this.ldapPort = ldapPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void doFail() {
>>>>>>> +        log.info("Service failed");
>>>>>>> +        //Insert failure code here
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    private void setEnvironment(Properties env){
>>>>>>> +
>>>>>>> +        if (providerURL != null){
>>>>>>> +            env.put( Context.PROVIDER_URL, providerURL);
>>>>>>> +        }       +
>>>>>>> +        if (securityAuthentication != null){
>>>>>>> +            env.put( Context.SECURITY_AUTHENTICATION,  
>>>>>>> securityAuthentication);
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        if (securityPrincipal != null){
>>>>>>> +            env.put( Context.SECURITY_PRINCIPAL,  
>>>>>>> securityPrincipal);
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        if (securityCredentials != null){
>>>>>>> +            env.put( Context.SECURITY_CREDENTIALS,  
>>>>>>> securityCredentials);
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +    +    public void doStart() throws Exception {
>>>>>>> +        log.info("Starting LDAP Directory service");
>>>>>>> +        +        MutableServerStartupConfiguration startup =  
>>>>>>> new MutableServerStartupConfiguration();
>>>>>>> +        // put some mandatory JNDI properties here
>>>>>>> +        startup.setWorkingDirectory(serverInfo.resolve 
>>>>>>> (workingDir));
>>>>>>> +        startup.setAllowAnonymousAccess(anonymousAccess);
>>>>>>> +        startup.setLdapPort(ldapPort);
>>>>>>> +        startup.setEnableNetworking(enableNetworking);
>>>>>>> +        +        Properties env = new Properties();
>>>>>>> +        env.putAll(startup.toJndiEnvironment());
>>>>>>> +        env.put( Context.INITIAL_CONTEXT_FACTORY,  
>>>>>>> ServerContextFactory.class.getName());
>>>>>>> +        setEnvironment(env);
>>>>>>> +        +        //Load the proper class for th Context Loader
>>>>>>> +        ClassLoader oldCL = Thread.currentThread 
>>>>>>> ().getContextClassLoader();
>>>>>>> +        Thread.currentThread().setContextClassLoader 
>>>>>>> (classLoader);
>>>>>>> +        +        //Fire it up
>>>>>>> +        new InitialDirContext( env );
>>>>>>> +        +        //Set it back
>>>>>>> +        Thread.currentThread().setContextClassLoader(oldCL);
>>>>>>> +        log.info("LDAP Directory service started.");
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void doStop() throws Exception {
>>>>>>> +        log.info("Stopping LDAP Directory service");
>>>>>>> +        //Insert stopping code here
>>>>>>> +        Properties env = new Properties();
>>>>>>> +        env.putAll(new ShutdownConfiguration 
>>>>>>> ().toJndiEnvironment());
>>>>>>> +        env.put( Context.INITIAL_CONTEXT_FACTORY,  
>>>>>>> CoreContextFactory.class.getName() );
>>>>>>> +        setEnvironment(env);
>>>>>>> +        +        //Load the proper class for th Context Loader
>>>>>>> +        ClassLoader oldCL = Thread.currentThread 
>>>>>>> ().getContextClassLoader();
>>>>>>> +        Thread.currentThread().setContextClassLoader 
>>>>>>> (classLoader);
>>>>>>> +
>>>>>>> +        //Shut it down
>>>>>>> +        new InitialDirContext( env );
>>>>>>> +
>>>>>>> +        //Set it back
>>>>>>> +        Thread.currentThread().setContextClassLoader(oldCL);
>>>>>>> +
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public static final GBeanInfo GBEAN_INFO;
>>>>>>> +
>>>>>>> +    static {
>>>>>>> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder 
>>>>>>> ("DirectoryGBean",
>>>>>>> +                DirectoryGBean.class);
>>>>>>> +
>>>>>>> +        infoFactory.addAttribute("classLoader",  
>>>>>>> ClassLoader.class, false);
>>>>>>> +        infoFactory.addAttribute("providerURL",  
>>>>>>> String.class, true);
>>>>>>> +        infoFactory.addAttribute("securityAuthentication",  
>>>>>>> String.class, true);
>>>>>>> +        infoFactory.addAttribute("securityPrincipal",  
>>>>>>> String.class, true);
>>>>>>> +        infoFactory.addAttribute("securityCredentials",  
>>>>>>> String.class, true);
>>>>>>> +        infoFactory.addAttribute("ldapPort", int.class, true);
>>>>>>> +        infoFactory.addAttribute("enableNetworking",  
>>>>>>> boolean.class, true);
>>>>>>> +        +        infoFactory.addAttribute("workingDir",  
>>>>>>> String.class, true);
>>>>>>> +        infoFactory.addAttribute("anonymousAccess",  
>>>>>>> boolean.class, true);
>>>>>>> +        infoFactory.addReference("ServerInfo",  
>>>>>>> ServerInfo.class, "GBean");
>>>>>>> +
>>>>>>> +        infoFactory.setConstructor(new String[]  
>>>>>>> { "classLoader", "workingDir", "anonymousAccess",  
>>>>>>> "ServerInfo" });
>>>>>>> +        GBEAN_INFO = infoFactory.getBeanInfo();
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public static GBeanInfo getGBeanInfo() {
>>>>>>> +        return GBEAN_INFO;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +}
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/MutableServerStartupConfiguration.java
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/src/java/org/apache/geronimo/directory/ 
>>>>>>> MutableServerStartupConfiguration.java?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/MutableServerStartupConfiguration.java  
>>>>>>> (added)
>>>>>>> +++ geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/MutableServerStartupConfiguration.java Sat  
>>>>>>> Aug 27 16:56:19 2005
>>>>>>> @@ -0,0 +1,95 @@
>>>>>>> +/**
>>>>>>> + *
>>>>>>> + * Copyright 2003-2004 The Apache Software Foundation
>>>>>>> + *
>>>>>>> + *  Licensed 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.apache.geronimo.directory;
>>>>>>> +
>>>>>>> +import java.io.File;
>>>>>>> +import java.util.List;
>>>>>>> +import java.util.Set;
>>>>>>> +
>>>>>>> +import org.apache.mina.registry.ServiceRegistry;
>>>>>>> +
>>>>>>> +/**
>>>>>>> + * A mutable version of {@link ServerStartupConfiguration}.
>>>>>>> + *
>>>>>>> + * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600  
>>>>>>> (Thu, 18 Aug 2005) $
>>>>>>> + */
>>>>>>> +public class MutableServerStartupConfiguration extends
>>>>>>> +        ServerStartupConfiguration
>>>>>>> +{
>>>>>>> +    private static final long serialVersionUID =  
>>>>>>> 515104910980600099L;
>>>>>>> +
>>>>>>> +    public MutableServerStartupConfiguration()
>>>>>>> +    {
>>>>>>> +        super();
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setAllowAnonymousAccess( boolean arg0 )
>>>>>>> +    {
>>>>>>> +        super.setAllowAnonymousAccess( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setAuthenticatorConfigurations( Set arg0 )
>>>>>>> +    {
>>>>>>> +        super.setAuthenticatorConfigurations( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setBootstrapSchemas( Set arg0 )
>>>>>>> +    {
>>>>>>> +        super.setBootstrapSchemas( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setContextPartitionConfigurations( Set arg0 )
>>>>>>> +    {
>>>>>>> +        super.setContextPartitionConfigurations( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setInterceptorConfigurations( List arg0 )
>>>>>>> +    {
>>>>>>> +        super.setInterceptorConfigurations( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setTestEntries( List arg0 )
>>>>>>> +    {
>>>>>>> +        super.setTestEntries( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setWorkingDirectory( File arg0 )
>>>>>>> +    {
>>>>>>> +        super.setWorkingDirectory( arg0 );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setEnableKerberos( boolean enableKerberos )
>>>>>>> +    {
>>>>>>> +        super.setEnableKerberos( enableKerberos );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setLdapPort( int ldapPort )
>>>>>>> +    {
>>>>>>> +        super.setLdapPort( ldapPort );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setLdapsPort( int ldapsPort )
>>>>>>> +    {
>>>>>>> +        super.setLdapsPort( ldapsPort );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void setMinaServiceRegistry( ServiceRegistry  
>>>>>>> minaServiceRegistry )
>>>>>>> +    {
>>>>>>> +        super.setMinaServiceRegistry( minaServiceRegistry );
>>>>>>> +    }
>>>>>>> +}
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerContextFactory.java
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/src/java/org/apache/geronimo/directory/ 
>>>>>>> ServerContextFactory.java?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerContextFactory.java (added)
>>>>>>> +++ geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerContextFactory.java Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -0,0 +1,223 @@
>>>>>>> +/**
>>>>>>> + *
>>>>>>> + * Copyright 2003-2004 The Apache Software Foundation
>>>>>>> + *
>>>>>>> + *  Licensed 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.apache.geronimo.directory;
>>>>>>> +
>>>>>>> +import java.io.IOException;
>>>>>>> +import java.net.InetSocketAddress;
>>>>>>> +import java.util.Hashtable;
>>>>>>> +import java.util.Iterator;
>>>>>>> +import java.util.Properties;
>>>>>>> +
>>>>>>> +import javax.naming.NamingException;
>>>>>>> +import javax.naming.Context;
>>>>>>> +import javax.naming.directory.DirContext;
>>>>>>> +import javax.naming.ldap.Control;
>>>>>>> +import javax.naming.ldap.InitialLdapContext;
>>>>>>> +import javax.naming.ldap.LdapContext;
>>>>>>> +
>>>>>>> +import org.apache.commons.logging.Log;
>>>>>>> +import org.apache.commons.logging.LogFactory;
>>>>>>> +import org.apache.kerberos.protocol.KerberosProtocolProvider;
>>>>>>> +import org.apache.kerberos.service.KdcConfiguration;
>>>>>>> +import org.apache.kerberos.store.JndiPrincipalStoreImpl;
>>>>>>> +import org.apache.kerberos.store.PrincipalStore;
>>>>>>> +import org.apache.kerberos.sam.SamSubsystem;
>>>>>>> +import  
>>>>>>> org.apache.ldap.common.exception.LdapConfigurationException;
>>>>>>> +import org.apache.ldap.common.name.LdapName;
>>>>>>> +import org.apache.ldap.common.util.PropertiesUtils;
>>>>>>> +import org.apache.ldap.common.util.NamespaceTools;
>>>>>>> +import org.apache.ldap.server.jndi.ContextFactoryService;
>>>>>>> +import org.apache.ldap.server.jndi.CoreContextFactory;
>>>>>>> +import org.apache.ldap.server.protocol.LdapProtocolProvider;
>>>>>>> +import org.apache.mina.common.TransportType;
>>>>>>> +import org.apache.mina.registry.Service;
>>>>>>> +import org.apache.mina.registry.ServiceRegistry;
>>>>>>> +
>>>>>>> +
>>>>>>> +/**
>>>>>>> + * Adds additional bootstrapping for server socket listeners  
>>>>>>> when firing
>>>>>>> + * up the server.
>>>>>>> + *
>>>>>>> + * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600  
>>>>>>> (Thu, 18 Aug 2005) $
>>>>>>> + * @see javax.naming.spi.InitialContextFactory
>>>>>>> + */
>>>>>>> +public class ServerContextFactory extends CoreContextFactory
>>>>>>> +{
>>>>>>> +    private static final Log log = LogFactory.getLog 
>>>>>>> (ServerContextFactory.class);
>>>>>>> +    private static Service ldapService;
>>>>>>> +    private static Service kerberosService;
>>>>>>> +    private static ServiceRegistry minaRegistry;
>>>>>>> +
>>>>>>> +    protected ServiceRegistry getMinaRegistry()
>>>>>>> +    {
>>>>>>> +        return minaRegistry;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    public void afterShutdown( ContextFactoryService service )
>>>>>>> +    {
>>>>>>> +        if ( minaRegistry != null )
>>>>>>> +        {
>>>>>>> +            if ( ldapService != null )
>>>>>>> +            {
>>>>>>> +                minaRegistry.unbind( ldapService );
>>>>>>> +                if ( log.isInfoEnabled() )
>>>>>>> +                {
>>>>>>> +                    log.info( "Unbind of LDAP Service  
>>>>>>> complete: " + ldapService );
>>>>>>> +                }
>>>>>>> +                ldapService = null;
>>>>>>> +            }
>>>>>>> +
>>>>>>> +            if ( kerberosService != null )
>>>>>>> +            {
>>>>>>> +                minaRegistry.unbind( kerberosService );
>>>>>>> +                if ( log.isInfoEnabled() )
>>>>>>> +                {
>>>>>>> +                    log.info( "Unbind of KRB5 Service  
>>>>>>> complete: " + kerberosService );
>>>>>>> +                }
>>>>>>> +                kerberosService = null;
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +    +    public void afterStartup( ContextFactoryService  
>>>>>>> service ) throws NamingException
>>>>>>> +    {
>>>>>>> +        ServerStartupConfiguration cfg =
>>>>>>> +            ( ServerStartupConfiguration )  
>>>>>>> service.getConfiguration().getStartupConfiguration();
>>>>>>> +        Hashtable env = service.getConfiguration 
>>>>>>> ().getEnvironment();
>>>>>>> +
>>>>>>> +        if ( cfg.isEnableNetworking() )
>>>>>>> +        {
>>>>>>> +            setupRegistry( cfg );
>>>>>>> +            startLdapProtocol( cfg, env );
>>>>>>> +
>>>>>>> +            if ( cfg.isEnableKerberos() )
>>>>>>> +            {
>>>>>>> +                startKerberosProtocol( env );
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Starts up the MINA registry so various protocol  
>>>>>>> providers can be started.
>>>>>>> +     */
>>>>>>> +    private void setupRegistry( ServerStartupConfiguration  
>>>>>>> cfg )
>>>>>>> +    {
>>>>>>> +        minaRegistry = cfg.getMinaServiceRegistry();
>>>>>>> +    }
>>>>>>> +
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Starts the Kerberos protocol provider which is backed  
>>>>>>> by the LDAP store.
>>>>>>> +     *
>>>>>>> +     * @throws NamingException if there are problems  
>>>>>>> starting up the Kerberos provider
>>>>>>> +     */
>>>>>>> +    private void startKerberosProtocol( Hashtable env )  
>>>>>>> throws NamingException
>>>>>>> +    {
>>>>>>> +        /*
>>>>>>> +         * Looks like KdcConfiguration takes properties and  
>>>>>>> we use Hashtable for JNDI
>>>>>>> +         * so I'm copying over the String based properties  
>>>>>>> into a new Properties obj.
>>>>>>> +         */
>>>>>>> +        Properties props = new Properties();
>>>>>>> +        Iterator list = env.keySet().iterator();
>>>>>>> +        while ( list.hasNext() )
>>>>>>> +        {
>>>>>>> +            String key = ( String ) list.next();
>>>>>>> +
>>>>>>> +            if ( env.get( key ) instanceof String )
>>>>>>> +            {
>>>>>>> +                props.setProperty( key, ( String ) env.get 
>>>>>>> ( key ) );
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        // construct the configuration, get the port, create  
>>>>>>> the service, and prepare kdc objects
>>>>>>> +        KdcConfiguration config = new KdcConfiguration 
>>>>>>> ( props );
>>>>>>> +        int port = PropertiesUtils.get( env,  
>>>>>>> KdcConfiguration.KERBEROS_PORT_KEY,  
>>>>>>> KdcConfiguration.DEFAULT_KERBEROS_PORT );
>>>>>>> +        Service service= new Service( "kerberos",  
>>>>>>> TransportType.DATAGRAM, new InetSocketAddress( port ) );
>>>>>>> +        LdapContext ctx = getBaseRealmContext( config, env );
>>>>>>> +        PrincipalStore store = new JndiPrincipalStoreImpl 
>>>>>>> ( ctx, new LdapName( "ou=Users" ) );
>>>>>>> +        SamSubsystem.getInstance().setUserContext 
>>>>>>> ( ( DirContext ) ctx, "ou=Users" );
>>>>>>> +
>>>>>>> +        try
>>>>>>> +        {
>>>>>>> +            minaRegistry.bind( service, new  
>>>>>>> KerberosProtocolProvider( config, store ) );
>>>>>>> +            kerberosService = service;
>>>>>>> +            if ( log.isInfoEnabled() )
>>>>>>> +            {
>>>>>>> +                log.info( "Successful bind of KRB5 Service  
>>>>>>> completed: " + kerberosService );
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +        catch ( IOException e )
>>>>>>> +        {
>>>>>>> +            log.error( "Could not start the kerberos service  
>>>>>>> on port " +
>>>>>>> +                    KdcConfiguration.DEFAULT_KERBEROS_PORT,  
>>>>>>> e );
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Maps a Kerberos Realm name to a position within the  
>>>>>>> DIT.  The primary realm of
>>>>>>> +     * the KDC will use this area for configuration and for  
>>>>>>> storing user entries.
>>>>>>> +     *
>>>>>>> +     * @param config the KDC's configuration
>>>>>>> +     * @param env the JNDI environment properties
>>>>>>> +     * @return the base context for the primary realm of the  
>>>>>>> KDC
>>>>>>> +     * @throws NamingException
>>>>>>> +     */
>>>>>>> +    private LdapContext getBaseRealmContext 
>>>>>>> ( KdcConfiguration config, Hashtable env ) throws  
>>>>>>> NamingException
>>>>>>> +    {
>>>>>>> +        Hashtable cloned = ( Hashtable ) env.clone();
>>>>>>> +        String dn = NamespaceTools.inferLdapName 
>>>>>>> ( config.getPrimaryRealm() );
>>>>>>> +        cloned.put( Context.PROVIDER_URL, dn );
>>>>>>> +
>>>>>>> +        if ( log.isInfoEnabled() )
>>>>>>> +        {
>>>>>>> +            log.info( "Getting initial context for realm  
>>>>>>> base at " + dn + " for " + config.getPrimaryRealm() );
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        return new InitialLdapContext( cloned, new Control[] 
>>>>>>> {} );
>>>>>>> +    }
>>>>>>> +
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Starts up the LDAP protocol provider to service LDAP  
>>>>>>> requests
>>>>>>> +     *
>>>>>>> +     * @throws NamingException if there are problems  
>>>>>>> starting the LDAP provider
>>>>>>> +     */
>>>>>>> +    private void startLdapProtocol 
>>>>>>> ( ServerStartupConfiguration cfg, Hashtable env ) throws  
>>>>>>> NamingException
>>>>>>> +    {
>>>>>>> +        int port = cfg.getLdapPort();
>>>>>>> +        Service service = new Service( "ldap",  
>>>>>>> TransportType.SOCKET, new InetSocketAddress( port ) );
>>>>>>> +
>>>>>>> +        try
>>>>>>> +        {
>>>>>>> +            minaRegistry.bind( service, new  
>>>>>>> LdapProtocolProvider( ( Hashtable ) env.clone() ) );
>>>>>>> +            ldapService = service;
>>>>>>> +            if ( log.isInfoEnabled() )
>>>>>>> +            {
>>>>>>> +                log.info( "Successful bind of LDAP Service  
>>>>>>> completed: " + ldapService );
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +        catch ( IOException e )
>>>>>>> +        {
>>>>>>> +            String msg = "Failed to bind the LDAP protocol  
>>>>>>> service to the service registry: " + service;
>>>>>>> +            LdapConfigurationException lce = new  
>>>>>>> LdapConfigurationException( msg );
>>>>>>> +            lce.setRootCause( e );
>>>>>>> +            log.error( msg, e );
>>>>>>> +            throw lce;
>>>>>>> +        }
>>>>>>> +    }
>>>>>>> +}
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerStartupConfiguration.java
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/src/java/org/apache/geronimo/directory/ 
>>>>>>> ServerStartupConfiguration.java?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerStartupConfiguration.java (added)
>>>>>>> +++ geronimo/trunk/modules/directory/src/java/org/apache/ 
>>>>>>> geronimo/directory/ServerStartupConfiguration.java Sat Aug 27  
>>>>>>> 16:56:19 2005
>>>>>>> @@ -0,0 +1,128 @@
>>>>>>> +/**
>>>>>>> + *
>>>>>>> + * Copyright 2003-2004 The Apache Software Foundation
>>>>>>> + *
>>>>>>> + *  Licensed 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.apache.geronimo.directory;
>>>>>>> +
>>>>>>> +import  
>>>>>>> org.apache.ldap.server.configuration.ConfigurationException;
>>>>>>> +import  
>>>>>>> org.apache.ldap.server.configuration.StartupConfiguration;
>>>>>>> +import org.apache.mina.registry.ServiceRegistry;
>>>>>>> +import org.apache.mina.registry.SimpleServiceRegistry;
>>>>>>> +
>>>>>>> +/**
>>>>>>> + * A {@link StartupConfiguration} that starts up ApacheDS  
>>>>>>> with network layer support.
>>>>>>> + *
>>>>>>> + * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600  
>>>>>>> (Thu, 18 Aug 2005) $
>>>>>>> + */
>>>>>>> +public class ServerStartupConfiguration extends  
>>>>>>> StartupConfiguration
>>>>>>> +{
>>>>>>> +    private static final long serialVersionUID =  
>>>>>>> -7138616822614155454L;
>>>>>>> +
>>>>>>> +    private boolean enableNetworking = true;
>>>>>>> +    private ServiceRegistry minaServiceRegistry = new  
>>>>>>> SimpleServiceRegistry();
>>>>>>> +    private int ldapPort = 389;
>>>>>>> +    private int ldapsPort = 636;
>>>>>>> +    private boolean enableKerberos;
>>>>>>> +
>>>>>>> +    protected ServerStartupConfiguration()
>>>>>>> +    {
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Returns <tt>true</tt> if networking (LDAP, LDAPS, and  
>>>>>>> Kerberos) is enabled.
>>>>>>> +     */
>>>>>>> +    public boolean isEnableNetworking()
>>>>>>> +    {
>>>>>>> +        return enableNetworking;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Sets whether to enable networking (LDAP, LDAPS, and  
>>>>>>> Kerberos) or not.
>>>>>>> +     */
>>>>>>> +    public void setEnableNetworking( boolean enableNetworking )
>>>>>>> +    {
>>>>>>> +        this.enableNetworking = enableNetworking;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Returns <tt>true</tt> if Kerberos support is enabled.
>>>>>>> +     */
>>>>>>> +    public boolean isEnableKerberos()
>>>>>>> +    {
>>>>>>> +        return enableKerberos;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Sets whether to enable Kerberos support or not.
>>>>>>> +     */
>>>>>>> +    protected void setEnableKerberos( boolean enableKerberos )
>>>>>>> +    {
>>>>>>> +        this.enableKerberos = enableKerberos;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Returns LDAP TCP/IP port number to listen to.
>>>>>>> +     */
>>>>>>> +    public int getLdapPort()
>>>>>>> +    {
>>>>>>> +        return ldapPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Sets LDAP TCP/IP port number to listen to.
>>>>>>> +     */
>>>>>>> +    protected void setLdapPort( int ldapPort )
>>>>>>> +    {
>>>>>>> +        this.ldapPort = ldapPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Returns LDAPS TCP/IP port number to listen to.
>>>>>>> +     */
>>>>>>> +    public int getLdapsPort()
>>>>>>> +    {
>>>>>>> +        return ldapsPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Sets LDAPS TCP/IP port number to listen to.
>>>>>>> +     */
>>>>>>> +    protected void setLdapsPort( int ldapsPort )
>>>>>>> +    {
>>>>>>> +        this.ldapsPort = ldapsPort;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Returns <a href="http://directory.apache.org/ 
>>>>>>> subprojects/network/">MINA</a>
>>>>>>> +     * {@link ServiceRegistry} that will be used by ApacheDS.
>>>>>>> +     */
>>>>>>> +    public ServiceRegistry getMinaServiceRegistry()
>>>>>>> +    {
>>>>>>> +        return minaServiceRegistry;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Sets <a href="http://directory.apache.org/subprojects/ 
>>>>>>> network/">MINA</a>
>>>>>>> +     * {@link ServiceRegistry} that will be used by ApacheDS.
>>>>>>> +     */
>>>>>>> +    protected void setMinaServiceRegistry( ServiceRegistry  
>>>>>>> minaServiceRegistry )
>>>>>>> +    {
>>>>>>> +        if( minaServiceRegistry == null )
>>>>>>> +        {
>>>>>>> +            throw new ConfigurationException 
>>>>>>> ( "MinaServiceRegistry cannot be null" );
>>>>>>> +        }
>>>>>>> +        this.minaServiceRegistry = minaServiceRegistry;
>>>>>>> +    }
>>>>>>> +}
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Added: geronimo/trunk/modules/directory/src/test/org/apache/ 
>>>>>>> geronimo/directory/RunningTest.java
>>>>>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>>>>>> directory/src/test/org/apache/geronimo/directory/ 
>>>>>>> RunningTest.java?rev=247522&view=auto
>>>>>>> ================================================================ 
>>>>>>> ==============
>>>>>>> --- geronimo/trunk/modules/directory/src/test/org/apache/ 
>>>>>>> geronimo/directory/RunningTest.java (added)
>>>>>>> +++ geronimo/trunk/modules/directory/src/test/org/apache/ 
>>>>>>> geronimo/directory/RunningTest.java Sat Aug 27 16:56:19 2005
>>>>>>> @@ -0,0 +1,132 @@
>>>>>>> +/**
>>>>>>> + *
>>>>>>> + * Copyright 2003-2004 The Apache Software Foundation
>>>>>>> + *
>>>>>>> + *  Licensed 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.apache.geronimo.directory;
>>>>>>> +
>>>>>>> +import java.util.HashSet;
>>>>>>> +import java.util.Hashtable;
>>>>>>> +
>>>>>>> +import javax.management.ObjectName;
>>>>>>> +import javax.naming.Context;
>>>>>>> +import javax.naming.NameClassPair;
>>>>>>> +import javax.naming.NamingEnumeration;
>>>>>>> +import javax.naming.directory.DirContext;
>>>>>>> +import javax.naming.directory.InitialDirContext;
>>>>>>> +
>>>>>>> +import junit.framework.TestCase;
>>>>>>> +
>>>>>>> +import org.apache.geronimo.gbean.GBeanData;
>>>>>>> +import org.apache.geronimo.kernel.Kernel;
>>>>>>> +import org.apache.geronimo.kernel.KernelFactory;
>>>>>>> +import org.apache.geronimo.system.serverinfo.BasicServerInfo;
>>>>>>> +
>>>>>>> +public class RunningTest extends TestCase {
>>>>>>> +
>>>>>>> +    private static final String PRINCIPAL =  
>>>>>>> "uid=admin,ou=system";
>>>>>>> +    private static final String CREDENTIALS = "secret";
>>>>>>> +    private ClassLoader cl = this.getClass().getClassLoader();
>>>>>>> +
>>>>>>> +    private Kernel kernel;
>>>>>>> +
>>>>>>> +    private ObjectName serverInfoName;
>>>>>>> +
>>>>>>> +    private GBeanData serverInfoGBean;
>>>>>>> +
>>>>>>> +    private ObjectName directoryName;
>>>>>>> +
>>>>>>> +    private GBeanData directoryGBean;
>>>>>>> +
>>>>>>> +    public void testRunning() throws Exception {
>>>>>>> +
>>>>>>> +        Hashtable env = new Hashtable();
>>>>>>> +        env.put(Context.PROVIDER_URL, "ldap://localhost:9389");
>>>>>>> +        env.put(Context.INITIAL_CONTEXT_FACTORY,
>>>>>>> +                "com.sun.jndi.ldap.LdapCtxFactory");
>>>>>>> +        //env.put( Context.SECURITY_AUTHENTICATION, "simple");
>>>>>>> +        env.put( Context.SECURITY_PRINCIPAL, PRINCIPAL);
>>>>>>> +        env.put( Context.SECURITY_CREDENTIALS, CREDENTIALS);
>>>>>>> +        DirContext ctx = new InitialDirContext(env);
>>>>>>> +
>>>>>>> +        // Perform search using URL
>>>>>>> +        // NamingEnumeration answer = ctx.search(
>>>>>>> +        // "ldap://localhost:389/ou=system", "(uid=admin)",  
>>>>>>> null);
>>>>>>> +        HashSet set = new HashSet();
>>>>>>> +
>>>>>>> +        NamingEnumeration list = ctx.list("ou=system");
>>>>>>> +
>>>>>>> +        while (list.hasMore()) {
>>>>>>> +            NameClassPair ncp = (NameClassPair) list.next();
>>>>>>> +            set.add(ncp.getName());
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        assertTrue(set.contains("uid=admin"));
>>>>>>> +        assertTrue( set.contains( "ou=users" ) );
>>>>>>> +        assertTrue( set.contains( "ou=groups" ) );
>>>>>>> +        assertTrue( set.contains( "ou=configuration" ) );
>>>>>>> +        assertTrue( set.contains 
>>>>>>> ( "prefNodeName=sysPrefRoot" ) );
>>>>>>> +
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    private void start(GBeanData instance) throws Exception {
>>>>>>> +        kernel.loadGBean(instance, cl);
>>>>>>> +        kernel.startGBean(instance.getName());
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    private void stop(ObjectName name) throws Exception {
>>>>>>> +        kernel.stopGBean(name);
>>>>>>> +        kernel.unloadGBean(name);
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    protected void setUp() throws Exception {
>>>>>>> +        super.setUp();
>>>>>>> +
>>>>>>> +        kernel = KernelFactory.newInstance().createKernel 
>>>>>>> ("test.kernel");
>>>>>>> +        kernel.boot();
>>>>>>> +
>>>>>>> +        // ServerInfo
>>>>>>> +        serverInfoName = new ObjectName 
>>>>>>> ("geronimo.system:role=ServerInfo");
>>>>>>> +        serverInfoGBean = new GBeanData(serverInfoName,
>>>>>>> +                BasicServerInfo.GBEAN_INFO);
>>>>>>> +        serverInfoGBean.setAttribute("baseDirectory", "./ 
>>>>>>> target");
>>>>>>> +        start(serverInfoGBean);
>>>>>>> +
>>>>>>> +        // DirectoryGBean
>>>>>>> +        directoryName = new ObjectName 
>>>>>>> ("geronimo.system:type=Directory");
>>>>>>> +        directoryGBean = new GBeanData(directoryName,  
>>>>>>> DirectoryGBean.GBEAN_INFO);
>>>>>>> +        directoryGBean.setReferencePattern("ServerInfo",  
>>>>>>> serverInfoName);
>>>>>>> +        directoryGBean.setAttribute("classLoader", cl);
>>>>>>> +        directoryGBean.setAttribute("providerURL",  
>>>>>>> "ou=system");
>>>>>>> +        directoryGBean.setAttribute 
>>>>>>> ("securityAuthentication", "simple");
>>>>>>> +        directoryGBean.setAttribute("securityPrincipal",  
>>>>>>> PRINCIPAL);
>>>>>>> +        directoryGBean.setAttribute("securityCredentials",  
>>>>>>> CREDENTIALS);
>>>>>>> +        directoryGBean.setAttribute("anonymousAccess", new  
>>>>>>> Boolean(true));
>>>>>>> +        directoryGBean.setAttribute("enableNetworking", new  
>>>>>>> Boolean(true));
>>>>>>> +        directoryGBean.setAttribute("ldapPort", new Integer 
>>>>>>> (9389));
>>>>>>> +
>>>>>>> +        start(directoryGBean);
>>>>>>> +
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    protected void tearDown() throws Exception {
>>>>>>> +        super.tearDown();
>>>>>>> +
>>>>>>> +        stop(directoryName);
>>>>>>> +        stop(serverInfoName);
>>>>>>> +        kernel.shutdown();
>>>>>>> +    }
>>>>>>> +
>>>>>>> +}
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>
>

-- 
Geir Magnusson Jr                                  +1-203-665-6437
geirm@apache.org



Mime
View raw message