Author: elecharny
Date: Fri Nov 18 00:04:17 2016
New Revision: 1770290
URL: http://svn.apache.org/viewvc?rev=1770290&view=rev
Log:
Added the parameter to require or not teh servers to be started when we start the service
Modified:
directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/ApacheDsService.java
directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/UberjarMain.java
Modified: directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1770290&r1=1770289&r2=1770290&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/ApacheDsService.java
(original)
+++ directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/ApacheDsService.java
Fri Nov 18 00:04:17 2016
@@ -142,13 +142,26 @@ public class ApacheDsService
/**
+ * Starts various services configured according to the
+ *
+ * @param instanceLayout the on disk location's layout of the instance to be started
+ * @throws Exception If we failed to start the server
+ */
+ public void start( InstanceLayout instanceLayout ) throws Exception
+ {
+ start( instanceLayout, true );
+ }
+
+
+ /**
* starts various services configured according to the
* configuration present in the given instance's layout
*
- * @param instanceLayout the on disk location's layout of the intance to be started
- * @throws Exception
+ * @param instanceLayout the on disk location's layout of the instance to be started
+ * @param startServers Tell the server that the various servers have to be started too
+ * @throws Exception If we failed to start the server
*/
- public void start( InstanceLayout instanceLayout ) throws Exception
+ public void start( InstanceLayout instanceLayout, boolean startServers ) throws Exception
{
File partitionsDir = instanceLayout.getPartitionsDirectory();
@@ -184,10 +197,10 @@ public class ApacheDsService
dnFactory );
// start the LDAP server
- startLdap( directoryServiceBean.getLdapServerBean(), directoryService );
+ startLdap( directoryServiceBean.getLdapServerBean(), directoryService, startServers
);
// start the NTP server
- startNtp( directoryServiceBean.getNtpServerBean(), directoryService );
+ startNtp( directoryServiceBean.getNtpServerBean(), directoryService, startServers
);
// Initialize the DNS server (Not ready yet)
// initDns( configBean );
@@ -199,10 +212,10 @@ public class ApacheDsService
//startChangePwd( directoryServiceBean.getChangePasswordServerBean(), directoryService
);
// start the Kerberos server
- startKerberos( directoryServiceBean, directoryService );
+ startKerberos( directoryServiceBean, directoryService, startServers );
// start the jetty http server
- startHttpServer( directoryServiceBean.getHttpServerBean(), directoryService );
+ startHttpServer( directoryServiceBean.getHttpServerBean(), directoryService, startServers
);
LOG.info( "Registering config change listener" );
ConfigChangeListener configListener = new ConfigChangeListener( cpReader, directoryService
);
@@ -406,7 +419,7 @@ public class ApacheDsService
/**
* start the LDAP server
*/
- private void startLdap( LdapServerBean ldapServerBean, DirectoryService directoryService
) throws Exception
+ private void startLdap( LdapServerBean ldapServerBean, DirectoryService directoryService,
boolean startServers ) throws Exception
{
LOG.info( "Starting the LDAP server" );
long startTime = System.currentTimeMillis();
@@ -421,8 +434,11 @@ public class ApacheDsService
printBanner( BANNER_LDAP );
- // And start the server now
- ldapServer.start();
+ // And start the server now if required
+ if ( startServers )
+ {
+ ldapServer.start();
+ }
LOG.info( "LDAP server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
}
@@ -431,7 +447,7 @@ public class ApacheDsService
/**
* start the NTP server
*/
- private void startNtp( NtpServerBean ntpServerBean, DirectoryService directoryService
) throws Exception
+ private void startNtp( NtpServerBean ntpServerBean, DirectoryService directoryService,
boolean startServers ) throws Exception
{
LOG.info( "Starting the NTP server" );
long startTime = System.currentTimeMillis();
@@ -446,7 +462,10 @@ public class ApacheDsService
printBanner( BANNER_NTP );
- ntpServer.start();
+ if ( startServers )
+ {
+ ntpServer.start();
+ }
if ( LOG.isInfoEnabled() )
{
@@ -493,7 +512,7 @@ public class ApacheDsService
/**
* start the KERBEROS server
*/
- private void startKerberos( DirectoryServiceBean directoryServiceBean, DirectoryService
directoryService )
+ private void startKerberos( DirectoryServiceBean directoryServiceBean, DirectoryService
directoryService, boolean startServers )
throws Exception
{
LOG.info( "Starting the Kerberos server" );
@@ -514,7 +533,10 @@ public class ApacheDsService
printBanner( BANNER_KERBEROS );
- kdcServer.start();
+ if ( startServers )
+ {
+ kdcServer.start();
+ }
if ( LOG.isInfoEnabled() )
{
@@ -559,7 +581,7 @@ public class ApacheDsService
/**
* start the embedded HTTP server
*/
- private void startHttpServer( HttpServerBean httpServerBean, DirectoryService directoryService
) throws Exception
+ private void startHttpServer( HttpServerBean httpServerBean, DirectoryService directoryService,
boolean startServers ) throws Exception
{
httpServer = ServiceBuilder.createHttpServer( httpServerBean, directoryService );
@@ -572,7 +594,10 @@ public class ApacheDsService
LOG.info( "Starting the Http server" );
long startTime = System.currentTimeMillis();
- httpServer.start( getDirectoryService() );
+ if ( startServers )
+ {
+ httpServer.start( getDirectoryService() );
+ }
if ( LOG.isInfoEnabled() )
{
Modified: directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/UberjarMain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/UberjarMain.java?rev=1770290&r1=1770289&r2=1770290&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/UberjarMain.java
(original)
+++ directory/apacheds/branches/apacheds-value/service/src/main/java/org/apache/directory/server/UberjarMain.java
Fri Nov 18 00:04:17 2016
@@ -175,7 +175,7 @@ public class UberjarMain
try
{
- service.start( layout );
+ service.start( layout, false );
}
catch ( Exception e )
{
@@ -309,7 +309,7 @@ public class UberjarMain
}
- private static enum Action
+ private enum Action
{
START, STOP, REPAIR;
|