directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r373091 - in /directory/trunks/apacheds/standalone: daemon/ daemon/src/main/java/org/apache/directory/server/standalone/daemon/ daemon/src/main/manifest/ installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/ ins...
Date Sat, 28 Jan 2006 06:36:54 GMT
Author: akarasulu
Date: Fri Jan 27 22:36:32 2006
New Revision: 373091

URL: http://svn.apache.org/viewcvs?rev=373091&view=rev
Log:
recoved from refactoring which caused sever issues with procrun. everything seems to be working
fairly well now

Added:
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
  (with props)
Modified:
    directory/trunks/apacheds/standalone/daemon/pom.xml
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/LifecycleInvoker.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/manifest/MANIFEST.MF
    directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/MojoHelperUtils.java
    directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/inno/InnoInstallerCommand.java
    directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/inno/install.iss
    directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
    directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java

Modified: directory/trunks/apacheds/standalone/daemon/pom.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/pom.xml?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/pom.xml (original)
+++ directory/trunks/apacheds/standalone/daemon/pom.xml Fri Jan 27 22:36:32 2006
@@ -42,7 +42,7 @@
           <archive>
             <manifestFile>src/main/manifest/MANIFEST.MF</manifestFile>
             <manifest>
-              <mainClass>org.apache.directory.server.standalone.daemon.MainBootstrapper</mainClass>
+              <mainClass>org.apache.directory.server.standalone.daemon.Bootstrapper</mainClass>
             </manifest>
           </archive>
         </configuration>

Added: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java?rev=373091&view=auto
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
(added)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
Fri Jan 27 22:36:32 2006
@@ -0,0 +1,464 @@
+/*
+ *   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.
+ *
+ */
+package org.apache.directory.server.standalone.daemon;
+
+
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class Bootstrapper
+{
+    private static final Logger log = LoggerFactory.getLogger( Bootstrapper.class );
+    private static final String[] EMPTY_STRARRY = new String[0];
+    private static final String BOOTSTRAP_START_CLASS_PROP = "bootstrap.start.class";
+    private static final String BOOTSTRAP_STOP_CLASS_PROP = "bootstrap.stop.class";
+
+    private static Bootstrapper instance;
+    
+    private final Properties bootstrapProperties = new Properties();
+    private InstallationLayout install;
+    private ClassLoader appLoader;
+    private ClassLoader parentLoader;
+    private Object bootstrapped;
+
+    
+    public void setInstallationLayout( String installationBase )
+    {
+    	log.debug( "Setting layout in Bootstrapper using base: " + installationBase );
+        install = new InstallationLayout( installationBase );
+        
+        try
+        {
+        	install.verifyInstallation();
+        }
+        catch( Throwable t )
+        {
+        	log.error( "Installation verification failure!", t );
+        }
+        
+        try
+        {
+            bootstrapProperties.load( new FileInputStream( install.getBootstrapperConfigurationFile()
) );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed while loading: " + install.getBootstrapperConfigurationFile(),
e );
+            System.exit( ExitCodes.PROPLOAD );
+        }
+    }
+    
+    
+    public void setParentLoader( ClassLoader parentLoader )
+    {
+        this.parentLoader = parentLoader;
+        URL[] jars = install.getAllJars();
+        this.appLoader = new URLClassLoader( jars, parentLoader );
+        
+        if ( log.isDebugEnabled() )
+        {
+            StringBuffer buf = new StringBuffer();
+            buf.append( "urls in app loader: \n" );
+            for ( int ii = 0; ii < jars.length; ii++ )
+            {
+                buf.append( "\t" ).append( jars[ii] ).append( "\n" );
+            }
+            log.debug( buf.toString() );
+        }
+    }
+
+
+    public void callInit( String className )
+    {
+        Class clazz = null;
+        Method op = null;
+        
+        Thread.currentThread().setContextClassLoader( appLoader );
+        try
+        {
+            clazz = appLoader.loadClass( className );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            log.error( "Could not find " + className, e );
+            System.exit( ExitCodes.CLASS_LOOKUP );
+        }
+        
+        try
+        {
+            bootstrapped = clazz.newInstance();
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not instantiate " + className, e );
+            System.exit( ExitCodes.INSTANTIATION );
+        }
+        
+        try
+        {
+            op = clazz.getMethod( "init", new Class[] { InstallationLayout.class } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find init(InstallationLayout) method for " + className,
e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, new Object[] { this.install } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + className + ".init(InstallationLayout)", e );
+            System.exit( ExitCodes.INITIALIZATION );
+        }
+    }
+
+    
+    public void callStart()
+    {
+        Class clazz = bootstrapped.getClass();
+        Method op = null;
+        
+        try
+        {
+            op = clazz.getMethod( "start", null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find start() method for " + clazz.getName(), e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + clazz.getName() + ".start()", e );
+            System.exit( ExitCodes.START );
+        }
+    }
+    
+
+    public void callStop( String className )
+    {
+        Class clazz = null;
+        Method op = null;
+        
+        try
+        {
+            clazz = appLoader.loadClass( className );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            log.error( "Could not find " + className, e );
+            System.exit( ExitCodes.CLASS_LOOKUP );
+        }
+        
+        try
+        {
+            bootstrapped = clazz.newInstance();
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not instantiate " + className, e );
+            System.exit( ExitCodes.INSTANTIATION );
+        }
+        
+        try
+        {
+            op = clazz.getMethod( "stop", new Class[] { EMPTY_STRARRY.getClass() } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find stop() method for " + className, e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, new Object[] { EMPTY_STRARRY } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + className + ".stop()", e );
+            System.exit( ExitCodes.STOP );
+        }
+    }
+
+    
+    // -----------------------------------------------------------------------
+    
+    
+    public void init( String[] args )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            StringBuffer buf = new StringBuffer();
+            buf.append( "init(String[]) called with args: \n" );
+            for ( int ii = 0; ii < args.length; ii++ )
+            {
+                buf.append( "\t" ).append( args[ii] ).append( "\n" );
+            }
+            log.debug( buf.toString() );
+        }
+
+        if ( install == null )
+        {
+            log.debug( "install was null: initializing it using first argument" );
+            setInstallationLayout( args[0] );
+            log.debug( "install initialized" );
+        }
+        else
+        {
+            log.debug( "install was not null" );
+        }
+
+        if ( parentLoader == null )
+        {
+            log.info( "Trying to get handle on system classloader as the parent" );
+            setParentLoader( Thread.currentThread().getContextClassLoader() );
+            log.info( "parentLoader = " + parentLoader );
+        }
+        
+        callInit( bootstrapProperties.getProperty( BOOTSTRAP_START_CLASS_PROP, null ) );
+
+        // This is only needed for procrun but does not harm jsvc or runs 
+        // Leads me to think that we need to differentiate somehow between
+        // different daemon frameworks.  We can do this via command line args,
+        // system properties or by making them call different methods to start
+        // the process.  However not every framework may support calling 
+        // different methods which may also be somewhat error prone.
+        
+        while( true )
+        {
+            try
+            {
+                Thread.sleep( 2000 );
+            }
+            catch ( InterruptedException e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    
+    public void stop() throws Exception
+    {
+        log.debug( "stop() called" );
+        callStop( bootstrapProperties.getProperty( BOOTSTRAP_STOP_CLASS_PROP, null )  );
+    }
+
+
+    public void destroy()
+    {
+        log.debug( "destroy() called" );
+    }
+
+
+    public void start()
+    {
+        log.debug( "start() called" );
+        Thread.currentThread().setContextClassLoader( parentLoader );
+        callStart();
+    }
+
+
+    public void start( String[] args )
+    {
+        log.debug( "start(String[]) called" );
+        Thread.currentThread().setContextClassLoader( this.parentLoader );
+        
+        if ( install == null && args.length > 0 )
+        {
+            setInstallationLayout( args[0] );
+            setParentLoader( Thread.currentThread().getContextClassLoader() );
+        }
+    }
+
+
+    // ------------------------------------------------------------------------
+    // The main()
+    // ------------------------------------------------------------------------
+
+
+    public static void prunsrvStart( String[] args )
+    {
+        log.debug( "prunsrvStart(String[]) called" );
+        
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "prunsrvStart(String[]) recieved args:" );
+            for ( int ii = 0; ii < args.length; ii++ )
+            {
+                log.debug( "args[" + ii + "] = " + args[ii] );
+            }
+        }
+
+        try
+        {
+        	log.debug( "prunsrvStart(String[]) initializing Bootstrapper ... )" );
+            instance = new Bootstrapper();
+            instance.setInstallationLayout( args[0] );
+            instance.setParentLoader( Bootstrapper.class.getClassLoader() );
+
+            log.debug( "prunsrvStart(String[]) calling init(String[])" );
+            instance.init( args );
+
+            log.debug( "prunsrvStart(String[]) calling start(String[])" );
+            instance.start( args );
+        }
+        catch ( Throwable t )
+        {
+        	log.error( "Encountered error in prunsrvStart(String[])", t );
+            System.exit( 4 );
+        }
+    }
+
+
+    public static void prunsrvStop( String[] args )
+    {
+        log.debug( "prunsrvStop(String[]) called" );
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "prunsrvStop(String[]) recieved args:" );
+            for ( int ii = 0; ii < args.length; ii++ )
+            {
+                log.debug( "args[" + ii + "] = " + args[ii] );
+            }
+        }
+
+        try
+        {
+        	log.debug( "prunsrvStop(String[]) initializing Bootstrapper ... )" );
+            instance = new Bootstrapper();
+            instance.setInstallationLayout( args[0] );
+            instance.setParentLoader( Bootstrapper.class.getClassLoader() );
+
+            log.debug( "prunsrvStop(String[]) calling stop()" );
+            instance.stop();
+            log.debug( "prunsrvStop(String[]) calling destroy()" );
+            instance.destroy();
+        }
+        catch ( Throwable t )
+        {
+        	log.error( "Encountered error in prunsrvStop(String[])", t );
+            System.exit( 4 );
+        }
+    }
+
+
+    // ------------------------------------------------------------------------
+    // The main()
+    // ------------------------------------------------------------------------
+
+
+    public static void main( String[] args )
+    {
+        log.debug( "main(String[]) called" );
+        
+        // Noticed that some starts with jar2exe.exe pass in a null arguement list
+        if ( args == null )
+        {
+            System.err.println( "Arguements are null - how come?" );
+            log.error( "main() args were null shutting down!" );
+            printHelp();
+            System.exit( 1 );
+        }
+
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "main() recieved args:" );
+            for ( int ii = 0; ii < args.length; ii++ )
+            {
+                log.debug( "args[" + ii + "] = " + args[ii] );
+            }
+        }
+
+        if ( args.length > 1 )
+        {
+            if ( instance == null )
+            {
+            	log.debug( "main(String[]) initializing Bootstrapper ... )" );
+                instance = new Bootstrapper();
+                instance.setInstallationLayout( args[0] );
+                instance.setParentLoader( Bootstrapper.class.getClassLoader() );
+                log.debug( "Bootstrapper initialized" );
+            }
+        }
+        else
+        {
+            String msg = "Server exiting without required installation.home or command.name.";
+            System.err.println( msg );
+            log.error( msg );
+            printHelp();
+            System.exit( 1 );
+        }
+
+        String command = args[args.length - 1];
+        try
+        {
+            if ( command.equalsIgnoreCase( "start" ) )
+            {
+                log.debug( "calling init(String[]) from main(String[])" );
+                instance.init( args );
+
+                log.debug( "calling start(String[]) from main(String[])" );
+                instance.start( args );
+            }
+            else if ( command.equalsIgnoreCase( "stop" ) )
+            {
+                log.debug( "calling stop() from main(String[])" );
+                instance.stop();
+                instance.destroy();
+            }
+            else
+            {
+                log.error( "Unrecognized command " + command );
+                printHelp();
+                System.exit( 3 );
+            }
+        }
+        catch ( Throwable t )
+        {
+        	log.error( "Encountered error while processing command: " + command );
+            t.printStackTrace();
+            System.exit( 4 );
+        }
+    }
+
+
+    private static void printHelp()
+    {
+        System.err.println("java -jar bootstrap.jar <app.home> <command.name>");
+    }
+}

Propchange: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/LifecycleInvoker.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/LifecycleInvoker.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/LifecycleInvoker.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/LifecycleInvoker.java
Fri Jan 27 22:36:32 2006
@@ -16,8 +16,10 @@
  */
 package org.apache.directory.server.standalone.daemon;
 
-
+    
 import java.io.FileInputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Properties;
@@ -37,18 +39,22 @@
     private static Logger log = LoggerFactory.getLogger( LifecycleInvoker.class );
     private static final String BOOTSTRAP_START_CLASS_PROP = "bootstrap.start.class";
     private static final String BOOTSTRAP_STOP_CLASS_PROP = "bootstrap.stop.class";
+	private static final String[] EMPTY_STRARRAY = new String[0];
 
-    private DaemonApplication startObject;
-    private DaemonApplication stopObject;
+    private Object startObject;
+    private Object stopObject;
     private String startClassName;
     private String stopClassName;
+    private Class startObjectClass;
+    private final ClassLoader parent;
     private final ClassLoader application;
     private final InstallationLayout layout;
 
 
     public LifecycleInvoker( String installationBase, ClassLoader parent )
     {
-        layout = new InstallationLayout( installationBase );
+    	this.parent = parent;
+        this.layout = new InstallationLayout( installationBase );
         
         // -------------------------------------------------------------------
         // Verify correct installation layout
@@ -135,11 +141,12 @@
      */
     public void callInit( String[] args )
     {
-        Class clazz = null;
+        Method op = null;
         Thread.currentThread().setContextClassLoader( application );
+        
         try
         {
-            clazz = application.loadClass( startClassName );
+            startObjectClass = application.loadClass( startClassName );
         }
         catch ( ClassNotFoundException e )
         {
@@ -149,7 +156,7 @@
         
         try
         {
-            startObject = ( DaemonApplication ) clazz.newInstance();
+            startObject = startObjectClass.newInstance();
         }
         catch ( Exception e )
         {
@@ -159,44 +166,102 @@
 
         try
         {
-            startObject.init( layout, args );
+        	Method[] methods = startObjectClass.getMethods();
+        	log.debug( "Listing methods in start class " + startObjectClass + ":" );
+        	for ( int ii = 0; ii < methods.length; ii++ )
+        	{
+        		log.debug( "\t" + methods[ii].toString() );
+        		if ( methods[ii].getName().equals( "init" ) )
+        		{
+        			op = methods[ii];
+        			log.info( "Found init method to call: " + op );
+        		}
+        	}
         }
         catch ( Exception e )
         {
-            log.error( "Could not instantiate " + startClassName, e );
+            log.error( "Could not find init(InstallationLayout) method for " + startClassName,
e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( startObject, new Object[] { layout } ); 
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not invoke init(InstallationLayout, String[]) on " + startClassName,
e );
             System.exit( ExitCodes.INVOCATION );
         }
+        
+        Thread.currentThread().setContextClassLoader( parent );
     }
 
 
     public void callStart( boolean nowait )
     {
-        Thread.currentThread().setContextClassLoader( application );
-        startObject.start( nowait );
+//        Thread.currentThread().setContextClassLoader( application );
+        Method op = null;
+        
+        try
+        {
+        	Method[] methods = startObjectClass.getMethods();
+        	log.debug( "Listing methods in start class " + startObjectClass + ":" );
+        	for ( int ii = 0; ii < methods.length; ii++ )
+        	{
+        		log.debug( "\t" + methods[ii].toString() );
+        		if ( methods[ii].getName().equals( "start" ) )
+        		{
+        			op = methods[ii];
+        			log.info( "Found start method to call: " + op );
+        		}
+        	}
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find start(boolean) method for " + startObjectClass.getName(),
e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( startObject, new Object[] { new Boolean( nowait ) } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + startObjectClass.getName() + ".start()", e );
+            System.exit( ExitCodes.START );
+        }    
     }
     
 
     public void callStop( String[] args )
     {
-        Thread.currentThread().setContextClassLoader( application );
+//        Thread.currentThread().setContextClassLoader( application );
         Class clazz = null;
+        Method op = null;
 
         // Reuse the startObject if it is the same class
         if ( ! startClassName.equals( stopClassName ) )
+        {            
+            clazz = startObjectClass;
+            stopObject = startObject;
+        }
+        else
         {
-            try
+            try 
             {
                 clazz = application.loadClass( stopClassName );
-            }
-            catch ( ClassNotFoundException e )
+            } 
+            catch ( ClassNotFoundException e ) 
             {
                 log.error( "Could not find " + stopClassName, e );
                 System.exit( ExitCodes.CLASS_LOOKUP );
             }
-            
+        
             try
             {
-                stopObject = ( DaemonApplication ) clazz.newInstance();
+                stopObject = clazz.newInstance();
             }
             catch ( Exception e )
             {
@@ -204,27 +269,53 @@
                 System.exit( ExitCodes.INSTANTIATION );
             }
         }
-        else
+
+        try
         {
-            stopObject = startObject;
-            clazz = startObject.getClass();
+            op = clazz.getMethod( "stop", null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find stop() method for " + stopClassName, e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
         }
 
         try
         {
-            stopObject.stop( args );
+            op.invoke( stopObject, null );
         }
         catch ( Exception e )
         {
-            log.error( "Could not instantiate " + startClassName, e );
-            System.exit( ExitCodes.INVOCATION );
-        }
+            log.error( "Failed on " + stopClassName + ".stop()", e );
+            System.exit( ExitCodes.STOP );
+        }    
     }
 
     
     public void callDestroy()
     {
-        Thread.currentThread().setContextClassLoader( application );
-        stopObject.destroy();
+//        Thread.currentThread().setContextClassLoader( application );
+        Class clazz = stopObject.getClass();
+        Method op = null;
+        
+        try
+        {
+            op = clazz.getMethod( "destroy", null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find destroy() method for " + clazz.getName(), e );
+            System.exit( ExitCodes.METHOD_LOOKUP );
+        }
+        
+        try
+        {
+            op.invoke( stopObject, null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + clazz.getName() + ".destroy()", e );
+            System.exit( ExitCodes.DESTROY );
+        }
     }
 }

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
Fri Jan 27 22:36:32 2006
@@ -36,6 +36,8 @@
 
     public static void prunsrvStart( String[] args )
     {
+    	ClassLoader system = Thread.currentThread().getContextClassLoader();
+    	
         if ( log.isDebugEnabled() )
         {
             StringBuffer buf = new StringBuffer();
@@ -53,22 +55,36 @@
         }
 
         log.debug( "prunsrvStart(String[]) creating LifecycleInvoker ... )" );
-        LifecycleInvoker invoker = new LifecycleInvoker( args[0], 
-            Thread.currentThread().getContextClassLoader() );
+        LifecycleInvoker invoker = new LifecycleInvoker( args[0], system );
 
         log.debug( "prunsrvStart(String[]) invoking application.callInit(String[]))" );
-        if ( args.length > 1 )
+        try
         {
-            String[] shifted = new String[args.length-1];
-            System.arraycopy( args, 1, shifted, 0, shifted.length );
-            invoker.callInit( shifted );
+	        if ( args.length > 1 )
+	        {
+	            String[] shifted = new String[args.length-1];
+	            System.arraycopy( args, 1, shifted, 0, shifted.length );
+	            invoker.callInit( shifted );
+	        }
+	        else
+	        {
+	            invoker.callInit( EMPTY_STRARRAY );
+	        }
         }
-        else
+        catch ( Throwable t )
         {
-            invoker.callInit( EMPTY_STRARRAY );
+        	log.error( "Failed while calling invoker.callInit(String[])", t );
         }
+        
         log.debug( "prunsrvStart(String[]) invoking bootstrapper.callStart())" );
-        invoker.callStart( false ); // must block on start (let the app decide how)
+        try
+        {
+        	invoker.callStart( false ); // must block on start (let the app decide how)
+        }
+        catch( Throwable t )
+        {
+        	log.error( "Failed while calling invoker.callStart(String[])", t );
+        }
     }
 
     

Modified: directory/trunks/apacheds/standalone/daemon/src/main/manifest/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/manifest/MANIFEST.MF?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/manifest/MANIFEST.MF (original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/manifest/MANIFEST.MF Fri Jan 27 22:36:32
2006
@@ -1,10 +1,6 @@
 Manifest-Version: 1.0
-Archiver-Version: Plexus Archiver
-Created-By: Apache Maven
-Build-Jdk: 1.5.0_06
-Extension-Name: org.apache.directory.server.standalone.daemon
-Implementation-Title: org.apache.directory.server.standalone.daemon
-Implementation-Version: 0.9.4-SNAPSHOT
-Main-Class: org.apache.directory.server.standalone.daemon.MainBootstra
- pper
-Class-Path: logger.jar daemon.jar bootstrapper.jar
+Main-Class: org.apache.directory.server.standalone.daemon.Bootstrapper
+Class-Path: logger.jar daemon.jar
+Specification-Title: ApacheDS
+Specification-Version: 1.0
+

Modified: directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/MojoHelperUtils.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/MojoHelperUtils.java
(original)
+++ directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/MojoHelperUtils.java
Fri Jan 27 22:36:32 2006
@@ -135,13 +135,13 @@
             {
                 mymojo.getLog().info( "Not copying bootstrapper " + artifact );
             }
-            else if ( artifact.equals( mymojo.getLogger() ) )
-            {
-                mymojo.getLog().info( "Not copying logger " + artifact );
-            }
             else if ( artifact.equals( mymojo.getDaemon() ) )
             {
                 mymojo.getLog().info( "Not copying daemon " + artifact );
+            }
+            else if ( artifact.equals( mymojo.getLogger() ) )
+            {
+                mymojo.getLog().info( "Not copying logger " + artifact );
             }
             else
             {

Modified: directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/inno/InnoInstallerCommand.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/inno/InnoInstallerCommand.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/inno/InnoInstallerCommand.java
(original)
+++ directory/trunks/apacheds/standalone/installers/plugin/src/main/java/org/apache/directory/server/standalone/installers/inno/InnoInstallerCommand.java
Fri Jan 27 22:36:32 2006
@@ -239,7 +239,7 @@
             buf.append( "Source: {#SourceBase}\\lib\\" );
             File artifact = ( ( Artifact ) artifacts.get( ii ) ).getFile();
             buf.append( artifact.getName() );
-            buf.append( "; DestDir: {app}-${app.version}\\lib; DestName: " );
+            buf.append( "; DestDir: {app}\\lib; DestName: " );
             buf.append( artifact.getName() );
             buf.append( "\n" );
         }

Modified: directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/inno/install.iss
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/inno/install.iss?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/inno/install.iss
(original)
+++ directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/inno/install.iss
Fri Jan 27 22:36:32 2006
@@ -21,7 +21,7 @@
 AppPublisherURL={#MyAppURL}
 AppSupportURL={#MyAppURL}
 AppUpdatesURL={#MyAppURL}
-DefaultDirName={pf}\${app}
+DefaultDirName={pf}\${app}-${app.version}
 DefaultGroupName={#MyAppName}
 LicenseFile={#SourceBase}\${app.license.name}
 OutputDir="${installer.output.directory}"
@@ -43,36 +43,36 @@
 
 [Files]
 ; bin directory targets
-Source: {#SourceBase}\bin\${app}w.exe; DestDir: {app}-${app.version}\bin; Tasks: ; Languages:

-Source: {#SourceBase}\bin\${app}.exe; DestDir: {app}-${app.version}\bin
-Source: {#SourceBase}\bin\bootstrapper.jar; DestDir: {app}-${app.version}\bin; DestName:
bootstrapper.jar
-Source: {#SourceBase}\bin\logger.jar; DestDir: {app}-${app.version}\bin; DestName: logger.jar
-Source: {#SourceBase}\bin\daemon.jar; DestDir: {app}-${app.version}\bin; DestName: daemon.jar
+Source: {#SourceBase}\bin\${app}w.exe; DestDir: {app}\bin; Tasks: ; Languages: 
+Source: {#SourceBase}\bin\${app}.exe; DestDir: {app}\bin
+Source: {#SourceBase}\bin\bootstrapper.jar; DestDir: {app}\bin; DestName: bootstrapper.jar
+Source: {#SourceBase}\bin\logger.jar; DestDir: {app}\bin; DestName: logger.jar
+Source: {#SourceBase}\bin\daemon.jar; DestDir: {app}\bin; DestName: daemon.jar
 ; conf directory targets
-Source: {#SourceBase}\conf\log4j.properties; DestDir: {app}-${app.version}\conf; DestName:
log4j.properties
-Source: {#SourceBase}\conf\server.xml; DestDir: {app}-${app.version}\conf; DestName: server.xml
-Source: {#SourceBase}\conf\bootstrapper.properties; DestDir: {app}-${app.version}\conf; DestName:
bootstrapper.properties
+Source: {#SourceBase}\conf\log4j.properties; DestDir: {app}\conf; DestName: log4j.properties
+Source: {#SourceBase}\conf\server.xml; DestDir: {app}\conf; DestName: server.xml
+Source: {#SourceBase}\conf\bootstrapper.properties; DestDir: {app}\conf; DestName: bootstrapper.properties
 ; top level directory targets 
-Source: {#SourceBase}\${app.license.name}; DestDir: {app}-${app.version}; DestName: ${app.license.name}
-Source: {#SourceBase}\${app.readme.name}; DestDir: {app}-${app.version}; DestName: ${app.readme.name}
-Source: {#SourceBase}\${app.icon.name}; DestDir: {app}-${app.version}; DestName: ${app.icon.name}
+Source: {#SourceBase}\${app.license.name}; DestDir: {app}; DestName: ${app.license.name}
+Source: {#SourceBase}\${app.readme.name}; DestDir: {app}; DestName: ${app.readme.name}
+Source: {#SourceBase}\${app.icon.name}; DestDir: {app}; DestName: ${app.icon.name}
 ; empty var & lib\ext directory structure
-Source: {#SourceBase}\var\*; DestDir: "{app}-${app.version}\var\"; Flags: ignoreversion recursesubdirs
createallsubdirs
-Source: {#SourceBase}\lib\ext; DestDir: "{app}-${app.version}\lib"; Flags: ignoreversion
recursesubdirs createallsubdirs
+Source: {#SourceBase}\var\*; DestDir: "{app}\var\"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: {#SourceBase}\lib\ext; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs
createallsubdirs
 ; lib directory targets
 ${app.lib.jars}
 
 [Icons]
-Name: {group}\Service Settings; Filename: {app}-${app.version}\bin\${app}w.exe; Parameters:
//ES//${app}; IconIndex: 0
-Name: {userdesktop}\{#MyAppName}; Filename: {app}-${app.version}\bin\${app}w.exe; Tasks:
desktopicon; Parameters: //ES//${app}; IconIndex: 0; Languages: 
-Name: {group}\Tray Monitor; Filename: {app}-${app.version}\bin\${app}w.exe; Parameters: //MS//${app};
IconIndex: 0
-Name: {group}\Test Service; Filename: {app}-${app.version}\bin\${app}.exe; IconIndex: 0
+Name: {group}\Service Settings; Filename: {app}\bin\${app}w.exe; Parameters: //ES//${app};
IconIndex: 0
+Name: {userdesktop}\{#MyAppName}; Filename: {app}\bin\${app}w.exe; Tasks: desktopicon; Parameters:
//ES//${app}; IconIndex: 0; Languages: 
+Name: {group}\Tray Monitor; Filename: {app}\bin\${app}w.exe; Parameters: //MS//${app}; IconIndex:
0
+Name: {group}\Test Service; Filename: {app}\bin\${app}.exe; IconIndex: 0
 
 [Run]
-Filename: {app}-${app.version}\bin\${app}.exe; WorkingDir: {app}-${app.version}\bin; Tasks:
; Languages: ; Parameters: "//IS//${app.displayname} --Description=""${app.description} Service
${app.version} - ${app.url}"" --DisplayName=${app.displayname} --Install=""{app}-${app.version}\bin\${app}.exe""
--StartMode=jvm --StopMode=jvm --StartClass=org.apache.directory.server.standalone.daemon.ProcrunBootstrapper
--StartMethod prunsrvStart --StartParams=""{app}"" --StopClass=org.apache.directory.server.standalone.daemon.ProcrunBootstrapper
--StopMethod prunsrvStop --StopParams=""{app}"" --Startup=manual --JvmOptions=""-D${app}.home={app}-${app.version}""
--Classpath=""{app}-${app.version}\bin\bootstrapper.jar;{app}-${app.version}\conf;{app}-${app.version}\bin\logger.jar;{app}-${app.version}\bin\daemon.jar""
--LogPath=""{app}-${app.version}\var\log"" --LogPrefix=${app}.log --LogLevel=debug --StdOutput=""{app}-${app.version}\var\log\${app}-stdout.log""
--StdError=""{app}-${app.versi
 on}\var\log\${app}-stderr.log"""; Flags: runhidden
-Filename: {app}-${app.version}\bin\${app}w.exe; Parameters: //ES//${app.displayname}; WorkingDir:
{app}-${app.version}\bin; Flags: postinstall nowait; Description: Runs the configuration manager
for the ${app} windows service
+Filename: {app}\bin\${app}.exe; WorkingDir: {app}\bin; Tasks: ; Languages: ; Parameters:
"//IS//${app.displayname} --Description=""${app.description} Service ${app.version} - ${app.url}""
--DisplayName=${app.displayname} --Install=""{app}\bin\${app}.exe"" --StartMode=jvm --StopMode=jvm
--StartClass=org.apache.directory.server.standalone.daemon.Bootstrapper --StartMethod prunsrvStart
--StartParams=""{app}"" --StopClass=org.apache.directory.server.standalone.daemon.Bootstrapper
--StopMethod prunsrvStop --StopParams=""{app}"" --Startup=manual --JvmOptions=""-D${app}.home={app}""
--Classpath=""{app}\bin\bootstrapper.jar;{app}\conf;{app}\bin\logger.jar;{app}\bin\daemon.jar""
--LogPath=""{app}\var\log"" --LogPrefix=${app}.log --LogLevel=debug --StdOutput=""{app}\var\log\${app}-stdout.log""
--StdError=""{app}\var\log\${app}-stderr.log"""; Flags: runhidden
+Filename: {app}\bin\${app}w.exe; Parameters: //ES//${app.displayname}; WorkingDir: {app}\bin;
Flags: postinstall nowait; Description: Runs the configuration manager for the ${app} windows
service
 
 [Registry]
 
 [UninstallRun]
-Filename: {app}-${app.version}\bin\${app}.exe; WorkingDir: {app}-${app.version}\bin; Parameters:
//DS//${app.displayname}
+Filename: {app}\bin\${app}.exe; WorkingDir: {app}\bin; Parameters: //DS//${app.displayname}

Modified: directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
(original)
+++ directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/DirectoryServer.java
Fri Jan 27 22:36:32 2006
@@ -22,7 +22,6 @@
 import javax.naming.Context;
 import javax.naming.directory.InitialDirContext;
 
-import org.apache.directory.server.standalone.daemon.DaemonApplication;
 import org.apache.directory.server.standalone.daemon.InstallationLayout;
 import org.apache.ldap.server.configuration.MutableServerStartupConfiguration;
 import org.apache.ldap.server.configuration.ShutdownConfiguration;
@@ -42,7 +41,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DirectoryServer implements DaemonApplication
+public class DirectoryServer 
 {
     private static final Logger log = LoggerFactory.getLogger( DirectoryServer.class );
     private Properties env;
@@ -53,7 +52,7 @@
     private boolean started = false;
 
 
-    public void init( InstallationLayout install, String[] args ) throws Exception
+    public void init( InstallationLayout install ) throws Exception
     {
         long startTime = System.currentTimeMillis();
         MutableServerStartupConfiguration cfg;
@@ -97,11 +96,11 @@
     }
     
 
-    public void start( boolean nowait ) 
+    public void start() 
     {
-        startNoWait = nowait;
+        startNoWait = false;
         
-        if ( nowait )
+        if ( false )
         {
             workerThread.start();
             started = true;
@@ -119,6 +118,9 @@
         {
             log.warn( "stop(String[]) called without calling init() and start()" );
             log.info( "Might be a procrun invocation as opposed to jsvc so we'll initiate
external shutdown procedure" );
+            
+            // real shutdown sequence goes here.
+            return;
         }
         
         worker.stop = true;

Modified: directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java?rev=373091&r1=373090&r2=373091&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java
(original)
+++ directory/trunks/apacheds/standalone/simple/main/src/main/java/org/apache/ldap/server/ServerMain.java
Fri Jan 27 22:36:32 2006
@@ -41,13 +41,13 @@
 
         if ( args.length > 0 )
         {
-            server.init( new InstallationLayout( args[0] ), null );
-            server.start( false );
+            server.init( new InstallationLayout( args[0] ) );
+            server.start();
         }
         else
         {
-            server.init( null, null );
-            server.start( false );
+            server.init( null );
+            server.start();
         }
     }
 }



Mime
View raw message