org.jscience.net.ntp
Class TimeManager

java.lang.Object
  extended by org.jscience.net.ntp.TimeManager
Direct Known Subclasses:
LocalTimeManager

public abstract class TimeManager
extends java.lang.Object

This is an abstract class encapsulating the method for setting the system time on the local system. Setting the local time can be accomplished by some external process of shell-script, or more likely by using the 'Java Native Interface'.


Constructor Summary
TimeManager()
           
 
Method Summary
 void dispose()
          This method could be used to terminate an external helper process.
 void finalize()
          The default implementation of this method just invokes dispose().
static TimeManager getInstance()
          The factory method for obtaining an instance of 'TimeManager'.
abstract  void setTime(java.util.Date d)
          Set the local time to a given date.
 void setTime(long offset)
          Add a given offset to the local time.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeManager

public TimeManager()
Method Detail

setTime

public abstract void setTime(java.util.Date d)
Set the local time to a given date.

Parameters:
d - DOCUMENT ME!

setTime

public void setTime(long offset)
Add a given offset to the local time.

Parameters:
offset - DOCUMENT ME!

dispose

public void dispose()
             throws java.lang.Exception
This method could be used to terminate an external helper process. The default implementation does nothing.

Throws:
java.lang.Exception - We allow this method to throw arbitrary exceptions.

finalize

public void finalize()
The default implementation of this method just invokes dispose().

Overrides:
finalize in class java.lang.Object

getInstance

public static TimeManager getInstance()
                               throws java.lang.Exception
The factory method for obtaining an instance of 'TimeManager'. The default implementation returns an instance of 'LocalTimeManager'. More sophisticated implementations should check the name of the current operating system and act accordingly.

Returns:
DOCUMENT ME!
Throws:
java.lang.Exception - In the default implementation this method throws an exception if the class 'LocalTimeManager' is not present, or fails to load.
See Also:
LocalTimeManager