Author: akarasulu
Date: Wed Feb 1 19:56:41 2006
New Revision: 374238
URL: http://svn.apache.org/viewcvs?rev=374238&view=rev
Log:
fixing uberjar so it now works
Added:
directory/trunks/apacheds/simple/main/apacheds.sh (with props)
directory/trunks/apacheds/simple/main/log4j.properties
Modified:
directory/trunks/apacheds/simple/main/pom.xml
directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java
Added: directory/trunks/apacheds/simple/main/apacheds.sh
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/simple/main/apacheds.sh?rev=374238&view=auto
==============================================================================
--- directory/trunks/apacheds/simple/main/apacheds.sh (added)
+++ directory/trunks/apacheds/simple/main/apacheds.sh Wed Feb 1 19:56:41 2006
@@ -0,0 +1,9 @@
+#!/bin/sh
+if [ -e target/org.apache.ldap.server.standalone.simple.main-0.9.4-SNAPSHOT-app.jar ] ; then
+ echo uber jar exists
+else
+ echo uber jar not found need to build it
+ mvn clean assembly:assembly
+fi
+
+java -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar target/org.apache.ldap.server.standalone.simple.main-0.9.4-SNAPSHOT-app.jar server.xml
Propchange: directory/trunks/apacheds/simple/main/apacheds.sh
------------------------------------------------------------------------------
svn:executable = *
Added: directory/trunks/apacheds/simple/main/log4j.properties
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/simple/main/log4j.properties?rev=374238&view=auto
==============================================================================
--- directory/trunks/apacheds/simple/main/log4j.properties (added)
+++ directory/trunks/apacheds/simple/main/log4j.properties Wed Feb 1 19:56:41 2006
@@ -0,0 +1,12 @@
+log4j.rootCategory=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+
+# with these we'll not get innundated when switching to DEBUG
+log4j.logger.org.apache.ldap.common.name=WARN
+log4j.logger.org.springframework=WARN
+log4j.logger.org.apache.ldap.common.codec=WARN
+log4j.logger.org.apache.asn1=WARN
+
Modified: directory/trunks/apacheds/simple/main/pom.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/simple/main/pom.xml?rev=374238&r1=374237&r2=374238&view=diff
==============================================================================
--- directory/trunks/apacheds/simple/main/pom.xml (original)
+++ directory/trunks/apacheds/simple/main/pom.xml Wed Feb 1 19:56:41 2006
@@ -19,7 +19,6 @@
org.apache.directory.daemon
daemon-bootstrappers
0.9.4-SNAPSHOT
- provided
org.slf4j
Modified: directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java?rev=374238&r1=374237&r2=374238&view=diff
==============================================================================
--- directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java (original)
+++ directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java Wed Feb 1 19:56:41 2006
@@ -17,6 +17,7 @@
package org.apache.ldap.server;
+import java.io.File;
import java.util.Properties;
import javax.naming.Context;
@@ -58,12 +59,20 @@
if ( install != null )
{
- log.info( "server: loading settings from {}", install.getConfigurationFile() );
+ log.info( "server: loading settings from ", install.getConfigurationFile() );
ApplicationContext factory = null;
factory = new FileSystemXmlApplicationContext( install.getConfigurationFile().toURL().toString() );
cfg = ( MutableServerStartupConfiguration ) factory.getBean( "configuration" );
env = ( Properties ) factory.getBean( "environment" );
}
+ else if ( args.length > 0 && new File( args[0] ).exists() ) // hack that takes server.xml file argument
+ {
+ log.info( "server: loading settings from ", args[0] );
+ ApplicationContext factory = null;
+ factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURL().toString() );
+ cfg = ( MutableServerStartupConfiguration ) factory.getBean( "configuration" );
+ env = ( Properties ) factory.getBean( "environment" );
+ }
else
{
log.info( "server: using default settings ..." );
@@ -73,7 +82,12 @@
env.setProperty( Context.PROVIDER_URL, "ou=system" );
env.setProperty( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
- cfg.setWorkingDirectory( install.getPartitionsDirectory() );
+
+ if ( install != null )
+ {
+ cfg.setWorkingDirectory( install.getPartitionsDirectory() );
+ }
+
env.putAll( cfg.toJndiEnvironment() );
new InitialDirContext( env );
Modified: directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java?rev=374238&r1=374237&r2=374238&view=diff
==============================================================================
--- directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java (original)
+++ directory/trunks/apacheds/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java Wed Feb 1 19:56:41 2006
@@ -17,7 +17,11 @@
package org.apache.ldap.server;
+import java.io.File;
+
import org.apache.directory.daemon.InstallationLayout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -29,6 +33,8 @@
*/
public class ServerMain
{
+ private static final Logger log = LoggerFactory.getLogger( "main" );
+
/**
* Takes a single argument, the path to the installation home, which contains
* the configuration to load with server startup settings.
@@ -37,17 +43,40 @@
*/
public static void main( String[] args ) throws Exception
{
+ if ( log.isInfoEnabled() )
+ {
+ printBanner();
+ }
+
DirectoryServer server = new DirectoryServer();
- if ( args.length > 0 )
+ if ( args.length > 0 && new File( args[0] ).isDirectory() )
{
server.init( new InstallationLayout( args[0] ), null );
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();
}
+ }
+
+ public static final String BANNER =
+ " _ _ ____ ____ \n" +
+ " / \\ _ __ __ _ ___| |__ ___| _ \\/ ___| \n" +
+ " / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | \\___ \\ \n" +
+ " / ___ \\| |_) | (_| | (__| | | | __/ |_| |___) | \n" +
+ " /_/ \\_\\ .__/ \\__,_|\\___|_| |_|\\___|____/|____/ \n" +
+ " |_| \n";
+
+ public static void printBanner()
+ {
+ System.out.println( BANNER );
}
}