directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r654092 - in /directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory...
Date Wed, 07 May 2008 13:08:39 GMT
Author: pamarcelot
Date: Wed May  7 06:08:37 2008
New Revision: 654092

URL: http://svn.apache.org/viewvc?rev=654092&view=rev
Log:
Added a new java project which will be used to launch Apache DS within Studio.

Added:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/pom.xml
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/pom.xml?rev=654092&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/pom.xml (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/pom.xml Wed
May  7 06:08:37 2008
@@ -0,0 +1,366 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.studio</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.2.0.SNAPSHOT</version>
+  </parent>
+  <artifactId>studio-apacheds-launcher</artifactId>
+  <version>0.0.1</version>
+  <name>Apache Directory Studio Apache DS Launcher</name>
+  <packaging>jar</packaging>
+
+  <description></description>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <configuration>
+          <pde>false</pde>
+          <projectnatures>
+            <projectnature>org.eclipse.jdt.core.javanature</projectnature>
+          </projectnatures>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+   <dependencyManagement>
+    <dependencies>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-xbean-spring</artifactId>
+        <version>1.5.2</version>
+      </dependency>  
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-server-xml</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+  
+      <dependency>
+        <groupId>org.apache.directory.daemon</groupId>
+        <artifactId>daemon-bootstrappers</artifactId>
+        <version>1.1.3</version>
+      </dependency>    
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-server-jndi</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-protocol-ntp</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-protocol-kerberos</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-protocol-changepw</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-protocol-dns</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-schema-extras</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-bootstrap-partition</artifactId>
+        <version>1.5.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.shared</groupId>
+        <artifactId>shared-asn1-codec</artifactId>
+        <version>0.9.10</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.shared</groupId>
+        <artifactId>shared-ldap</artifactId>
+        <version>0.9.10</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.directory.shared</groupId>
+        <artifactId>shared-ldap-constants</artifactId>
+        <version>0.9.10</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.mina</groupId>
+        <artifactId>mina-core</artifactId>
+        <version>1.1.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.mina</groupId>
+        <artifactId>mina-filter-ssl</artifactId>
+        <version>1.1.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-collections</groupId>
+        <artifactId>commons-collections</artifactId>
+        <version>3.2</version>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-daemon</groupId>
+        <artifactId>commons-daemon</artifactId>
+        <version>1.0.1</version>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.3</version>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-cli</groupId>
+        <artifactId>commons-cli</artifactId>
+        <version>1.1</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>1.4.3</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>jcl104-over-slf4j</artifactId>
+        <version>1.4.3</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+        <version>1.4.3</version>
+      </dependency>
+
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.14</version>
+      </dependency>
+
+      <dependency>
+        <groupId>jdbm</groupId>
+        <artifactId>jdbm</artifactId>
+        <version>1.0</version>
+      </dependency>
+
+      <dependency>
+        <groupId>antlr</groupId>
+        <artifactId>antlr</artifactId>
+        <version>2.7.7</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-core</artifactId>
+        <version>2.0.6</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-beans</artifactId>
+        <version>2.0.6</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-context</artifactId>
+        <version>2.0.6</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>aopalliance</groupId>
+            <artifactId>aopalliance</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-spring</artifactId>
+        <version>3.3</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jmx</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      
+    </dependencies>
+  </dependencyManagement>
+
+<dependencies>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-xbean-spring</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-jndi</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-ntp</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-kerberos</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-changepw</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-dns</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-xml</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-bootstrap-partition</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.daemon</groupId>
+      <artifactId>daemon-bootstrappers</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl104-over-slf4j</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-spring</artifactId>
+    </dependency>
+  </dependencies>
+
+
+</project>

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java?rev=654092&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
Wed May  7 06:08:37 2008
@@ -0,0 +1,47 @@
+package org.apache.directory.studio.apacheds;
+
+
+
+import org.apache.directory.daemon.InstallationLayout;
+
+import java.io.File;
+
+
+/**
+ * The command line main for the server.  Warning this used to be a simple test
+ * case so there really is not much here.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 596814 $
+ */
+public class Launcher
+{
+    /**
+     * Takes a single argument, the path to the installation home, which contains 
+     * the configuration to load with server startup settings.
+     *
+     * @param args the arguments
+     */
+    public static void main( String[] args ) throws Exception
+    {
+        ServerInstance server = new ServerInstance();
+
+        if ( args.length > 0 && new File( args[0] ).isDirectory() )
+        {
+            InstallationLayout layout = new InstallationLayout( args[0] );
+            String confFile = layout.getConfigurationFile().toURI().toURL().toString();
+            server.init( layout, new String[] { confFile } );
+            server.start();
+        }
+        else if ( args.length > 0 && new File( args[0] ).isFile() )
+        {
+            server.init( null, args );
+            server.start();
+        }
+        else
+        {
+            server.init( null, null );
+            server.start();
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java?rev=654092&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java
Wed May  7 06:08:37 2008
@@ -0,0 +1,163 @@
+package org.apache.directory.studio.apacheds;
+
+
+
+import java.io.File;
+
+import org.apache.directory.daemon.DaemonApplication;
+import org.apache.directory.daemon.InstallationLayout;
+import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.protocol.shared.SocketAcceptor;
+import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * DirectoryServer bean used by both the daemon code and by the ServerMain here.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 596797 $
+ */
+public class ServerInstance implements DaemonApplication
+{
+    private static final Logger LOG = LoggerFactory.getLogger( ServerInstance.class );
+    private Thread workerThread;
+    private SynchWorker worker = new SynchWorker();
+    private ApacheDS apacheDS;
+    private FileSystemXmlApplicationContext factory;
+
+
+    public void init( InstallationLayout install, String[] args ) throws Exception
+    {
+        long startTime = System.currentTimeMillis();
+
+        if ( args.length > 0 && new File( args[0] ).exists() ) // hack that takes
server.xml file argument
+        {
+            LOG.info( "server: loading settings from ", args[0] );
+            factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURI().toURL().toString()
);
+            apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
+        }
+        else
+        {
+            LOG.info( "server: using default settings ..." );
+            DirectoryService directoryService = new DefaultDirectoryService();
+            directoryService.startup();
+            SocketAcceptor socketAcceptor = new SocketAcceptor( null );
+            LdapServer ldapServer = new LdapServer();
+            ldapServer.setSocketAcceptor( socketAcceptor );
+            ldapServer.setDirectoryService( directoryService );
+            ldapServer.start();
+            LdapServer ldapsServer = new LdapServer();
+            ldapsServer.setEnableLdaps( true );
+            ldapsServer.setSocketAcceptor( socketAcceptor );
+            ldapsServer.setDirectoryService( directoryService );
+            ldapsServer.start();
+            apacheDS = new ApacheDS( directoryService, ldapServer, ldapsServer );
+        }
+
+        if ( install != null )
+        {
+            apacheDS.getDirectoryService().setWorkingDirectory( install.getPartitionsDirectory()
);
+        }
+
+        apacheDS.startup();
+
+        if ( apacheDS.getSynchPeriodMillis() > 0 )
+        {
+            workerThread = new Thread( worker, "SynchWorkerThread" );
+        }
+        
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
+        }
+    }
+
+    public DirectoryService getDirectoryService() {
+        return apacheDS.getDirectoryService();
+    }
+
+
+    public void synch() throws Exception
+    {
+        apacheDS.getDirectoryService().sync();
+    }
+
+
+    public void start()
+    {
+        if ( workerThread != null )
+        {
+            workerThread.start();
+        }
+    }
+
+
+    public void stop( String[] args ) throws Exception
+    {
+        if ( workerThread != null )
+        {
+            worker.stop = true;
+            synchronized ( worker.lock )
+            {
+                worker.lock.notify();
+            }
+    
+            while ( workerThread.isAlive() )
+            {
+                LOG.info( "Waiting for SynchWorkerThread to die." );
+                workerThread.join( 500 );
+            }
+        }
+
+        if (factory != null)
+        {
+            factory.close();
+        }
+        apacheDS.shutdown();
+    }
+
+
+    public void destroy()
+    {
+    }
+
+    
+    class SynchWorker implements Runnable
+    {
+        final Object lock = new Object();
+        boolean stop;
+
+
+        public void run()
+        {
+            while ( !stop )
+            {
+                synchronized ( lock )
+                {
+                    try
+                    {
+                        lock.wait( apacheDS.getSynchPeriodMillis() );
+                    }
+                    catch ( InterruptedException e )
+                    {
+                        LOG.warn( "SynchWorker failed to wait on lock.", e );
+                    }
+                }
+
+                try
+                {
+                    synch();
+                }
+                catch ( Exception e )
+                {
+                    LOG.error( "SynchWorker failed to synch directory.", e );
+                }
+            }
+        }
+    }
+}



Mime
View raw message