Package jmri.jmris
Class AbstractOperationsServer
java.lang.Object
jmri.jmris.AbstractOperationsServer
- All Implemented Interfaces:
PropertyChangeListener,EventListener
- Direct Known Subclasses:
SimpleOperationsServer
Abstract interface between the JMRI operations and a network connection
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LocationManagerprotected final TrainManagerprotected final HashMap<String,AbstractOperationsServer.TrainListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTrainToList(String trainId) constructTrainCaboose(String trainName) constructs a String containing the caboose on a trainconstructTrainLeadLoco(String trainName) Constructs a String containing the road and number of lead loco, if there's one assigned to the train.constructTrainLength(String trainName) constructs a String containing the length of a trainconstructTrainLocation(String trainName) constructs a String containing the location of a trainconstructTrainNumberOfCars(String trainName) constructs a String containing the number of cars in a trainconstructTrainStatus(String trainName) constructs a String containing the status of a trainconstructTrainWeight(String trainName) constructs a String containing the tonnage of a trainvoiddispose()protected AbstractOperationsServer.TrainListenergetListener(String trainId) static booleanabstract voidparseStatus(String statusString) abstract voidprotected voidremoveTrainFromList(String trainId) abstract voidsendErrorStatus(String errorStatus) abstract voidsendFullStatus(Train train) sends the full status for a train to a clientabstract voidabstract voidsendMessage(ArrayList<Attribute> contents) abstract voidstatic voidsetExactLocationName(boolean enabled) setTrainLocation(String trainName, String locationName) constructs a String containing the location of a trainterminateTrain(String trainName) tells Operations that a train has terminated.
-
Field Details
-
tm
-
lm
-
trains
-
-
Constructor Details
-
AbstractOperationsServer
public AbstractOperationsServer()
-
-
Method Details
-
sendTrainList
-
sendLocationList
-
constructTrainStatus
constructs a String containing the status of a train- Parameters:
trainName- is the name of the train. If not found in Operations, an error message is sent to the client.- Returns:
- the train's status as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
constructTrainLocation
constructs a String containing the location of a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the train's location, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
setTrainLocation
constructs a String containing the location of a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the clientlocationName- is the name of the desired location.- Returns:
- the train's location, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
setExactLocationName
-
isExactLoationNameEnabled
-
constructTrainLength
constructs a String containing the length of a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the train's length, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
constructTrainWeight
constructs a String containing the tonnage of a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the train's tonnage, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
constructTrainNumberOfCars
constructs a String containing the number of cars in a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the number of cars in a train, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
constructTrainLeadLoco
Constructs a String containing the road and number of lead loco, if there's one assigned to the train.- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the lead loco
- Throws:
IOException- on failure to send an error message to the client
-
constructTrainCaboose
constructs a String containing the caboose on a train- Parameters:
trainName- is the name of the desired train. If not found in Operations, an error message is sent to the client- Returns:
- the caboose on a train, as known by Operations
- Throws:
IOException- on failure to send an error message to the client
-
terminateTrain
tells Operations that a train has terminated. If not found in Operations, an error message is sent to the client- Parameters:
trainName- is the name of the train- Returns:
- the termination String
- Throws:
IOException- on failure to send an error message to the client
-
sendFullStatus
sends the full status for a train to a client- Parameters:
train- is the Train object we are sending information about.- Throws:
IOException- on failure to send an error message
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
addTrainToList
-
removeTrainFromList
-
getListener
-
dispose
-
sendMessage
- Throws:
IOException
-
sendErrorStatus
- Throws:
IOException
-
parseStatus
- Throws:
JmriExceptionIOException
-