|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.console.models.Manager
public abstract class Manager
Superclass of all Managers. Handles the collection and notification of ManagerListeners with ModelChangeEvents
ModelChangeEvent
,
ManagerListener
Field Summary | |
---|---|
static java.lang.String |
MODEL_CHANGED
This is the message sent along with a ModelChangedEvent, in the event that a Manager now has new data |
static java.lang.String |
MODEL_STALE
This is the message sent along with a ModelChangedEvent, in the event that a Manager's data has become stale. |
Constructor Summary | |
---|---|
Manager(ConnectionInfo connection)
|
Method Summary | |
---|---|
void |
addManagerListener(ManagerListener listener)
Objects wishing to listen for ModelChangedEvents can register themselves as a listener for this Manager. |
protected void |
fireModelChangedEvent(java.lang.String message)
This method is intended to be called by subclasses to fire event with a specific meaning (indicated by the message parameter). |
protected void |
fireModelChangedEvent(java.lang.String message,
java.lang.Object arg)
This method is intended to be called by subclasses to fire event with a specific meaning (indicated by the message parameter and the Object argument). |
ConnectionInfo |
getConnection()
Get a connection to the server. |
ConnectionInfo |
getConnection(boolean reconnect)
Get a connection to the server. |
Encryptor |
getEncryptor()
Get encryptor to use for encrypting passwords to send from the client to the server. |
protected java.util.List |
getEventListeners()
|
boolean |
getIsStale()
Indicates whether this Manager's cached data is stale (i.e. |
void |
init()
Needs to be called by subclasses - sets up event listening. |
void |
refresh()
Refresh tells a manager that it's data is stale and it should retrieve real data (rather than cached data) the next time data is requested. |
void |
removeManagerListener(ManagerListener listener)
Objects not wishing to listen to this Manager's ModelChangedEvents anymore can unregister themselves as a listener |
void |
setIsStale(boolean isStale)
Sets the isStale flag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MODEL_CHANGED
ModelChangedEvent
,
Constant Field Valuespublic static final java.lang.String MODEL_STALE
MODEL_CHANGED
,
ModelChangedEvent
,
Constant Field ValuesConstructor Detail |
---|
public Manager(ConnectionInfo connection)
Method Detail |
---|
public ConnectionInfo getConnection(boolean reconnect)
reconnect
- If true, reconnect if not currently connected.
public ConnectionInfo getConnection()
public void init()
TODO: Perhaps this superclass should set itself to stale as part of the initialization process (see commented code in method body). That would broadcast an event to listeners which would prompt them to begin calling methods on a Manager - or perhaps a start() method with this code should be defined that will be called after init() (allowing subclasses to extend init() before start() would be called)
public void refresh()
Currently this method simply calls setIsStale(false)
setIsStale(boolean)
public void addManagerListener(ManagerListener listener)
listener
- an object implementing ManagerListener interfaceModelChangedEvent
,
ManagerListener
public void removeManagerListener(ManagerListener listener)
listener
- an object implementing ManagerListener interfaceModelChangedEvent
,
ManagerListener
protected void fireModelChangedEvent(java.lang.String message)
message
- String
assumed to be passed in by
subclass using this message. This class provides some String
constants which can be used for this message, and each subclass
will likely provide additional String constantsMODEL_CHANGED
,
MODEL_STALE
protected void fireModelChangedEvent(java.lang.String message, java.lang.Object arg)
message
- String
assumed to be passed in by
subclass using this message. This class provides some String
constants which can be used for this message, and each subclass
will likely provide additional String constantsarg
- optional Object argumentMODEL_CHANGED
,
MODEL_STALE
public boolean getIsStale()
Listeners are notified once a Manager becomes stale - it is up to a listener to request a specific service from a Manager (subclass) and thus prompt a Manager to update its data. This allows for the case where a Manager becomes stale, and a listener (perhaps part of a GUI that is currently not visible) does not yet need refreshed data.
public void setIsStale(boolean isStale)
isStale
- boolean indicates whether this Manager considers it's
data to be stale and is due to refresh itModelChangedEvent
,
ManagerListener
,
MODEL_STALE
protected java.util.List getEventListeners()
public Encryptor getEncryptor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |