public class YouScopeServerImpl extends java.lang.Object implements YouScopeServer
Modifier and Type | Field and Description |
---|---|
static int |
REGISTRY_PORT
The standard port for this server.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(MessageListener listener)
Adds a listener which detects new messages from the server/microscope.
|
void |
addServerFinishListener(java.awt.event.ActionListener listener)
Adds a listener which gets notified if the server finished execution.
|
void |
addStateListener(MicroscopeStateListener listener)
Adds a listener which detects state changes from the server/microscope.
|
protected boolean |
addSystemTray() |
void |
emergencyStop()
Stops the XY stage of the microscope and prevents ASAP any other thread to obtain access to
the microscope.
|
protected void |
finalize() |
ComponentProvider |
getComponentProvider(CallbackProvider callbackProvider)
Returns a provider for the construction of measurement components, e.g.
|
Measurement |
getCurrentMeasurement()
Returns the currently running measurement or NULL, if none is running.
|
static YouScopeServerImpl |
getMainProgram()
Returns the one and only object of this class.
|
MeasurementProvider |
getMeasurementProvider()
Returns a provider for the construction of new measurements.
|
Measurement[] |
getMeasurementQueue()
Returns the currently queued measurements.
|
Microscope |
getMicroscope()
Returns an object allowing the access to the microscope.
|
YouScopeServerProperties |
getProperties()
Returns the properties of the server.
|
void |
initializeProgram()
Initializes the program by connecting and initializing the microscope.
|
void |
initializeProgram(java.lang.String configFile)
Initializes the program by connecting and initializing the microscope.
|
boolean |
isEmergencyStopped()
Returns true if microscope is currently in the emergency-stop state.
|
static void |
main(java.lang.String[] args) |
protected void |
quitDueToFatalError(java.lang.String errorDescription,
java.lang.Throwable exception) |
void |
quitProgram()
Shut down the program.
|
void |
removeMessageListener(MessageListener listener)
Removes a previously added listener.
|
void |
removeServerFinishListener(java.awt.event.ActionListener listener)
Removes a previously added listener.
|
void |
removeStateListener(MicroscopeStateListener listener)
Removes a previously added listener.
|
void |
resetEmergencyStop()
Resets the emergency-stop state, such that microscope can be accessed again.
|
void |
setConfigureMicroscopeConnection(boolean forceConfiguration)
If true, sets the YouScope server to ask for the microscope connection the next time.
|
void |
startProgram()
Starts and run the main loop of the server.
|
void |
startServer()
Adds the server to the registry such that it can be accessed by other processes or over the
network.
|
void |
startServer(int port,
java.lang.String password)
Adds the server to the registry such that it can be accessed by other processes or over the
network.
|
public static final int REGISTRY_PORT
public void startServer()
public void startServer(int port, java.lang.String password)
port
- Port at which the server should be available.password
- The password for this server.public void setConfigureMicroscopeConnection(boolean forceConfiguration)
forceConfiguration
- True if before the next time a microscope connection is
established, the user should be asked for the connection type.public void initializeProgram() throws MicroscopeException
MicroscopeException
public void initializeProgram(java.lang.String configFile) throws MicroscopeException
configFile
- The microscope configuration file with which the server should be started.
If set to null, no drivers are initialized.MicroscopeException
public void startProgram() throws MicroscopeException
MicroscopeException
public YouScopeServerProperties getProperties() throws java.rmi.RemoteException
YouScopeServer
getProperties
in interface YouScopeServer
java.rmi.RemoteException
protected void quitDueToFatalError(java.lang.String errorDescription, java.lang.Throwable exception)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public static void main(java.lang.String[] args)
args
- public static YouScopeServerImpl getMainProgram()
protected boolean addSystemTray()
public void quitProgram()
public void addServerFinishListener(java.awt.event.ActionListener listener)
listener
- The listener which should be added.public void removeServerFinishListener(java.awt.event.ActionListener listener)
listener
- The listener to be removed.public MeasurementProvider getMeasurementProvider()
YouScopeServer
getMeasurementProvider
in interface YouScopeServer
public void addMessageListener(MessageListener listener)
YouScopeServer
addMessageListener
in interface YouScopeServer
listener
- Listener which detects new messages.public void removeMessageListener(MessageListener listener)
YouScopeServer
removeMessageListener
in interface YouScopeServer
listener
- the listener.public Microscope getMicroscope() throws java.rmi.RemoteException
YouScopeServer
getMicroscope
in interface YouScopeServer
java.rmi.RemoteException
public Measurement getCurrentMeasurement() throws java.rmi.RemoteException
YouScopeServer
getCurrentMeasurement
in interface YouScopeServer
java.rmi.RemoteException
public Measurement[] getMeasurementQueue() throws java.rmi.RemoteException
YouScopeServer
getMeasurementQueue
in interface YouScopeServer
java.rmi.RemoteException
public void addStateListener(MicroscopeStateListener listener)
YouScopeServer
addStateListener
in interface YouScopeServer
listener
- Listener which detects state changes.public void removeStateListener(MicroscopeStateListener listener)
YouScopeServer
removeStateListener
in interface YouScopeServer
listener
- the listener.public void emergencyStop()
YouScopeServer
emergencyStop
in interface YouScopeServer
public void resetEmergencyStop()
YouScopeServer
resetEmergencyStop
in interface YouScopeServer
public boolean isEmergencyStopped()
YouScopeServer
isEmergencyStopped
in interface YouScopeServer
public ComponentProvider getComponentProvider(CallbackProvider callbackProvider) throws java.rmi.RemoteException
YouScopeServer
getComponentProvider
in interface YouScopeServer
callbackProvider
- A provider for callback interfaces. Can be null.java.rmi.RemoteException