jmri.managers
Class AbstractProxyManager

Show UML class diagram
java.lang.Object
  extended by jmri.managers.AbstractProxyManager
All Implemented Interfaces:
Manager
Direct Known Subclasses:
ProxyLightManager, ProxyReporterManager, ProxySensorManager, ProxyTurnoutManager

public abstract class AbstractProxyManager
extends Object
implements Manager

Implementation of a Manager that can serves as a proxy for multiple system-specific implementations.

Automatically includes an Internal system, which need not be separately added any more.

Encapsulates access to the "Primary" manager, used by default.

Internally, this is done by using a list of all non-Internal managers, plus a separate reference to the internal manager.


Constructor Summary
AbstractProxyManager()
           
 
Method Summary
 void addManager(Manager m)
           
 void addPropertyChangeListener(PropertyChangeListener l)
          At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.
 void deregister(NamedBean s)
          Forget a NamedBean Object created outside the manager.
 void dispose()
          Free resources when no longer used.
 List<Manager> getManagerList()
          Returns a list of all managers, including the internal manager.
 String[] getSystemNameArray()
           
 List<String> getSystemNameList()
          Get a list of all system names.
 String getSystemPrefix()
          Provides access to the system prefix string.
 String makeSystemName(String s)
           
 NamedBean newNamedBean(String systemName, String userName)
          Return an instance with the specified system and user names.
 void register(NamedBean s)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
          At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.
 char systemLetter()
          Deprecated.  
 char typeLetter()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProxyManager

public AbstractProxyManager()
Method Detail

getManagerList

public List<Manager> getManagerList()
Returns a list of all managers, including the internal manager. This is not a live list.


addManager

public void addManager(Manager m)

newNamedBean

public NamedBean newNamedBean(String systemName,
                              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 turnout 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 NamedBean when you should be looking them up.

Returns:
requested NamedBean object (never null)

dispose

public void dispose()
Description copied from interface: Manager
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.

Specified by:
dispose in interface Manager

register

public void register(NamedBean s)
Remember a NamedBean Object created outside the manager.

Forwards the register request to the matching system

Specified by:
register in interface Manager

deregister

public void deregister(NamedBean s)
Forget a NamedBean Object created outside the manager.

Forwards the deregister request to the matching system

Specified by:
deregister in interface Manager

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Manager
At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.

Specified by:
addPropertyChangeListener in interface Manager

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Manager
At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.

Specified by:
removePropertyChangeListener in interface Manager

getSystemPrefix

public String getSystemPrefix()
Description copied from interface: Manager
Provides access to the system prefix string. This was previously called the "System letter"

Specified by:
getSystemPrefix in interface Manager
Returns:
The system-specific prefix letter for the primary implementation

systemLetter

@Deprecated
public char systemLetter()
Deprecated. 

Provide 1st char of systemPrefix for now

Specified by:
systemLetter in interface Manager
Returns:
The system-specific prefix letter for a specific implementation

typeLetter

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

makeSystemName

public String makeSystemName(String s)
Specified by:
makeSystemName in interface Manager
Returns:
A system name from a user input, typically a number, from the primary system.

getSystemNameArray

public String[] getSystemNameArray()
Specified by:
getSystemNameArray in interface Manager

getSystemNameList

public List<String> getSystemNameList()
Get a list of all system names.

Specified by:
getSystemNameList in interface Manager


Copyright © 1997 - 2010 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