jmri.managers
Class AbstractReporterManager

java.lang.Object
  extended by jmri.managers.AbstractManager
      extended by jmri.managers.AbstractReporterManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, Manager, ReporterManager
Direct Known Subclasses:
InternalReporterManager, JMRIClientReporterManager, LnReporterManager, RfidReporterManager, RpsReporterManager

public abstract class AbstractReporterManager
extends AbstractManager
implements ReporterManager

Abstract partial implementation of a ReporterManager.

Author:
Bob Jacobsen Copyright (C) 2004

Field Summary
 
Fields inherited from class jmri.managers.AbstractManager
_tsys, _tuser
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
AbstractReporterManager()
           
 
Method Summary
 boolean allowMultipleAdditions(String systemName)
          A temporary method that determines if it is possible to add a range of turnouts in numerical order eg 10 to 30
protected abstract  Reporter createNewReporter(String systemName, String userName)
          Internal method to invoke the factory, after all the logic for returning an existing method has been invoked.
 Reporter getBySystemName(String name)
          Locate an instance based on a system name.
 Reporter getByUserName(String key)
          Locate an instance based on a user name.
 String getNextValidAddress(String curAddress, String prefix)
          Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.
 Reporter getReporter(String name)
          Locate via user name, then system name if needed.
 int getXMLOrder()
           
 Reporter newReporter(String systemName, String userName)
          Return an instance with the specified system and user names.
 Reporter provideReporter(String sName)
          Locate via user name, then system name if needed.
 char typeLetter()
           
 
Methods inherited from class jmri.managers.AbstractManager
addPropertyChangeListener, deregister, dispose, firePropertyChange, getBeanBySystemName, getInstanceBySystemName, getInstanceByUserName, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, registerSelf, removePropertyChangeListener, systemLetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.ReporterManager
getSystemNameList
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, dispose, getBeanBySystemName, getSystemNameArray, getSystemPrefix, makeSystemName, register, removePropertyChangeListener, systemLetter
 

Constructor Detail

AbstractReporterManager

public AbstractReporterManager()
Method Detail

getXMLOrder

public int getXMLOrder()
Specified by:
getXMLOrder in interface Manager
Specified by:
getXMLOrder in class AbstractManager

typeLetter

public char typeLetter()
Specified by:
typeLetter in interface Manager
Returns:
The type letter for a specific implementation

provideReporter

public Reporter provideReporter(String sName)
Description copied from interface: ReporterManager
Locate via user name, then system name if needed. If that fails, create a new Reporter. If the name is a valid system name, it will be used for the new Reporter. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.

Specified by:
provideReporter in interface ReporterManager
Parameters:
sName - User name, system name, or address which can be promoted to system name
Returns:
Never null

getReporter

public Reporter getReporter(String name)
Description copied from interface: ReporterManager
Locate via user name, then system name if needed. If that fails, return null

Specified by:
getReporter in interface ReporterManager
Returns:
null if no match found

getBySystemName

public Reporter getBySystemName(String name)
Description copied from interface: ReporterManager
Locate an instance based on a system name. Returns null if no instance already exists.

Specified by:
getBySystemName in interface ReporterManager
Returns:
requested Reporter object or null if none exists

getByUserName

public Reporter getByUserName(String key)
Description copied from interface: ReporterManager
Locate an instance based on a user name. Returns null if no instance already exists.

Specified by:
getByUserName in interface ReporterManager
Returns:
requested Reporter object or null if none exists

newReporter

public Reporter newReporter(String systemName,
                            String userName)
Description copied from interface: ReporterManager
Return an instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Reporter object representing a given physical Reporter and therefore only one with a specific system or user name.

This will always return a valid object reference; a new object will be created if necessary. In that case:

Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating Reporters when you should be looking them up.

Specified by:
newReporter in interface ReporterManager
Returns:
requested Reporter object (never null)

createNewReporter

protected abstract Reporter createNewReporter(String systemName,
                                              String userName)
Internal method to invoke the factory, after all the logic for returning an existing method has been invoked.

Returns:
never null

allowMultipleAdditions

public boolean allowMultipleAdditions(String systemName)
A temporary method that determines if it is possible to add a range of turnouts in numerical order eg 10 to 30

Specified by:
allowMultipleAdditions in interface ReporterManager

getNextValidAddress

public String getNextValidAddress(String curAddress,
                                  String prefix)
Description copied from interface: ReporterManager
Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.

Specified by:
getNextValidAddress in interface ReporterManager
Parameters:
curAddress - - The hardware address of the turnout we which to check.
prefix - - The System Prefix used to make up the systemName


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads