directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r373229 - in /directory/trunks/apacheds/standalone: daemon/src/main/java/org/apache/directory/server/standalone/daemon/ installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/ simple/main/src/main/java/org/ap...
Date Sat, 28 Jan 2006 19:49:37 GMT
Author: akarasulu
Date: Sat Jan 28 11:49:20 2006
New Revision: 373229

URL: http://svn.apache.org/viewcvs?rev=373229&view=rev
Log:
changes ...

 o more cleanups and refactoring 
 o added extra String[] to stop and start for shifted parameters
 o adjusted init script to use stop argument
 o bootstrapper does correct reflection to make respective calls now


Modified:
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/JsvcBootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
    directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/template.init
    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/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=373229&r1=373228&r2=373229&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
Sat Jan 28 11:49:20 2006
@@ -35,8 +35,9 @@
  */
 public class Bootstrapper
 {
+    public static final String[] EMPTY_STRARRAY = new String[0];
+    
     private static final Logger log = LoggerFactory.getLogger( Bootstrapper.class );
-    private static final String[] EMPTY_STRARRY = new String[0];
     private static final String START_CLASS_PROP = "bootstrap.start.class";
     private static final String STOP_CLASS_PROP = "bootstrap.stop.class";
     
@@ -98,7 +99,7 @@
     }
 
 
-    public void callInit()
+    public void callInit( String[] args )
     {
         Thread.currentThread().setContextClassLoader( application );
         Method op = null;
@@ -125,7 +126,8 @@
         
         try
         {
-            op = startObjectClass.getMethod( "init", new Class[] { InstallationLayout.class
} );
+            op = startObjectClass.getMethod( "init", 
+                new Class[] { InstallationLayout.class, EMPTY_STRARRAY.getClass() } );
         }
         catch ( Exception e )
         {
@@ -135,7 +137,7 @@
         
         try
         {
-            op.invoke( startObject, new Object[] { this.layout } );
+            op.invoke( startObject, new Object[] { this.layout, args } );
         }
         catch ( Exception e )
         {
@@ -147,14 +149,22 @@
     }
 
     
-    public void callStart()
+    public void callStart( boolean nowait )
     {
         Thread.currentThread().setContextClassLoader( application );
         Method op = null;
         
         try
         {
-            op = startObjectClass.getMethod( "start", null );
+            Method[] methods = startObjectClass.getMethods();
+            for ( int ii = 0; ii < methods.length; ii++ )
+            {
+                if ( methods[ii].getName().equals( "start" ) )
+                {
+                    op = methods[ii];
+                    break;
+                }
+            }
         }
         catch ( Exception e )
         {
@@ -164,7 +174,7 @@
         
         try
         {
-            op.invoke( startObject, null );
+            op.invoke( startObject, new Object[] { new Boolean( nowait ) } );
         }
         catch ( Exception e )
         {
@@ -176,7 +186,7 @@
     }
     
 
-    public void callStop()
+    public void callStop( String[] args )
     {
         Thread.currentThread().setContextClassLoader( application );
         Class clazz = null;
@@ -212,7 +222,7 @@
         
         try
         {
-            op = clazz.getMethod( "stop", new Class[] { EMPTY_STRARRY.getClass() } );
+            op = clazz.getMethod( "stop", new Class[] { EMPTY_STRARRAY.getClass() } );
         }
         catch ( Exception e )
         {
@@ -222,7 +232,7 @@
         
         try
         {
-            op.invoke( stopObject, new Object[] { EMPTY_STRARRY } );
+            op.invoke( stopObject, new Object[] { args } );
         }
         catch ( Exception e )
         {
@@ -259,5 +269,18 @@
         }
         
         Thread.currentThread().setContextClassLoader( parent );
+    }
+    
+    
+    public static String[] shift( String[]args, int amount )
+    {
+        if ( args.length > amount )
+        {
+            String[] shifted = new String[args.length-1];
+            System.arraycopy( args, 1, shifted, 0, shifted.length );
+            return shifted;
+        }
+        
+        return EMPTY_STRARRAY;
     }
 }

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/JsvcBootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/JsvcBootstrapper.java?rev=373229&r1=373228&r2=373229&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/JsvcBootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/JsvcBootstrapper.java
Sat Jan 28 11:49:20 2006
@@ -47,36 +47,21 @@
 
         setInstallationLayout( args[0] );
         setParentLoader( Thread.currentThread().getContextClassLoader() );
-        callInit();
-
-//        if ( args.length > 1 )
-//        {
-//            String[] shifted = new String[args.length-1];
-//            System.arraycopy( args, 1, shifted, 0, shifted.length );
-//            setInstallationLayout( args[0] );
-//            setParentLoader( Thread.currentThread().getContextClassLoader() );
-//            callInit();
-//        }
-//        else
-//        {
-//            callInit( EMPTY_STRARRAY );
-//        }
+        callInit( shift( args, 1 ) );
     }
     
     
     public void start()
     {
         log.debug( "start() called" );
-        callStart();
-//      callStart( true );
+        callStart( true );
     }
 
 
     public void stop() throws Exception
     {
         log.debug( "stop() called" );
-        callStop();
-        //callStop( EMPTY_STRARRAY );
+        callStop( EMPTY_STRARRAY );
     }
 
 

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java?rev=373229&r1=373228&r2=373229&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
Sat Jan 28 11:49:20 2006
@@ -74,15 +74,14 @@
             if ( command.equalsIgnoreCase( "start" ) )
             {
                 log.debug( "calling callInit(String[]) from main(String[])" );
-                instance.callInit();
-
+                instance.callInit( shift( args, 2 ) );
                 log.debug( "calling callStart() from main(String[])" );
-                instance.callStart();
+                instance.callStart( true );
             }
             else if ( command.equalsIgnoreCase( "stop" ) )
             {
                 log.debug( "calling callStop() from main(String[])" );
-                instance.callStop();
+                instance.callStop( shift( args, 2 ) );
                 log.debug( "calling callDestroy() from main(String[])" );
                 instance.callDestroy();
             }

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=373229&r1=373228&r2=373229&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
Sat Jan 28 11:49:20 2006
@@ -59,10 +59,9 @@
             instance.setParentLoader( Bootstrapper.class.getClassLoader() );
 
             log.debug( "prunsrvStart(String[]) calling callInit()" );
-            instance.callInit();
-
+            instance.callInit( shift( args, 1 ) );
             log.debug( "prunsrvStart(String[]) calling callStart()" );
-            instance.callStart();
+            instance.callStart( false );
 
             // This is only needed for procrun 
             while( true )
@@ -105,7 +104,7 @@
             instance.setParentLoader( Bootstrapper.class.getClassLoader() );
 
             log.debug( "prunsrvStop(String[]) calling callStop()" );
-            instance.callStop();
+            instance.callStop( shift( args, 1 ) );
             log.debug( "prunsrvStop(String[]) calling callDestroy()" );
             instance.callDestroy();
         }

Modified: directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/template.init
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/template.init?rev=373229&r1=373228&r2=373229&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/template.init
(original)
+++ directory/trunks/apacheds/standalone/installers/plugin/src/main/resources/org/apache/directory/server/standalone/installers/template.init
Sat Jan 28 11:49:20 2006
@@ -174,7 +174,7 @@
     -stop \
     -pidfile $PID_FILE \
     -Dlog4j.configuration=file://$SERVER_HOME/conf/log4j.properties\
-    org.apache.directory.server.standalone.daemon.JsvcBootstrapper 
+    org.apache.directory.server.standalone.daemon.JsvcBootstrapper stop
 
     if [ `uname` = "Darwin" ] ; then
         [ "$RETVAL" -eq 0 ] && echo successful ${app} server shutdown || \

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=373229&r1=373228&r2=373229&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
Sat Jan 28 11:49:20 2006
@@ -41,7 +41,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DirectoryServer 
+public class DirectoryServer
 {
     private static final Logger log = LoggerFactory.getLogger( DirectoryServer.class );
     private Properties env;
@@ -52,7 +52,7 @@
     private boolean started = false;
 
 
-    public void init( InstallationLayout install ) throws Exception
+    public void init( InstallationLayout install, String[] args ) throws Exception
     {
         long startTime = System.currentTimeMillis();
         MutableServerStartupConfiguration cfg;
@@ -96,11 +96,11 @@
     }
     
 
-    public void start() 
+    public void start( boolean nowait ) 
     {
-        startNoWait = false;
+        startNoWait = nowait;
         
-        if ( false )
+        if ( nowait )
         {
             workerThread.start();
             started = 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=373229&r1=373228&r2=373229&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
Sat Jan 28 11:49:20 2006
@@ -41,13 +41,13 @@
 
         if ( args.length > 0 )
         {
-            server.init( new InstallationLayout( args[0] ) );
-            server.start();
+            server.init( new InstallationLayout( args[0] ), null );
+            server.start( true );
         }
         else
         {
-            server.init( null );
-            server.start();
+            server.init( null, null );
+            server.start( true );
         }
     }
 }



Mime
View raw message