You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/05/30 14:11:43 UTC
svn commit: r661675 - in /directory/studio/branches/apacheds-plugin-branch:
./ apacheds-launcher/ apacheds-launcher/src/ apacheds-launcher/src/main/
apacheds-launcher/src/main/java/ apacheds-launcher/src/main/java/org/
apacheds-launcher/src/main/java/o...
Author: pamarcelot
Date: Fri May 30 05:11:42 2008
New Revision: 661675
URL: http://svn.apache.org/viewvc?rev=661675&view=rev
Log:
Added an Apache DS Launcher jar.
Added:
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/pom.xml
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java
Modified:
directory/studio/branches/apacheds-plugin-branch/pom.xml
Added: directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/pom.xml?rev=661675&view=auto
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/pom.xml (added)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/pom.xml Fri May 30 05:11:42 2008
@@ -0,0 +1,319 @@
+<?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>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/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java?rev=661675&view=auto
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java (added)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/Launcher.java Fri May 30 05:11:42 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.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/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java?rev=661675&view=auto
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java (added)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds-launcher/src/main/java/org/apache/directory/studio/apacheds/ServerInstance.java Fri May 30 05:11:42 2008
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.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 );
+ }
+ }
+ }
+ }
+}
Modified: directory/studio/branches/apacheds-plugin-branch/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/pom.xml?rev=661675&r1=661674&r2=661675&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/pom.xml (original)
+++ directory/studio/branches/apacheds-plugin-branch/pom.xml Fri May 30 05:11:42 2008
@@ -63,6 +63,7 @@
<!-- Set versions for subprojects -->
<aciitemeditor.version>1.2.0.SNAPSHOT</aciitemeditor.version>
<apacheds.version>1.2.0.SNAPSHOT</apacheds.version>
+ <apacheds.launcher.version>1.2.0.SNAPSHOT</apacheds.launcher.version>
<apacheds.configuration.version>1.2.0.SNAPSHOT</apacheds.configuration.version>
<apacheds.configuration.feature.version>1.2.0.SNAPSHOT</apacheds.configuration.feature.version>
<apacheds.configuration.help.version>1.2.0.SNAPSHOT</apacheds.configuration.help.version>
@@ -1903,6 +1904,7 @@
<module>apacheds-configuration</module>
<module>apacheds-configuration-feature</module>
<module>apacheds-configuration-help</module>
+ <module>apacheds-launcher</module>
<module>apacheds</module>
<module>jars</module>
<module>updatesite</module>