net.sourceforge.jsrvany
Class ServiceControlManager

java.lang.Object
  |
  +--net.sourceforge.jsrvany.ServiceControlManager

public final class ServiceControlManager
extends java.lang.Object

This class is a ServiceControlManager implemented as a singleton. It handles communication between the winNT service control window and the listening applications, passing the generated events onto applications

Copyright (c) 2000 Damian Fauth

 


Method Summary
 void addServiceControlListener(ServiceControlListener scl)
          add a specified ServiceControlListener
static ServiceControlManager getInstance()
          get the one allowed instance of this singleton ServiceControlManager
 java.util.Enumeration getServiceControlListeners()
          get all ServiceControlListeners registered with this ServiceControlManager
 void notifyAllListeners(ContinueServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void notifyAllListeners(InterrogateServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void notifyAllListeners(PauseServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void notifyAllListeners(StartServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void notifyAllListeners(StopServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void notifyAllListeners(TerminateServiceControlEvent e)
          notify all registered listeners of a ServiceControlEvent
 void removeAllServiceControlListener()
          remove all ServiceControListeners registered with this manager
 void removeServiceControlListener(ServiceControlListener scl)
          remove a specified ServiceControlListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceControlManager getInstance()
get the one allowed instance of this singleton ServiceControlManager
Returns:
ServiceControlManager is the manager singleton

addServiceControlListener

public void addServiceControlListener(ServiceControlListener scl)
add a specified ServiceControlListener
Parameters:
scl - is the ServiceControlListener to be added
Returns:
void

removeServiceControlListener

public void removeServiceControlListener(ServiceControlListener scl)
remove a specified ServiceControlListener
Parameters:
scl - is the ServiceControlListener to be added
Returns:
void

removeAllServiceControlListener

public void removeAllServiceControlListener()
remove all ServiceControListeners registered with this manager
Returns:
void

notifyAllListeners

public void notifyAllListeners(StopServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

notifyAllListeners

public void notifyAllListeners(StartServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

notifyAllListeners

public void notifyAllListeners(PauseServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

notifyAllListeners

public void notifyAllListeners(ContinueServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

notifyAllListeners

public void notifyAllListeners(TerminateServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

notifyAllListeners

public void notifyAllListeners(InterrogateServiceControlEvent e)
                        throws ServiceControlException
notify all registered listeners of a ServiceControlEvent
Parameters:
e - is the event typed as the appropriate subsclass of ServiceControlEvent
Returns:
void
Throws:
ServiceControlException - may be thrown if the service cannot respond correctly to the event

getServiceControlListeners

public java.util.Enumeration getServiceControlListeners()
get all ServiceControlListeners registered with this ServiceControlManager
Returns:
Enumeration being the listeners as an Enumeration