Package jmri.jmris

Class AbstractOperationsServer

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener
    Direct Known Subclasses:
    SimpleOperationsServer

    public abstract class AbstractOperationsServer
    extends java.lang.Object
    implements java.beans.PropertyChangeListener
    Abstract interface between the JMRI operations and a network connection
    • Method Detail

      • constructTrainStatus

        public java.lang.String constructTrainStatus​(java.lang.String trainName)
                                              throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainLocation

        public java.lang.String constructTrainLocation​(java.lang.String trainName)
                                                throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • setTrainLocation

        public java.lang.String setTrainLocation​(java.lang.String trainName,
                                                 java.lang.String locationName)
                                          throws java.io.IOException
        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
        locationName - is the name of the desired location.
        Returns:
        the train's location, as known by Operations
        Throws:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainLength

        public java.lang.String constructTrainLength​(java.lang.String trainName)
                                              throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainWeight

        public java.lang.String constructTrainWeight​(java.lang.String trainName)
                                              throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainNumberOfCars

        public java.lang.String constructTrainNumberOfCars​(java.lang.String trainName)
                                                    throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainLeadLoco

        public java.lang.String constructTrainLeadLoco​(java.lang.String trainName)
                                                throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • constructTrainCaboose

        public java.lang.String constructTrainCaboose​(java.lang.String trainName)
                                               throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • terminateTrain

        public java.lang.String terminateTrain​(java.lang.String trainName)
                                        throws java.io.IOException
        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:
        java.io.IOException - on failure to send an error message to the client
      • sendFullStatus

        public abstract void sendFullStatus​(Train train)
                                     throws java.io.IOException
        sends the full status for a train to a client
        Parameters:
        train - is the Train object we are sending information about.
        Throws:
        java.io.IOException - on failure to send an error message
      • propertyChange

        public abstract void propertyChange​(java.beans.PropertyChangeEvent e)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • addTrainToList

        protected void addTrainToList​(java.lang.String trainId)
      • sendMessage

        public abstract void sendMessage​(java.util.ArrayList<javax.management.Attribute> contents)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • sendErrorStatus

        public abstract void sendErrorStatus​(java.lang.String errorStatus)
                                      throws java.io.IOException
        Throws:
        java.io.IOException