Class DefaultSystemConnectionMemo
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider,Disposable,SystemConnectionMemo
- Direct Known Subclasses:
AcelaSystemConnectionMemo,AnymaDMX_SystemConnectionMemo,BiDiBSystemConnectionMemo,CanSystemConnectionMemo,CaptiveSystemConnectionMemo,CMRISystemConnectionMemo,Dcc4PcSystemConnectionMemo,DCCppSystemConnectionMemo,DirectSystemConnectionMemo,EasyDccSystemConnectionMemo,EcosSystemConnectionMemo,GrapevineSystemConnectionMemo,IEEE802154SystemConnectionMemo,InternalSystemConnectionMemo,IpocsSystemConnectionMemo,JMRIClientSystemConnectionMemo,LocoNetSystemConnectionMemo,MapleSystemConnectionMemo,MarklinSystemConnectionMemo,MqttSystemConnectionMemo,MrcSystemConnectionMemo,Mx1SystemConnectionMemo,NceSystemConnectionMemo,OakTreeSystemConnectionMemo,QsiSystemConnectionMemo,RaspberryPiSystemConnectionMemo,RfidSystemConnectionMemo,RpsSystemConnectionMemo,SecsiSystemConnectionMemo,SerialSystemConnectionMemo,SpeedoSystemConnectionMemo,SprogSystemConnectionMemo,SRCPBusConnectionMemo,SRCPSystemConnectionMemo,TamsSystemConnectionMemo,TmccSystemConnectionMemo,XNetSystemConnectionMemo,XpaSystemConnectionMemo,Z21SystemConnectionMemo
Objects of specific subtypes of this are registered in the
InstanceManager to activate their particular system.
-
Field Summary
FieldsFields inherited from class jmri.beans.Bean
propertyChangeSupportFields inherited from interface jmri.SystemConnectionMemo
DEREGISTER, DISABLED, INTERVAL, STORE, SYSTEM_PREFIX, USER_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultSystemConnectionMemo(String prefix, String userName) -
Method Summary
Modifier and TypeMethodDescription<T> voidderegister(T item, Class<T> type) Remove a class object from the system connection memo classObjectMap.voiddispose()Dispose of System Connection.<T> TGet a manager for a specific type.Provide a factory for getting startup actions.protected abstract ResourceBundleProvide access to the ConsistManager for this particular connection.intDefault interval 250ms.booleanGet if the System Connection is currently Disabled.abstract <B extends NamedBean>
Comparator<B>getNamedBeanComparator(Class<B> type) Get the Comparator to be used for two NamedBeans.intGet the connection specific OutputInterval (in ms) to wait between/before commands are sent, configured in AdapterConfig.Provide access to the system prefix string.Provide access to the system user name string.booleanisDirty()Get if connection is dirty.booleanbooleanCheck if this connection provides a specific manager type.voidregister()Register with the SystemConnectionMemoManager and InstanceManager with proper ID for later retrieval as a generic system.voidvoidsetDisabled(boolean disabled) Set if the System Connection is currently Disabled.voidsetOutputInterval(int newInterval) final booleansetSystemPrefix(String systemPrefix) Set the system prefix.final booleansetUserName(String userName) Set the user name for the system connection.<T> voidStore a class object to the system connection memo.Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
classObjectMap
-
-
Constructor Details
-
DefaultSystemConnectionMemo
-
-
Method Details
-
register
Register with the SystemConnectionMemoManager and InstanceManager with proper ID for later retrieval as a generic system.This operation should occur only when the SystemConnectionMemo is ready for use.
- Specified by:
registerin interfaceSystemConnectionMemo
-
getSystemPrefix
Provide access to the system prefix string.This was previously called the "System letter".
- Specified by:
getSystemPrefixin interfaceSystemConnectionMemo- Returns:
- System prefix
-
setSystemPrefix
Set the system prefix.- Specified by:
setSystemPrefixin interfaceSystemConnectionMemo- Parameters:
systemPrefix- prefix to use for this system connection- Returns:
- true if the system prefix could be set
- Throws:
NullPointerException- if systemPrefix is null
-
getUserName
Provide access to the system user name string.This was previously fixed at configuration time.
- Specified by:
getUserNamein interfaceSystemConnectionMemo- Returns:
- User name of the connection
-
setUserName
Set the user name for the system connection.- Specified by:
setUserNamein interfaceSystemConnectionMemo- Parameters:
userName- user name to use for this system connection- Returns:
- true if the user name could be set.
- Throws:
NullPointerException- if name is null
-
provides
Check if this connection provides a specific manager type. This method must return false if a manager for the specific type is not provided, and must return true if a manager for the specific type is provided.- Specified by:
providesin interfaceSystemConnectionMemo- Parameters:
c- The class type for the manager to be provided- Returns:
- true if the specified manager is provided
- See Also:
-
get
Get a manager for a specific type. This method must return a non-null value ifprovides(java.lang.Class)is true for the type, and must return null if provides() is false for the type.- Specified by:
getin interfaceSystemConnectionMemo- Type Parameters:
T- Type of manager to get- Parameters:
type- Type of manager to get- Returns:
- The manager or null if provides() is false for T
- See Also:
-
dispose
Dispose of System Connection.Removes objects from classObjectMap after calling dispose if Disposable. Removes these objects from InstanceManager.
- Specified by:
disposein interfaceDisposable- Specified by:
disposein interfaceSystemConnectionMemo
-
getDisabled
Get if the System Connection is currently Disabled.- Specified by:
getDisabledin interfaceSystemConnectionMemo- Returns:
- true if Disabled, else false.
-
setDisabled
Set if the System Connection is currently Disabled.disabledAsLoaded is only set once. Sends PropertyChange on change of disabled status.
- Specified by:
setDisabledin interfaceSystemConnectionMemo- Parameters:
disabled- true to disable, false to enable.
-
getNamedBeanComparator
Get the Comparator to be used for two NamedBeans. This is typically anNamedBeanComparator, but may be any Comparator that works for this connection type.- Specified by:
getNamedBeanComparatorin interfaceSystemConnectionMemo- Type Parameters:
B- the type of NamedBean- Parameters:
type- the class of NamedBean- Returns:
- the Comparator
-
getActionFactory
Provide a factory for getting startup actions.This is a bound, read-only, property under the name "actionFactory".
- Specified by:
getActionFactoryin interfaceSystemConnectionMemo- Returns:
- the factory
-
getActionModelResourceBundle
-
isDirty
Get if connection is dirty. Checked fields are disabled, prefix, userName- Specified by:
isDirtyin interfaceSystemConnectionMemo- Returns:
- true if changed since loaded
-
isRestartRequired
- Specified by:
isRestartRequiredin interfaceSystemConnectionMemo
-
getConsistManager
Provide access to the ConsistManager for this particular connection.- Returns:
- the provided ConsistManager or null if the connection does not provide a ConsistManager
-
setConsistManager
-
store
Store a class object to the system connection memo.Does NOT register the class with InstanceManager.
On memo dispose, each class will be removed from InstanceManager, and if the class implements disposable, the dispose method is called.
- Type Parameters:
T- Class type obtained from item object.- Parameters:
item- the class object to store, eg. mySensorManagertype- Class type, eg. SensorManager.class
-
deregister
Remove a class object from the system connection memo classObjectMap.Does NOT remove the class from InstanceManager.
- Type Parameters:
T- Class type obtained from item object.- Parameters:
item- the class object to store, eg. mySensorManagertype- Class type, eg. SensorManager.class
-
getDefaultOutputInterval
Default interval 250ms. Get the Default connection specific OutputInterval to wait between/before commands are sent.- Specified by:
getDefaultOutputIntervalin interfaceSystemConnectionMemo- Returns:
- the default output interval time in ms.
-
getOutputInterval
Get the connection specific OutputInterval (in ms) to wait between/before commands are sent, configured in AdapterConfig. Used inAbstractTurnout.setCommandedStateAtInterval(int).- Specified by:
getOutputIntervalin interfaceSystemConnectionMemo- Returns:
- the output interval time in ms
-
setOutputInterval
- Specified by:
setOutputIntervalin interfaceSystemConnectionMemo
-