jmri.managers
Class ProxyReporterManager

java.lang.Object
  extended by jmri.managers.AbstractProxyManager
      extended by jmri.managers.ProxyReporterManager
All Implemented Interfaces:
Manager, ReporterManager

public class ProxyReporterManager
extends AbstractProxyManager
implements ReporterManager

Implementation of a ReporterManager that can serves as a proxy for multiple system-specific implementations. The first to be added is the "Primary".

Author:
Bob Jacobsen Copyright (C) 2003

Constructor Summary
ProxyReporterManager()
           
 
Method Summary
 Reporter getBySystemName(String systemName)
          Locate an instance based on a system name.
 Reporter getByUserName(String userName)
          Locate an instance based on a user name.
 Reporter getReporter(String name)
          Locate via user name, then system name if needed.
 Reporter newReporter(String sysName, String userName)
          Return an instance with the specified system and user names.
 Reporter provideReporter(String name)
          Locate via user name, then system name if needed.
 
Methods inherited from class jmri.managers.AbstractProxyManager
addManager, addPropertyChangeListener, deregister, dispose, getSystemNameList, makeSystemName, register, removePropertyChangeListener, systemLetter, typeLetter
 
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, makeSystemName, register, removePropertyChangeListener, systemLetter, typeLetter
 

Constructor Detail

ProxyReporterManager

public ProxyReporterManager()
Method Detail

getReporter

public Reporter getReporter(String name)
Locate via user name, then system name if needed.

Specified by:
getReporter in interface ReporterManager
Parameters:
name -
Returns:
Null if nothing by that name exists

provideReporter

public Reporter provideReporter(String name)
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
Returns:
Never null under normal circumstances

getBySystemName

public Reporter getBySystemName(String systemName)
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 userName)
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 sysName,
                            String userName)
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 Sensor 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 for a valid request; 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 Sensors when you should be looking them up.

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


Copyright © 1997 - 2008 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: SourceForge_Logo