com.pentec.aserver
Class AServer

java.lang.Object
  extended by java.lang.Thread
      extended by com.pentec.aserver.AServer
All Implemented Interfaces:
java.lang.Runnable

public class AServer
extends java.lang.Thread

ADAPT Server

Author:
Pender Technology

Nested Class Summary
private static class AServer.AdapterList
           
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private static java.lang.String $Name
           
private static java.lang.String $Version
           
private static AServerPlugin[] children
           
private static java.lang.Class[] classes
           
private static java.io.PrintWriter logFile
           
static java.io.File[] logFiles
          Log files used by AServer starting with the most recent
private  java.util.Properties properties
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
private AServer()
           
 
Method Summary
private  void createChildren()
           
private  void ensureIdentity()
          Compare the local system name to the name corresponing to known OneWireAdapter IDs.
private static java.lang.String getAdapterAddress(com.dalsemi.onewire.adapter.DSPortAdapter adapter)
           
private static AServer.AdapterList getAdapters()
          Scan all USB adapters and the default adapter (whatever it may be).
static java.lang.String getVersion()
           
protected  java.lang.Class loadClass(java.lang.String $Class, java.lang.String $Package)
           
private  void loadClasses()
           
static void main(java.lang.String[] args)
           
 void run()
           
private static void setHostname(java.lang.String $Hostname)
          Set the system's hostname and reboot.
private  void startChildren()
           
protected static void stopChildren()
          Stop all children
static void stopOtherChildren(AServerPlugin preservedPlugin)
          Stop all but one child
 java.lang.String toString()
           
static java.lang.String whoAmI()
          Return the local host name as a string
static void writeLog(AServerPlugin callingPlugin, java.lang.String $Message)
          Write $Message to the AServer log file with callingPlugin's name and version prepending each line.
protected static void writeLog(java.lang.String $Message)
          Write $Message to the AServer log file with AServer's name and version prepended to each line.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

$Name

private static final java.lang.String $Name
See Also:
Constant Field Values

$Version

private static final java.lang.String $Version
See Also:
Constant Field Values

children

private static AServerPlugin[] children

classes

private static java.lang.Class[] classes

logFile

private static java.io.PrintWriter logFile

logFiles

public static final java.io.File[] logFiles
Log files used by AServer starting with the most recent


properties

private final java.util.Properties properties
Constructor Detail

AServer

private AServer()
         throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

createChildren

private void createChildren()
                     throws java.lang.Exception
Throws:
java.lang.Exception

ensureIdentity

private void ensureIdentity()
                     throws java.lang.Exception
Compare the local system name to the name corresponing to known OneWireAdapter IDs. If the names do not match, set the proper name and restart the system if possible. If not possible, continue with caution.

Throws:
java.lang.Exception

getAdapterAddress

private static java.lang.String getAdapterAddress(com.dalsemi.onewire.adapter.DSPortAdapter adapter)
                                           throws com.dalsemi.onewire.OneWireException,
                                                  java.lang.Exception
Throws:
com.dalsemi.onewire.OneWireException
java.lang.Exception

getAdapters

private static AServer.AdapterList getAdapters()
Scan all USB adapters and the default adapter (whatever it may be). We no longer scan for RS232 adapter because of device interference, mostly QuickSet's autobaud.


getVersion

public static java.lang.String getVersion()

loadClass

protected java.lang.Class loadClass(java.lang.String $Class,
                                    java.lang.String $Package)
                             throws java.lang.Exception
Throws:
java.lang.Exception

loadClasses

private void loadClasses()
                  throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setHostname

private static void setHostname(java.lang.String $Hostname)
                         throws java.lang.Exception
Set the system's hostname and reboot.

Parameters:
$Hostname - Name for the system
Throws:
java.lang.Exception

startChildren

private void startChildren()

stopChildren

protected static void stopChildren()
Stop all children


stopOtherChildren

public static void stopOtherChildren(AServerPlugin preservedPlugin)
Stop all but one child


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread

whoAmI

public static java.lang.String whoAmI()
Return the local host name as a string


writeLog

public static void writeLog(AServerPlugin callingPlugin,
                            java.lang.String $Message)
Write $Message to the AServer log file with callingPlugin's name and version prepending each line.

Parameters:
callingPlugin - AServer plugin making the request
$Message - Message to be written

writeLog

protected static void writeLog(java.lang.String $Message)
Write $Message to the AServer log file with AServer's name and version prepended to each line.

Parameters:
$Message - Message to be written