- Type Parameters:
E- the type of NamedBean supported by this manager
- All Superinterfaces:
PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeProvider
- All Known Subinterfaces:
AnalogActionManager,AnalogExpressionManager,AnalogIOManager,AudioManager,AudioSourceManager,BaseManager<E>,CatalogTreeManager,ConditionalManager,ConditionalNG_Manager,DigitalActionManager,DigitalBooleanActionManager,DigitalExpressionManager,GlobalVariableManager,HasAverageMeter,IdTagManager,LightManager,LogixManager,LogixNG_Manager,MemoryManager,MeterManager,ModuleManager,NamedTableManager,ProvidingManager<E>,ProxyManager<B>,RailComManager,ReporterManager,RouteManager,SectionManager,SensorManager,SignalGroupManager,SignalHeadManager,SignalMastLogicManager,SignalMastManager,SignalSystemManager,StringActionManager,StringExpressionManager,StringIOManager,TransitManager,TurnoutManager,VariableLightManager
- All Known Implementing Classes:
AbstractAnalogIOManager,AbstractAudioManager,AbstractBaseManager,AbstractLightManager,AbstractManager,AbstractMemoryManager,AbstractMeterManager,AbstractProvidingProxyManager,AbstractProxyManager,AbstractReporterManager,AbstractSensorManager,AbstractSignalHeadManager,AbstractStringIOManager,AbstractTurnoutManager,AcelaLightManager,AcelaSensorManager,AcelaTurnoutManager,BiDiBLightManager,BiDiBReporterManager,BiDiBSensorManager,BiDiBTurnoutManager,BlockManager,CbusLightManager,CbusReporterManager,CbusSensorManager,CbusTurnoutManager,ConcentratorReporterManager,ConcentratorSensorManager,Dcc4PcReporterManager,Dcc4PcSensorManager,DCCppLightManager,DCCppSensorManager,DCCppTurnoutManager,DefaultAnalogActionManager,DefaultAnalogExpressionManager,DefaultAudioManager,DefaultAudioSourceManager,DefaultCatalogTreeManager,DefaultConditionalManager,DefaultConditionalNGManager,DefaultDigitalActionManager,DefaultDigitalBooleanActionManager,DefaultDigitalExpressionManager,DefaultGlobalVariableManager,DefaultIdTagManager,DefaultLogixManager,DefaultLogixNGManager,DefaultMemoryManager,DefaultModuleManager,DefaultNamedTableManager,DefaultRailComManager,DefaultRouteManager,DefaultSectionManager,DefaultSignalGroupManager,DefaultSignalMastLogicManager,DefaultSignalMastManager,DefaultSignalSystemManager,DefaultStringActionManager,DefaultStringExpressionManager,DefaultTransitManager,DefaultVariableLightManager,EasyDccTurnoutManager,EcosLocoAddressManager,EcosReporterManager,EcosSensorManager,EcosTurnoutManager,EliteXNetTurnoutManager,EntryExitPairs,InternalAnalogIOManager,InternalLightManager,InternalMeterManager,InternalReporterManager,InternalSensorManager,InternalStringIOManager,InternalTurnoutManager,IpocsLightManager,IpocsSensorManager,IpocsTurnoutManager,JMRIClientLightManager,JMRIClientReporterManager,JMRIClientSensorManager,JMRIClientTurnoutManager,LayoutBlockManager,LnLightManager,LnReporterManager,LnSensorManager,LnSensorManager,LnStringIOManager,LnTurnoutManager,MarklinSensorManager,MarklinTurnoutManager,MqttLightManager,MqttReporterManager,MqttSensorManager,MqttTurnoutManager,MrcTurnoutManager,Mx1TurnoutManager,NamedBeanHandleManager,NceLightManager,NceSensorManager,NceTurnoutManager,OBlockManager,OlcbLightManager,OlcbMeterManager,OlcbReporterManager,OlcbSensorManager,OlcbStringIOManager,OlcbTurnoutManager,ProxyAnalogIOManager,ProxyIdTagManager,ProxyLightManager,ProxyMeterManager,ProxyReporterManager,ProxySensorManager,ProxyStringIOManager,ProxyTurnoutManager,RaspberryPiSensorManager,RaspberryPiTurnoutManager,RfidReporterManager,RfidSensorManager,RpsReporterManager,RpsSensorManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialSensorManager,SerialSensorManager,SerialSensorManager,SerialSensorManager,SerialSensorManager,SerialSensorManager,SerialTurnoutManager,SerialTurnoutManager,SerialTurnoutManager,SerialTurnoutManager,SerialTurnoutManager,SerialTurnoutManager,SerialTurnoutManager,SpecificLightManager,SpecificLightManager,SpecificLightManager,SpecificLightManager,SpecificLightManager,SpecificSensorManager,SpecificSensorManager,SpecificSensorManager,SpecificSensorManager,SprogTurnoutManager,SRCPSensorManager,SRCPTurnoutManager,StandaloneReporterManager,StandaloneSensorManager,TamsSensorManager,TamsTurnoutManager,TranspondingTagManager,UsbLightManager,WarrantManager,XBeeLightManager,XBeeSensorManager,XBeeTurnoutManager,XNetLightManager,XNetSensorManager,XNetTurnoutManager,XpaTurnoutManager,Z21ReporterManager,Z21SensorManager,Z21XNetTurnoutManager,ZTC611XNetTurnoutManager
NamedBean objects represent various real elements, and have a "system
name" and perhaps "user name". A specific Manager object provides access to
them by name, and serves as a factory for new objects.
Right now, this interface just contains the members needed by
InstanceManager to handle managers for more than one system.
Although they are not defined here because their return type differs, any specific Manager subclass provides "get" methods to locate specific objects, and a "new" method to create a new one via the Factory pattern. The "get" methods will return an existing object or null, and will never create a new object. The "new" method will log a warning if an object already exists with that system name.
add/remove PropertyChangeListener methods are provided. At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.
Probably should have been called NamedBeanManager
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classManager.ManagerDataEvent<E extends NamedBean>Define an event that encapsulates changes to a list.static interfaceManager.ManagerDataListener<E extends NamedBean>Intended to be equivalent toListDataListenerwithout introducing a Swing dependency into core JMRI.static enumCode the validity (including just as a prefix) of a proposed name string. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringString constant for changes to the number of managed Beans, normally silenced during panel load.static final StringString constant to represent if a Bean can be deleted.static final StringString constant for DisplayListName.static final StringString constant to tell the Manager to actually delete the Bean.static final StringString constant to represent if a Bean should NOT be deleted.static final StringString constant for number of managed Beansstatic final intstatic final intstatic final intstatic final intstatic final intThe order in which things get saved to the xml file.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister aManager.ManagerDataListenerto hear about adding or removing items from the list of NamedBeans.voiddeleteBean(E n, String property) Method for a UI to delete a bean.voidderegister(E n) Forget a NamedBean Object created outside the manager.voiddispose()Free resources when no longer used.default StringGet the user-readable name of the type of NamedBean handled by this manager.getBeanTypeHandled(boolean plural) Get the user-readable name of the type of NamedBean handled by this manager.getBySystemName(String systemName) Locate an existing instance based on a system name.getByUserName(String userName) Locate an existing instance based on a user name.default StringGet a manager-specific tool tip for adding an entry to the manager.default List<NamedBeanPropertyDescriptor<?>>Return the descriptors for the system-specific properties of the NamedBeans that are kept in this manager.getMemo()Get the system connection for this manager.getNamedBean(String name) Locate an existing instance based on a name.Get the class of NamedBean supported by this Manager.Provide an unmodifiable SortedSet of NamedBeans in system-name order.intGet the count of managed objects.default StringGet the sub system prefix of this manager.default StringGet the prefix and type for the system name of the NamedBeans handled by this manager.Provide access to the system prefix string.static StringgetSystemPrefix(String inputName) Provides the system prefix of the given system name.static intgetSystemPrefixLength(String inputName) Provide length of the system prefix of the given system name.static StringgetSystemSuffix(String inputName) Provides the suffix (part after the type letter) of the given system name.static StringgetTypeLetter(String inputName) Provides the type letter of the given system name.intDetermine the order that types should be written when storing panel files.default booleanisValidSystemNameFormat(String systemName) Test if a given name is in a valid format for this Manager.default StringmakeSystemName(String name) Create a SystemName by prepending the system name prefix to the name if not already present.default StringmakeSystemName(String name, boolean logErrors) Create a SystemName by prepending the system name prefix to the name if not already present.default StringmakeSystemName(String name, boolean logErrors, Locale locale) Create a SystemName by prepending the system name prefix to the name if not already present.voidRemember a NamedBean Object created outside the manager.voidUnregister a previously-addedManager.ManagerDataListener.default voidsetDataListenerMute(boolean muted) Temporarily suppress DataListener notifications.chardefault StringvalidateBadCharsInSystemNameFormat(String name, Locale locale, String[] invalidChars) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has no invalid characters in the string.default StringvalidateIntegerSystemNameFormat(String name, int min, int max, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is an integer after the prefix.default StringvalidateNmraAccessorySystemNameFormat(String name, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is a valid NMRA Accessory address after the prefix.default StringValidate the format of a system name, returning it unchanged if valid.default StringvalidateSystemNameFormat(String name, Locale locale) Validate the format of name, returning it unchanged if valid.default StringvalidateSystemNameFormatOnlyNumeric(String name, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name String is purely numeric.default StringvalidateSystemNamePrefix(String name, Locale locale) Basic validation that the system name prefix is correct.default StringvalidateTrimmedMin1NumberSystemNameFormat(String name, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has has at least 1 number in the String.default StringvalidateTrimmedSystemNameFormat(String name, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has no trailing white space and no white space between the prefix and suffix.default StringvalidateUppercaseTrimmedSystemNameFormat(String name, Locale locale) Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is upper case and has no trailing white space and not white space between the prefix and suffix.default Manager.NameValidityvalidSystemNameFormat(String systemName) Test if parameter is a properly formatted system name.Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilencedMethods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
PROPERTY_CAN_DELETE
String constant to represent if a Bean can be deleted.- See Also:
-
PROPERTY_DO_DELETE
String constant to tell the Manager to actually delete the Bean.- See Also:
-
PROPERTY_DO_NOT_DELETE
String constant to represent if a Bean should NOT be deleted.- See Also:
-
PROPERTY_BEANS
String constant for changes to the number of managed Beans, normally silenced during panel load.- See Also:
-
PROPERTY_LENGTH
String constant for number of managed Beans- See Also:
-
PROPERTY_DISPLAY_LIST_NAME
String constant for DisplayListName.- See Also:
-
SENSORS
The order in which things get saved to the xml file.- See Also:
-
TURNOUTS
- See Also:
-
LIGHTS
- See Also:
-
REPORTERS
- See Also:
-
MEMORIES
- See Also:
-
SENSORGROUPS
- See Also:
-
SIGNALHEADS
- See Also:
-
SIGNALMASTS
- See Also:
-
SIGNALGROUPS
- See Also:
-
BLOCKS
- See Also:
-
OBLOCKS
- See Also:
-
LAYOUTBLOCKS
- See Also:
-
SECTIONS
- See Also:
-
TRANSITS
- See Also:
-
BLOCKBOSS
- See Also:
-
ROUTES
- See Also:
-
WARRANTS
- See Also:
-
SIGNALMASTLOGICS
- See Also:
-
IDTAGS
- See Also:
-
ANALOGIOS
- See Also:
-
METERS
- See Also:
-
STRINGIOS
- See Also:
-
LOGIXS
- See Also:
-
CONDITIONALS
- See Also:
-
AUDIO
- See Also:
-
TIMEBASE
- See Also:
-
LOGIXNGS
- See Also:
-
LOGIXNG_GLOBAL_VARIABLES
- See Also:
-
LOGIXNG_CONDITIONALNGS
- See Also:
-
LOGIXNG_MODULES
- See Also:
-
LOGIXNG_TABLES
- See Also:
-
LOGIXNG_DIGITAL_EXPRESSIONS
- See Also:
-
LOGIXNG_DIGITAL_ACTIONS
- See Also:
-
LOGIXNG_DIGITAL_BOOLEAN_ACTIONS
- See Also:
-
LOGIXNG_ANALOG_EXPRESSIONS
- See Also:
-
LOGIXNG_ANALOG_ACTIONS
- See Also:
-
LOGIXNG_STRING_EXPRESSIONS
- See Also:
-
LOGIXNG_STRING_ACTIONS
- See Also:
-
PANELFILES
- See Also:
-
ENTRYEXIT
- See Also:
-
METERFRAMES
- See Also:
-
CTCDATA
- See Also:
-
-
Method Details
-
getMemo
Get the system connection for this manager.- Returns:
- the system connection for this manager
-
getSystemPrefix
Provide access to the system prefix string. This was previously called the "System letter"- Returns:
- the system prefix
-
typeLetter
- Returns:
- The type letter for a specific implementation
-
getNamedBeanClass
Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.- Returns:
- the class supported by this Manager.
-
getSystemNamePrefix
Get the prefix and type for the system name of the NamedBeans handled by this manager.- Returns:
- the prefix generated by concatenating the result of
getSystemPrefix()andtypeLetter()
-
getSubSystemNamePrefix
Get the sub system prefix of this manager. The sub system prefix is the system name prefix and possibly some extra characters of the NamedBeans handled by this manager.For most managers, this is the same as
getSystemNamePrefix(), but for some like the managers in LogixNG, it differs.- Returns:
- the sub system prefix
-
makeSystemName
@Nonnull default String makeSystemName(@Nonnull String name) throws NamedBean.BadSystemNameException Create a SystemName by prepending the system name prefix to the name if not already present.Note: implementations must call
validateSystemNameFormat(java.lang.String, java.util.Locale)to ensure the returned name is valid.- Parameters:
name- the item to make the system name for- Returns:
- A system name from a user input, typically a number.
- Throws:
NamedBean.BadSystemNameException- if a valid name can't be created
-
makeSystemName
@Nonnull default String makeSystemName(@Nonnull String name, boolean logErrors) throws NamedBean.BadSystemNameException Create a SystemName by prepending the system name prefix to the name if not already present.The
logErrorsparameter is present to allow user interface input validation to use this method without logging system name validation errors as the user types.Note: implementations must call
validateSystemNameFormat(java.lang.String, java.util.Locale)to ensure the returned name is valid.- Parameters:
name- the item to make the system name forlogErrors- true to log errors; false to not log errors- Returns:
- a valid system name
- Throws:
NamedBean.BadSystemNameException- if a valid name can't be created
-
makeSystemName
@Nonnull default String makeSystemName(@Nonnull String name, boolean logErrors, Locale locale) throws NamedBean.BadSystemNameException Create a SystemName by prepending the system name prefix to the name if not already present.The
logErrorsparameter is present to allow user interface input validation to use this method without logging system name validation errors as the user types.Note: implementations must call
validateSystemNameFormat(java.lang.String, java.util.Locale)to ensure the returned name is valid.- Parameters:
name- the item to make the system name forlogErrors- true to log errors; false to not log errorslocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- a valid system name
- Throws:
NamedBean.BadSystemNameException- if a valid name can't be created
-
validateSystemNameFormat
@Nonnull default String validateSystemNameFormat(@Nonnull String name) throws NamedBean.BadSystemNameException Validate the format of a system name, returning it unchanged if valid.This is a convenience form of
validateSystemNameFormat(java.lang.String, java.util.Locale).This method should not be overridden;
validateSystemNameFormat(java.lang.String, java.util.Locale)should be overridden instead.- Parameters:
name- the system name, including system prefix and Type Letter to validate- Returns:
- the system name unchanged from its input so that this method can be chained or used as an parameter to another method
- Throws:
NamedBean.BadSystemNameException- if the name is not valid with error messages in the default locale
-
validateSystemNameFormat
@Nonnull default String validateSystemNameFormat(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Validate the format of name, returning it unchanged if valid.Although further restrictions may be added by system-specific implementations, at a minimum, the implementation must consider a name that does not start with the System Name prefix for this manager to be invalid, and must consider a name that is the same as the System Name prefix to be invalid.
Overriding implementations may rely on
validSystemNameFormat(java.lang.String), however they must provide an actionable message in the thrown exception if that method does not returnManager.NameValidity.VALID. When overriding implementations of this method rely on validSystemNameFormat(), implementations of that method must not throw an exception, log an error, or otherwise disrupt the user.- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateSystemNamePrefix
@Nonnull default String validateSystemNamePrefix(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Basic validation that the system name prefix is correct. Used within the default implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)and abstracted out of that method so this can be used by validation implementations inSystemConnectionMemos to avoid duplicating code in all managers relying on a single subclass of SystemConnectionMemo.- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateTrimmedSystemNameFormat
@Nonnull default String validateTrimmedSystemNameFormat(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has no trailing white space and no white space between the prefix and suffix.Note this must only be used if the connection type is externally documented to require these restrictions.
- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateTrimmedMin1NumberSystemNameFormat
@Nonnull default String validateTrimmedMin1NumberSystemNameFormat(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has has at least 1 number in the String.- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateSystemNameFormatOnlyNumeric
Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name String is purely numeric.- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateBadCharsInSystemNameFormat
@Nonnull default String validateBadCharsInSystemNameFormat(@Nonnull String name, @Nonnull Locale locale, @Nonnull String[] invalidChars) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name has no invalid characters in the string.Also checks validateSystemNamePrefix(name,locale);
- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple localesinvalidChars- array of invalid characters which cannot be in the system name.- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateUppercaseTrimmedSystemNameFormat
@Nonnull default String validateUppercaseTrimmedSystemNameFormat(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is upper case and has no trailing white space and not white space between the prefix and suffix.Note this must only be used if the connection type is externally documented to require these restrictions.
- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateIntegerSystemNameFormat
@Nonnull default String validateIntegerSystemNameFormat(@Nonnull String name, int min, int max, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is an integer after the prefix.Note this must only be used if the connection type is externally documented to require these restrictions.
- Parameters:
name- the system name to validatemin- the minimum valid integer valuemax- the maximum valid integer valuelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validateNmraAccessorySystemNameFormat
@Nonnull default String validateNmraAccessorySystemNameFormat(@Nonnull String name, @Nonnull Locale locale) throws NamedBean.BadSystemNameException Convenience implementation ofvalidateSystemNameFormat(java.lang.String, java.util.Locale)that verifies name is a valid NMRA Accessory address after the prefix. A name is considered a valid NMRA accessory address if it is an integer between 1 and 2044, inclusive.Note this must only be used if the connection type is externally documented to require these restrictions.
- Parameters:
name- the system name to validatelocale- the locale for a localized exception; this is needed for the JMRI web server, which supports multiple locales- Returns:
- the unchanged value of the name parameter
- Throws:
NamedBean.BadSystemNameException- if provided name is an invalid format
-
validSystemNameFormat
@CheckReturnValue @OverrideMustInvoke default Manager.NameValidity validSystemNameFormat(@Nonnull String systemName) Test if parameter is a properly formatted system name. Implementations of this method must not throw an exception, log an error, or otherwise disrupt the user.- Parameters:
systemName- the system name- Returns:
- enum indicating current validity, which might be just as a prefix
- Since:
- 4.9.5, although similar methods existed previously in lower-level classes
-
isValidSystemNameFormat
Test if a given name is in a valid format for this Manager.- Parameters:
systemName- the name to check- Returns:
trueifvalidSystemNameFormat(java.lang.String)equalsManager.NameValidity.VALID;falseotherwise
-
dispose
void dispose()Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected. -
getObjectCount
Get the count of managed objects.- Returns:
- the number of managed objects
-
getNamedBeanSet
Provide an unmodifiable SortedSet of NamedBeans in system-name order.Note: This is the fastest of the accessors, and is the only long-term form.
Note: This is a live set; the contents are kept up to date
- Returns:
- Unmodifiable access to a SortedSet of NamedBeans
-
getBySystemName
Locate an existing instance based on a system name.- Parameters:
systemName- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
- Throws:
IllegalArgumentException- if provided name is invalid
-
getByUserName
Locate an existing instance based on a user name.- Parameters:
userName- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getNamedBean
Locate an existing instance based on a name.- Parameters:
name- User Name or System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getKnownBeanProperties
Return the descriptors for the system-specific properties of the NamedBeans that are kept in this manager.- Returns:
- list of known properties, or empty list if there are none
-
deleteBean
Method for a UI to delete a bean.The UI should first request a "CanDelete", this will return a list of locations (and descriptions) where the bean is in use via throwing a VetoException, then if that comes back clear, or the user agrees with the actions, then a "DoDelete" can be called which inform the listeners to delete the bean, then it will be deregistered and disposed of.
If a property name of "DoNotDelete" is thrown back in the VetoException then the delete process should be aborted.
- Parameters:
n- The NamedBean to be deletedproperty- The programmatic name of the request. "CanDelete" will enquire with all listeners if the item can be deleted. "DoDelete" tells the listener to delete the item- Throws:
PropertyVetoException- If the recipients wishes the delete to be aborted (see above)
-
register
Remember a NamedBean Object created outside the manager.The non-system-specific SignalHeadManagers use this method extensively.
- Parameters:
n- the bean- Throws:
NamedBean.DuplicateSystemNameException- if a different bean with the same system name is already registered in the manager
-
deregister
Forget a NamedBean Object created outside the manager.The non-system-specific RouteManager uses this method.
- Parameters:
n- the bean
-
getXMLOrder
Determine the order that types should be written when storing panel files. Uses one of the constants defined in this class.Yes, that's an overly-centralized methodology, but it works for now.
- Returns:
- write order for this Manager; larger is later.
-
getBeanTypeHandled
Get the user-readable name of the type of NamedBean handled by this manager.For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.
- Returns:
- a string of the bean type that the manager handles, eg Turnout, Sensor etc
-
getBeanTypeHandled
Get the user-readable name of the type of NamedBean handled by this manager.For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.
- Parameters:
plural- true to return plural form of the type; false to return singular form- Returns:
- a string of the bean type that the manager handles, eg Turnout, Sensor etc
-
getSystemPrefixLength
Provide length of the system prefix of the given system name.This is a common operation across JMRI, as the system prefix can be parsed out without knowledge of the type of NamedBean involved.
- Parameters:
inputName- System Name to provide the prefix- Returns:
- The length of the system-prefix part of the system name in standard normalized form
- Throws:
NamedBean.BadSystemNameException- If the inputName is not in normalized form
-
getSystemPrefix
Provides the system prefix of the given system name.This is a common operation across JMRI, as the system prefix can be parsed out without knowledge of the type of NamedBean involved.
- Parameters:
inputName- System name to provide the prefix- Returns:
- The system-prefix part of the system name in standard normalized form
- Throws:
NamedBean.BadSystemNameException- If the inputName is not in normalized form
-
getTypeLetter
Provides the type letter of the given system name.This is a common operation across JMRI, as the system prefix can be parsed out without knowledge of the type of NamedBean involved.
- Parameters:
inputName- System name to provide the type letter- Returns:
- The type letter of the system name
- Throws:
NamedBean.BadSystemNameException- If the inputName is not in normalized form
-
getSystemSuffix
Provides the suffix (part after the type letter) of the given system name.This is a common operation across JMRI, as the system prefix can be parsed out without knowledge of the type of NamedBean involved.
- Parameters:
inputName- System name to provide the suffix- Returns:
- The suffix part of the system name
- Throws:
NamedBean.BadSystemNameException- If the inputName is not in normalized form
-
getEntryToolTip
Get a manager-specific tool tip for adding an entry to the manager.- Returns:
- the tool tip or null to disable the tool tip
-
addDataListener
Register aManager.ManagerDataListenerto hear about adding or removing items from the list of NamedBeans.- Parameters:
e- the data listener to add
-
removeDataListener
Unregister a previously-addedManager.ManagerDataListener.- Parameters:
e- the data listener to remove- See Also:
-
setDataListenerMute
Temporarily suppress DataListener notifications.This avoids O(N^2) behavior when doing bulk updates, i.e. when loading lots of Beans. Note that this is (1) optional, in the sense that the manager is not required to mute and (2) if present, its' temporary, in the sense that the manager must do a cumulative notification when done.
- Parameters:
muted- true if notifications should be suppressed; false otherwise
-