PIRL

PIRL.Conductor.Maestro
Class Conductor_Table_Model

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by PIRL.Conductor.Maestro.Conductor_Table_Model
All Implemented Interfaces:
Serializable, EventListener, TableModel, Processing_Listener

public class Conductor_Table_Model
extends AbstractTableModel
implements Processing_Listener

A Conductor_Table_Model contains a table of Conductor identities each with its associated Remote_Theater Management and Manager.

A Conductor is represented by its identity Message which is supplemented by its Theater location plus any additional parameters that the application might find useful. The data model maintains a list of all known Conductor identities.

When a Conductor identity is added to the data model Remote_Theater Management is provided for it that uses a specified Theater. The data model will register itself with the Remote_Theater Management as a Processing_Listener. This is used to maintain the current Conductor processing state in each identity and to notify the listeners of this TableModel of state changes in addition to the usual data model content changes. Also, any TableModelListener may register with this data model to only receive notices of Conductor processing state changes.

A list of Managers associate with each Conductor is also maintained. A Condcutor is not required to have a Manager.

The TableModel interface that is implemented presents Theater locations in the first column and Conductor names in the second column.

Version:
1.42
Author:
Bradford Castalia, UA/PIRL
See Also:
Serialized Form

Field Summary
static String ADDRESS_PARAMETER_NAME
          Conductor identity parameters of interest to the data model.
static String[] Column_Names
          The names of the table columns.
static String CONDUCTOR_ID_PARAMETER_NAME
          Conductor identity parameters of interest to the data model.
static int CONDUCTORS_COLUMN
          The index of the Conductos column in the data model.
static String ID
          Class identification name with source code version and date.
static String PIPELINE_PARAMETER_NAME
          Conductor identity parameters of interest to the data model.
static String PROCESSING_STATE_PARAMETER_NAME
          Conductor identity parameters of interest to the data model.
static String THEATER_LOCATION_PARAMETER_NAME
          Conductor identity parameters of interest to the data model.
static int THEATERS_COLUMN
          The index of the Theaters column in the data model.
protected static int UNCHANGED_STATE
          Special Conductor processing state value that indicates no change from the current state.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
Conductor_Table_Model()
          Construct an empty Conductor_Table_Model.
 
Method Summary
 Conductor_Table_Model Add_State_Change_Listener(TableModelListener listener)
          Add a listener for Conductor processing state change events.
 void Clear()
          Clear the data model of all entries.
 boolean Close_All()
          Close all Managers and Remote_Theater Managements.
protected  int Close_Management(int row)
          Close the Remote_Theater Management at a data model index.
 boolean Close_Manager(int row)
          Close a Conductor Manager at a data model row index.
 void Close(int row)
          Close the Remote_Theater and Manager at a row index.
 boolean Close(Manager manager)
          Close a Conductor Manager.
 boolean Close(String theater_location)
          Close a Theater.
 String Conductor_Name(int row)
          Get the name of a Conductor at a data model index.
static String Conductor_Name(Message identity)
          Get the name of a Conductor from its identity.
 int Count(String theater_location, Conductor_Definition conductor_definition)
          Get the count of Conductors identities on a Theater that match a Conductor_Definition.
 int findColumn(String name)
          Find the data model column index of a name.
 Class getColumnClass(int column)
          Get the Class for a data model column.
 int getColumnCount()
          Get the number of columns in the data model.
 String getColumnName(int column)
          Get the name of a data model column.
 int getRowCount()
          Get the number of rows in the data model.
 Object getValueAt(int row, int column)
          Get the value of a data model cell.
static String Identification(Message identity)
          Get a Conductor identification from its identity.
 Message Identity(int row)
          Get the Identity of a Conductor at a row index.
 Message Identity(Manager manager)
          Get the Identity of a Conductor associated with a Manager.
 Conductor_Table_Model Identity(Message identity, Theater theater, Message client_identity)
          Add a Conductor identity to the data model.
 Message Identity(Remote_Theater management)
          Get the Identity of a Conductor associated with a Remote_Theater Management.
 int Index(Manager manager)
          Get the data model row index for a Conductor Manager.
 int Index(Message identity)
          Get the data model row index of a Conductor identity.
 int Index(Remote_Theater management)
          Get the data model row index for a Remote_Theater Management.
 boolean isCellEditable(int row, int column)
          Test if a data model cell is editable.
 String Location(int row)
          Get the Theater location of a Conductor at a data model index.
 Remote_Theater Management(int row)
          Get the Remote_Theater Management at a data model row index.
 Conductor_Table_Model Management(int row, Remote_Theater management)
          Set the Remote_Theater Management for a data model row index.
 Remote_Theater Management(Message identity)
          Get the Remote_Theater Management for a Conductor.
 Conductor_Table_Model Management(Message identity, Remote_Theater management)
          Set the Remote_Theater Management for a Conductor.
static Remote_Theater Management(Message conductor_identity, Theater theater, Message client_identity)
          Get Remote_Theater Management for a Conductor.
 Manager Manager(int row)
          Get the Conductor Manager for a data model row index.
 Conductor_Table_Model Manager(int row, Manager manager)
          Set the Manager for a data model row index.
 Manager Manager(Message identity)
          Get the Manager for a Conductor.
 int Matching_Index(Message identity)
          Get the data model row index of a Conductor with a matching identity.
protected static int Matching_Index(Message identity, List<Message> identities)
          Get the index of an identity Message in a list of identities.
 int Next_Index(String theater_location, int index)
          Get the data model row index of the next Conductor entry at a Theater location starting after a given index.
protected  void Notify_Deleted(int row)
          Notify table change listeners that a data model row has been deleted.
protected  void Notify_Deleted(int first_row, int last_row)
          Notify table change listeners that a data model row range has been deleted.
protected  Conductor_Table_Model_Event Notify_Deleting(int row)
          Notify processing state change listeners that a data model is about to be deleted.
protected  Conductor_Table_Model_Event Notify_Deleting(int first_row, int last_row)
          Notify table change listeners that a data model row range is about to be deleted.
protected  void Notify_Inserted(int row)
          Notify all listeners that a data model row has been inserted.
protected  void Notify_State_Change_Listeners(Conductor_Table_Model_Event event)
          Send a change notification to the processing state change listeners.
protected  void Notify_State_Changed(int row, int processing_state)
          Notify all listeners that a Conductor processing state changed.
protected  void Notify_Table_Change_Listeners(Conductor_Table_Model_Event event)
          Send a change notification to the table change listeners.
protected  void Notify_Table_Changed()
          Notify all listeners that the data model content has changed.
protected  void Notify_Updated(int row)
          Notify all listeners that a data model row has been updated.
protected  void Notify_Updated(int first_row, int last_row)
          Notify all listeners that a continguous range of data model rows have been updated.
 Remote_Theater Open_Management(Message conductor_identity, Theater theater, Message client_identity)
          Get Remote_Theater Management for a Conductor.
 Manager Open_Manager(int row)
          Open a Conductor Manager at a data model row index.
 boolean Opened(int row)
          Test if the Remote_Theater Management at a data model index is open.
 boolean Opened(Message identity)
          Test if the Remote_Theater associated with a Conductor identity is open.
static String Pipeline(Message identity)
          Get the name of a Conductor pipeline from its identity.
 void Processing_Event_Occurred(Processing_Event event)
          Event handler for Conductor Processing_Events.
 int Processing_State(int row)
          Get the processing state of a Conductor at a data model index.
static int Processing_State(Message identity)
          Get the processing state of a Conductor.
protected static void Processing_State(Message identity, int processing_state)
          Set the processing state of a Conductor.
 Profile Profile()
          Get a Profile of the Conductors.
protected  Message Remove_at(int row)
          Remove a data model row entry.
 boolean Remove_State_Change_Listener(TableModelListener listener)
          Remove a listener for Conductor processing state change events.
 Message Remove(int row)
          Remove a data model row entry.
 boolean Remove(Message identity)
          Remove a data model entry associated with a Conductor Identity.
 boolean Remove(String theater_location)
          Remove all Conductors at a Theater location.
 Conductor_Table_Model Replace(List<Message> identities, Theater theater, Message client_identity)
          Replace all identities for a specified Remote_Theater Management with new identities.
protected  boolean Set_Identity(Message identity, Theater theater, Message client_identity)
          Set a Conductor identity.
protected  int Set_Management(int row, Remote_Theater management)
          Set a Remote_Theater Management.
static String Theater_Location(Message identity)
          Get the location of a Conductor from its identity.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values

Column_Names

public static String[] Column_Names
The names of the table columns.


THEATERS_COLUMN

public static final int THEATERS_COLUMN
The index of the Theaters column in the data model.

See Also:
Constant Field Values

CONDUCTORS_COLUMN

public static final int CONDUCTORS_COLUMN
The index of the Conductos column in the data model.

See Also:
Constant Field Values

THEATER_LOCATION_PARAMETER_NAME

public static final String THEATER_LOCATION_PARAMETER_NAME
Conductor identity parameters of interest to the data model.

See Also:
Constant Field Values

ADDRESS_PARAMETER_NAME

public static final String ADDRESS_PARAMETER_NAME
Conductor identity parameters of interest to the data model.

See Also:
Constant Field Values

CONDUCTOR_ID_PARAMETER_NAME

public static final String CONDUCTOR_ID_PARAMETER_NAME
Conductor identity parameters of interest to the data model.

See Also:
Constant Field Values

PIPELINE_PARAMETER_NAME

public static final String PIPELINE_PARAMETER_NAME
Conductor identity parameters of interest to the data model.

See Also:
Constant Field Values

PROCESSING_STATE_PARAMETER_NAME

public static final String PROCESSING_STATE_PARAMETER_NAME
Conductor identity parameters of interest to the data model.

See Also:
Constant Field Values

UNCHANGED_STATE

protected static final int UNCHANGED_STATE
Special Conductor processing state value that indicates no change from the current state.

When Remote_Theater Management is closed or set the previous processing state is returned for use in notifying processing state change listeners. If the state was unchanged this special unchanged value is returned instead. This enables the caller to avoid the cost of the notification and consequent table view updates.

See Also:
Constant Field Values
Constructor Detail

Conductor_Table_Model

public Conductor_Table_Model()
Construct an empty Conductor_Table_Model.

Method Detail

findColumn

public int findColumn(String name)
Find the data model column index of a name.

Overrides:
findColumn in class AbstractTableModel
Parameters:
name - A column name String. May be null.
Returns:
The index of the named column in the data model. This will be -1 if the name does not match (case insensitive) a column name.

getColumnClass

public Class getColumnClass(int column)
Get the Class for a data model column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
column - A data model column index.
Returns:
If the column index is valid String.class is returned; otherwise Object.class is returned.

getColumnCount

public int getColumnCount()
Get the number of columns in the data model.

Specified by:
getColumnCount in interface TableModel
Returns:
The size of the Column_Names array.

getColumnName

public String getColumnName(int column)
Get the name of a data model column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - A data model column index.
Returns:
The column name String. This will be null.if the column index is not valid.

getRowCount

public int getRowCount()
Get the number of rows in the data model.

Specified by:
getRowCount in interface TableModel
Returns:
The number of Conductor identities contained in the model.

getValueAt

public Object getValueAt(int row,
                         int column)
Get the value of a data model cell.

For the THEATERS_COLUMN the value will be the Theater location. For the CONDUCTORS_COLUMN the value will be the Conductor name.

Specified by:
getValueAt in interface TableModel
Parameters:
row - A data model row index.
column - A data model column index.
Returns:
The String value of the data model cell. For the THEATERS_COLUMN the value will be the abbreviated location of the Theater location for the row. For the CONDUCTORS_COLUMN the value will be the Conductor name of the row. This will be null if either of the data model index values are invalid.

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Test if a data model cell is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - A data model row index.
column - A data model column index.
Returns:
Always returns false.

Profile

public Profile Profile()
                throws IllegalArgumentException
Get a Profile of the Conductors.

Returns:
A Profile representing all the Conductors on all the Theaters listed in this data model.
Throws:
If - a Conductor identity can not be used to construct a valid Conductor_Definition or the definition is in conflict with another of the same name.
IllegalArgumentException

Identity

public Conductor_Table_Model Identity(Message identity,
                                      Theater theater,
                                      Message client_identity)
                               throws IOException
Add a Conductor identity to the data model.

The data model listeners are notified that a new row has been inserted.

N.B.: If Remote_Theater Management could not be obtained the identity is not added to the the data model and no listener notification is sent; an IOException is thrown in this case.

Parameters:
identity - A Conductor identity Message. If null, or the identity is already present in the data model, nothing is done.
theater - The Theater where the Stage_Manager is located from which the Conductor identities were obtained. If null, nothing is done.
client_identity - The Message containing client authentication information for connecting to the Stage_Manager. If null, nothing is done.
Returns:
This Conductor_Table_Model.
Throws:
IOException - If Remote_Theater Management could not be obtained.
See Also:
Set_Identity(Message, Theater, Message)

Set_Identity

protected boolean Set_Identity(Message identity,
                               Theater theater,
                               Message client_identity)
                        throws IOException
Set a Conductor identity.

N.B.: This method should only be used to set a new Conductor identity by a method that does the neccessary state checks and table view update notification.

The THEATER_LOCATION_PARAMETER_NAME is set at the beginning of the identity with the Remote_Theater location before the identity is added to the data model along with null Managements and Managers entries. The Theater location in the identity is necessary to correctly match identities. This is particularly critical when identities are replaced which depends on recognizing previously added identities by matching Theater locations.

The name of the identity is set to the identity's Conductor name.

The identity is added to the data model along with null place holders for the Remote_Theater Management and Conductor Manager. Then the new Management is obtained and set in the data model.

N.B.: If Remote_Theater Management could not be obtained the tentative new data model row is removed and an IOException is thrown.

N.B.: No data model listener notification is done.

Parameters:
identity - A Conductor identity Message.N.B.: Must not be null; there should be no null identities in the data model. The identity must also be unique (not already present) in the data model.
theater - The Theater where the Stage_Manager is located from which the Conductor identities were obtained. Must not be null.
client_identity - The Message containing client authentication information for connecting to the Stage_Manager. Should not be null.
Returns:
true if the identity was set; false if the Theater location is invalid and not entered in the data model.
Throws:
IOException - If Remote_Theater Management could not be obtained.
See Also:
Management(Message, Theater, Message)

Identity

public Message Identity(int row)
Get the Identity of a Conductor at a row index.

Parameters:
row - A data model row index.
Returns:
A Conductor identity Message. This will be null if the row index is less than zero or greater than or equal to the total data model rows.

Identity

public Message Identity(Remote_Theater management)
Get the Identity of a Conductor associated with a Remote_Theater Management.

Parameters:
management - A Remote_Theater Management reference.
Returns:
A Conductor identity Message. This will be null if the management could not be found in the data model.

Identity

public Message Identity(Manager manager)
Get the Identity of a Conductor associated with a Manager.

Parameters:
manager - A Manager reference.
Returns:
A Conductor identity Message. This will be null if the manager could not be found in the data model.

Index

public int Index(Message identity)
Get the data model row index of a Conductor identity.

Parameters:
identity - A Conductor identity Message. May be null.
Returns:
The data model index of the Conductor identity, or -1 if the identity is not present.

Matching_Index

public int Matching_Index(Message identity)
Get the data model row index of a Conductor with a matching identity.

N.B.: This method searches the data model for a Conductor identity that matches the specified identity. The matching identity need not be the same object.

Parameters:
identity - A Conductor identity Message.
Returns:
The data model row index of the matching identity. This will be -1 if a matching identity could not be found in the data model.
See Also:
Matching_Index(Message, List)

Matching_Index

protected static int Matching_Index(Message identity,
                                    List<Message> identities)
Get the index of an identity Message in a list of identities.

The index of the first identities entry that matches the specified identity is returned. An identity matches if either it has the same ADDRESS_PARAMETER_NAME, or all the values of the THEATER_LOCATION_PARAMETER_NAME, CONDUCTOR_ID_PARAMETER_NAME and PIPELINE_PARAMETER_NAME parameters are the same.

Parameters:
identity - A Conductor identity Message supplemented with a THEATER_LOCATION_PARAMETER_NAME parameter. If null, -1 is returned.
identities - A List of Conductor identities. If null, -1 is returned.
Returns:
The index of the entry in the identities list that matches the identity, or -1 if no match is found.

Replace

public Conductor_Table_Model Replace(List<Message> identities,
                                     Theater theater,
                                     Message client_identity)
                              throws IOException
Replace all identities for a specified Remote_Theater Management with new identities.

Each current identity in the data model that has a THEATER_LOCATION_PARAMETER_NAME value that matches the Theater location is compared against the new identities list. An attempt is made to get the index of the existing identity in the new identities list. If a matching identity can not be found the data model row for the current identity is removed; the current identity is defunct. If a matching identity is found the identity is removed from the list of new identities; the identity is redundant. This checking removes all current identities that are not in the new identities list, and removes from the new identities list all identities that are already in the current identitites list. After all current identities have been checked all the remaining new identities are added to the data model along with the Remote_Theater Management and an equal number of null Manager entries.

A table data changed notification is sent to the data model listeners only if any changes occured to the data model.

N.B.: If Remote_Theater Management could not be obtained for an identity it is not added to the the data model. In this case, after an attempt has been made to add all the new identities to the model an IOException will thrown. Because multiple exceptions might have occured a generic IOException is thrown containing a message that lists each specific exception message, including its specific type, with each exception message separated from the one that prceeded it by a single line containing seven dash ('-') characters.

Parameters:
identities - A List of Conductor identity Messages. If null, nothing is done.
theater - The Theater where the Stage_Manager is located from which the Conductor identities were obtained. If null, nothing is done.
client_identity - The Message containing client authentication information for connecting to the Stage_Manager. If null, nothing is done.
Throws:
IOException - If Remote_Theater Management could not be obtained.
See Also:
Matching_Index(Message, List), Set_Identity(Message, Theater, Message)

Conductor_Name

public String Conductor_Name(int row)
Get the name of a Conductor at a data model index.

Parameters:
row - A data model row index.
Returns:
The Conductor name from the identity at the row index. This will be null if the row index is invalid or the identity does not contain the required information.

Location

public String Location(int row)
Get the Theater location of a Conductor at a data model index.

The fully qualified Theater location is returned.

Parameters:
row - A data model row index.
Returns:
The Theater location from the identity at the row index. This will be null if the row index is invalid or the identity does not contain the required information.

Processing_State

public int Processing_State(int row)
Get the processing state of a Conductor at a data model index.

If the row's Conductor identity has a procesing state of zero an attempt is made to use the row's Management to obtain the current procesing state. If this is successful the identity is updated with the current processing state.

Parameters:
row - A Conductor row index.
Returns:
The Conductor processing state. This will be zero if the row index is outside the range of available Conductors or the processing state has not yet been obtained from the Conductor.

Management

public Remote_Theater Management(int row)
Get the Remote_Theater Management at a data model row index.

N.B.: The current Remote_Theater Management data model row is obtained as-is; Remote_Theater Management will not be opened or re-opened.

Parameters:
row - A data model row index.
Returns:
The Remote_Theater Management for the data model row. This will be null if the row index is not valid or no Remote_Theater Management is present at the index.

Management

public Remote_Theater Management(Message identity)
Get the Remote_Theater Management for a Conductor.

N.B.: The current Remote_Theater Management associated with the Conductor identity is obtained as-is; Remote_Theater Management will not be opened or re-opened.

Parameters:
identity - A Conductor identity Message.
Returns:
The Remote_Theater Management associated with the Conductor identity. This will be null if the Conductor identity is null or not found in the data model.
See Also:
Index(Message), Management(int)

Open_Management

public Remote_Theater Open_Management(Message conductor_identity,
                                      Theater theater,
                                      Message client_identity)
                               throws IOException
Get Remote_Theater Management for a Conductor.

If the Conductor already has Remote_Theater Management and it is open, that is returned. Otherwise an attempt is made to obtain it.

Remote_Theater Management can be obtained when the Theater and a client identity containing any authentication information required by the Stage_Manager are provided. If Remote_Theater Management was found for the Conductor but it is closed, it is re-opened at the same location. Otherwise a new Remote_Theater Management is constructed and registered.

Parameters:
conductor_identity - The identity Message of the Conductor to be opened. If Remote_Theater Management is to be constructed or re-opened this must not be null and must contain an ADDRESS_PARAMETER_NAME parameter.
theater - The Theater where the Stage_Manager is located from which the Conductor identity was obtained. If Remote_Theater Management is to be constructed or re-opened this must not be null.
client_identity - The Message containing the Theater.KEY_PARAMETER_NAME that may be needed by the Stage_Manager to construct or re-open Remote_Theater Management. N.B.: This may be null if the Stage_Manager allows unauthenticated connections; otherwise the Stage_Manager will reject the connection.
Returns:
An open Remote_Theater Management for the Conductor. This will be null if the identity could not be found in the data model or the theater or client_identity is null and a Remote_Theater Management was needed to be constructed or re-opened
Throws:
IOException - If a connection could not be established to the Stage_Manager. This will be a Theater_Protocol_Exception if there were any problems in the content of the Messages used to establish the connection.

Management

public static Remote_Theater Management(Message conductor_identity,
                                        Theater theater,
                                        Message client_identity)
                                 throws IOException
Get Remote_Theater Management for a Conductor.

Remote_Theater Management services are obtained for a Theater associated with a Stage_Manager. The client identity Message.NAME_PARAMETER_NAME is qualified with the Remote_Theater.REMOTE_THEATER_NAME following a '/' delimiter if it does not already contain this qualifier name. A Remote_Theater connection is then established with the Stage_Mangager at the specified Theater using the authentication information in the client identity, and the Remote_Theater Messenger is linked to the Conductor Messenger at the ADDRESS_PARAMETER_NAME found in the Conductor's identity information. This is done by constructing a new Remote_Theater that will provide Management communication directly with the Conductor.

Parameters:
conductor_identity - The identity Message of the Conductor to be opened. Must not be null and must contain an ADDRESS_PARAMETER_NAME parameter.
theater - The Theater where the Stage_Manager is located from which the Conductor identity was obtained. Must not be null.
client_identity - The Message containing the Theater.KEY_PARAMETER_NAME.
Throws:
IOException - If a connection could not be established to the Stage_Manager. This will be a Theater_Protocol_Exception if there were any problems in the content of the Messages used to establish the connection.
IllegalArgumentException - If the argument requirements are not satsified, or the Conductor identity does not have an ADDRESS_PARAMETER_NAME parameter.
See Also:
Remote_Theater.Open(String, int, Message, String)

Index

public int Index(Remote_Theater management)
Get the data model row index for a Remote_Theater Management.

Parameters:
management - A Remote_Theater Management object.
Returns:
The data model row index containing the Remote_Theater Management, or -1 if the Management was not found in the data model.

Next_Index

public int Next_Index(String theater_location,
                      int index)
Get the data model row index of the next Conductor entry at a Theater location starting after a given index.

Each Conductor identity, beginning with the data model entry immediately following the specified index, has the value of its THEATER_LOCATION_PARAMETER_NAME parameter compared with the specified Theater location. The index of the first one that matches is returned.

Parameters:
theater_location - A String specifying a Theater location. The Theater location is fully qualified to ensure it will correctly match the standard locations stored with the Conductor identities.
index - The data model row index after which the search for the next matching Conductor identity will begin. If less than zero the search begins with the first row.
Returns:
The index of the next Conductor identity that contains a matching Theater location, or -1 if no match is found or the Theater location is null or the empty String.
See Also:
Theater.Location()

Count

public int Count(String theater_location,
                 Conductor_Definition conductor_definition)
Get the count of Conductors identities on a Theater that match a Conductor_Definition.

Parameters:
theater_location - The String specifying a Theater location (does not need to be fully qualified). If null, the count will be zero.
conductor_definition - A Conductor_Definition to match against Conductor identities.
Returns:
The count of Conductor identities associated with the Theater location that match the Conductor_Definition.
See Also:
Next_Index(String, int)

Management

public Conductor_Table_Model Management(int row,
                                        Remote_Theater management)
Set the Remote_Theater Management for a data model row index.

If the Remote_Theater Management is identical to the current entry, or the row does not have a Conductor identity, nothing is done.

If the current Remote_Theater Management entry for the row is non-null the row is closed before the entry is replaced. The current Conductor processing state is replaced with the state obtained from the new Management, or zero if the new Management is null. This Conductor_Table_Model is registered with the new Managment, if non-null, to receive Conductor processing state change notifications. Finally, if the the processing state changed all table listeners are notified of the new state.

Parameters:
row - A data model row index. If not a valid data model row index nothing is done.
management - A Remote_Theater Management object. If this is identical to the existing Management nothing is done.
Returns:
This Conductor_Table_Model.

Management

public Conductor_Table_Model Management(Message identity,
                                        Remote_Theater management)
Set the Remote_Theater Management for a Conductor. <>

Parameters:
identity - A Conductor identity Message.
management - A Remote_Theater Management object. If this is identical to the existing Management nothing is done.
Returns:
This Conductor_Table_Model.
See Also:
Management(int, Remote_Theater)

Set_Management

protected int Set_Management(int row,
                             Remote_Theater management)
Set a Remote_Theater Management.

N.B.: This method should only be used to set a new Remote_Theater Management by a method that does the neccessary state checks and table view update notification.

If the row does not have a Conductor identity or the Remote_Theater Management is identical to the current entry, nothing is done.

Management for the row is closed. This will obtain the previous Conductor processing state or the UNCHANGED_STATE value.

If the new Management is non-null it is set in the data model. The current Conductor processing state is obtained from the new Management and compared with the previous state (or zero if the previous state before closure was unchanged). If the state changed the Conductor identity is updated with the new processing state.

N.B.: No data model listener notification is done.

Parameters:
row - A data model row index.
management - A Remote_Theater Management object. May be null.
Returns:
The previous processing state from the row's identity. This will be UNCHANGED_STATE if the row has no identity (shouldn't happen), the existing Management is identical to the new Management, or the processing state is unchanged.
See Also:
Close_Management(int)

Opened

public boolean Opened(int row)
Test if the Remote_Theater Management at a data model index is open.

Parameters:
row - A data model row index.
Returns:
true if the Conductor Remote_Theater Management at the row index has been opened; false if the row index is invalid, no Remote_Theater Management is present at the row index, or the Remote_Theater is not open.

Opened

public boolean Opened(Message identity)
Test if the Remote_Theater associated with a Conductor identity is open.

Parameters:
identity - A Conductor identity Message.
Returns:
true if the Conductor identity is associated with an open Remote_Theater Management; false if the identity is not present, has no associated Remote_Theater Management, or the Remote_Theater is not open.
See Also:
Opened(int)

Close_Management

protected int Close_Management(int row)
Close the Remote_Theater Management at a data model index.

N.B.: This method should only be used to close a Remote_Theater Management by a method that does the neccessary state checks and table view update notification.

If a Manager is present for the row it is disabled.

This Conductor_Table_Model is unregisterd as a processing listener of the Remote_Theater Management which is removed from (nullified in) the data model. processing state is obtained and then reset to zero (unknown state).

N.B.: No data model listener notification is done.

Parameters:
row - A data model row index.
Returns:
The previous processing state from the row's identity. This will be UNCHANGED_STATE if the row has no identity (shouldn't happen) or the processing state is unchanged.

Manager

public Manager Manager(int row)
Get the Conductor Manager for a data model row index.

Parameters:
row - A data model row index.
Returns:
A Conductor Manager. This will be null if the row index is not valid or no Manager is present at the index.

Manager

public Manager Manager(Message identity)
Get the Manager for a Conductor.

Parameters:
identity - A Conductor identity Message.
Returns:
A Conductor Manager. This will be null if the Conductor identity was null or not found.

Manager

public Conductor_Table_Model Manager(int row,
                                     Manager manager)
Set the Manager for a data model row index.

If the row has a non-null Manager entry that Manager is closed before the entry is replaced. If the new Manager is not null the Management is set to new Manager's Management.

Parameters:
row - A data model row index. If not a valid data model row index nothing is done.
manager - A Conductor Manager.
Returns:
This Conductor_Table_Model.

Index

public int Index(Manager manager)
Get the data model row index for a Conductor Manager.

Parameters:
manager - A Conductor Manager.
Returns:
The data model row index containing the Manager, or -1 if the Manager was not found.

Open_Manager

public Manager Open_Manager(int row)
                     throws Remote_Management_Exception
Open a Conductor Manager at a data model row index.

If a Manager is present at the data model row it is returned. Otherwise, if Remote_Theater Management is present at the data model row and it is opened, it is used to construct a new Manager which is set for the data model row and then returned.

Parameters:
row - A data model row index.
Returns:
A Conductor Manager. This will be null if the row index is invalid, or an opened Remote_Theater Management is not available for the row.
Throws:
Remote_Management_Exception - If a problem was encountered while constructing a new Manager.

Close_Manager

public boolean Close_Manager(int row)
Close a Conductor Manager at a data model row index.

If a Manager is present at the data model row index it is closed and it's entry removed from the data model.

Parameters:
row - A data model row index.
Returns:
true if the Manager was present in the data model and has been closed; false if the Manager was not present.

Close

public boolean Close(Manager manager)
Close a Conductor Manager.

If the Manager is present in the data model it is closed and it's entry removed from the data model.

N.B.: If the Manager is not present in data model it is not closed.

Parameters:
manager - A Conductor Manager.
Returns:
true if the Manager was present in the data model and has been closed; false if the Manager was not present.

Remove

public Message Remove(int row)
Remove a data model row entry.

Parameters:
row - A data model row index.
Returns:
The Conductor identity that was removed. This will be null if the row index is invalid.

Remove

public boolean Remove(Message identity)
Remove a data model entry associated with a Conductor Identity.

Parameters:
identity - A Conductor identity Message. If null nothing is done and false is returned.
Returns:
true if the identity was present and removed; false otherwise.

Remove

public boolean Remove(String theater_location)
Remove all Conductors at a Theater location.

Each data model entry found for the Theater location is removed. If any row was removed a change notification event for the entire table will be sent to the state change listeners. This event will also be sent to the table change listeners if non-contiguous ranges of rows were deleted; otherwise a deleted event will be delivered for only the rows removed.

Parameters:
theater_location - The String specifying a Theater location (does not need to be fully qualified).
Returns:
true if at least one row was removed; false otherwise.
See Also:
Next_Index(String, int)

Clear

public void Clear()
Clear the data model of all entries.

If the data model contians any rows all are (@link #Remove_at(int) removed} and a {#link Notify_Table_Changed() table changed notification} is sent to all listeners.


Remove_at

protected Message Remove_at(int row)
Remove a data model row entry.

N.B.: This method should only be used to remove a data model row by a method that will do the expected table change notification.

Any Manager and Remote_Theater Management for the row is closed. Then the Manager, Mangement and Identity entries are removed from the data model.

N.B.: No data model listener notification is done.

Parameters:
row - A data model row index.
Returns:
The Conductor identity Message for the row that was removed. This will be null if the row index is not valid.

Close

public void Close(int row)
Close the Remote_Theater and Manager at a row index.

The Remote_Theater Management for the row is closed. If this resulted in a Conductor processing state change a state change notification is sent to all data model listeners.

Parameters:
row - A data model row index.

Close

public boolean Close(String theater_location)
Close a Theater.

The Remote_Theater Management found at the Theater location is closed. If any of these closures resulted in a Conductor processing state change a state change notification is sent to all data model listeners.

Parameters:
theater_location - A String specifying the Theater location (does not need to be fully qualified). If null or the emtpy String nothing is done.
Returns:
true if any closures resulted in a Conductor processing state change; false otherwise.
See Also:
Next_Index(String, int)

Close_All

public boolean Close_All()
Close all Managers and Remote_Theater Managements.

Each Manager is closed and each Remote_Theater Management is closed. If any of these closures resulted in a Conductor processing state change a state change notification is sent to all data model listeners.

Returns:
true if any closures resulted in a Conductor processing state change; false otherwise.

Notify_Inserted

protected void Notify_Inserted(int row)
Notify all listeners that a data model row has been inserted.

Listeners are sent an TableModelEvent.INSERT Conductor_Table_Model_Event that specifies the row.

Parameters:
row - The data model row that was inserted.

Notify_Updated

protected void Notify_Updated(int row)
Notify all listeners that a data model row has been updated.

Listeners are sent an TableModelEvent.UPDATE Conductor_Table_Model_Event that specifies the row.

Parameters:
row - The data model row that was updated.

Notify_Updated

protected void Notify_Updated(int first_row,
                              int last_row)
Notify all listeners that a continguous range of data model rows have been updated.

Listeners are sent an TableModelEvent.UPDATE Conductor_Table_Model_Event that specifies the range from first_row to last_row, inclusive.

Parameters:
first_row - The first data model row that was updated.
last_row - The last data model row that was updated.

Notify_State_Changed

protected void Notify_State_Changed(int row,
                                    int processing_state)
Notify all listeners that a Conductor processing state changed.

Listeners are sent an TableModelEvent.UPDATE Conductor_Table_Model_Event that specifies the row and the processing state.

Parameters:
row - The data model row that has changed.
processing_state - The previous processing state. The current processing state is contained in the Conductor identity for the row.

Notify_Deleted

protected void Notify_Deleted(int row)
Notify table change listeners that a data model row has been deleted.

Listeners are sent a TableModelEvent.DELETE Conductor_Table_Model_Event that specifies the row. N.B.: The processing state change listeners are not notified. They should have been sent a pre-deletion deleting notification of the same event.

Parameters:
row - The data model row that has been deleted.

Notify_Deleted

protected void Notify_Deleted(int first_row,
                              int last_row)
Notify table change listeners that a data model row range has been deleted.

Listeners are sent a TableModelEvent.DELETE Conductor_Table_Model_Event that specifies the range from first_row to last_row, inclusive. N.B.: The processing state change listeners are not notified. They should have been sent a pre-deletion deleting notification of the same event.

Parameters:
first_row - The first data model row that has been deleted.
last_row - The last data model row that has been deleted.

Notify_Table_Changed

protected void Notify_Table_Changed()
Notify all listeners that the data model content has changed.

This notification is used when the change to the data model can not be localized to a contiguous range of rows. All listeners are sent an TableModelEvent.UPDATE Conductor_Table_Model_Event that specifies the maximum row value range (0 - Integer.MAX_VALUE}.


Notify_Table_Change_Listeners

protected void Notify_Table_Change_Listeners(Conductor_Table_Model_Event event)
Send a change notification to the table change listeners.

All table model listeners are notified of the event. N.B.: Only table model listeners are notified; the processing state change listeners are not notified. Use the Notify_State_Change_Listeners(Conductor_Table_Model_Event) to notify only the processing state change listeners.

Parameters:
event - The Conductor_Table_Model_Event to be delivered.

Add_State_Change_Listener

public Conductor_Table_Model Add_State_Change_Listener(TableModelListener listener)
Add a listener for Conductor processing state change events.

These listeners receive notification whenever one or more Conductor identities in the data model may have a changed processing state.

State change listeners are distinct from table model listeners. When appropriate, both sets of listeners will be notified of a data model change event. At other times only one or the other set of listeners will be sent a notification. A listener should register to receive processing state change notifications when that is all it is interested in knowing aobut. A listener should register to receive table change notifications whien it is interested in any changes, including processing state changes.

Parameters:
listener - A TableModelListener.
Returns:
This Conductor_Table_Model.

Remove_State_Change_Listener

public boolean Remove_State_Change_Listener(TableModelListener listener)
Remove a listener for Conductor processing state change events.

Parameters:
listener - A TableModelListener.
Returns:
true if the listener was removed; false if it was not registered.
See Also:
Add_State_Change_Listener(TableModelListener)

Notify_State_Change_Listeners

protected void Notify_State_Change_Listeners(Conductor_Table_Model_Event event)
Send a change notification to the processing state change listeners.

All state change listeners are notified of the event. N.B.: Only processing state change listeners are notified; the table model listeners are not notified. Use the Notify_Table_Change_Listeners(Conductor_Table_Model_Event) to notify only the table model listeners of an event.

Parameters:
event - The Conductor_Table_Model_Event to be delivered.

Notify_Deleting

protected Conductor_Table_Model_Event Notify_Deleting(int row)
Notify processing state change listeners that a data model is about to be deleted.

Listeners are sent a TableModelEvent.DELETE Conductor_Table_Model_Event that specifies the row. N.B.: The table change listeners are not notified. They should be sent a post-deletion deleted notification of the same event.

Parameters:
row - The data model row that will be deleted.
Returns:
The Conductor_Table_Model_Event that was delivered.

Notify_Deleting

protected Conductor_Table_Model_Event Notify_Deleting(int first_row,
                                                      int last_row)
Notify table change listeners that a data model row range is about to be deleted.

Listeners are sent a TableModelEvent.DELETE Conductor_Table_Model_Event that specifies the range from first_row to last_row, inclusive. N.B.: The table change listeners are not notified. They should be sent a post-deletion deleted notification of the same event.

Parameters:
first_row - The first data model row that is about to be deleted.
last_row - The last data model row that is about to be deleted.
Returns:
The Conductor_Table_Model_Event that was delivered.

Processing_Event_Occurred

public void Processing_Event_Occurred(Processing_Event event)
Event handler for Conductor Processing_Events.

N.B.: This method is public as a side effect of implementing the Processing_Listener interface. It should not be used directly.

If the incoming event contains a Conductor processing event change the event is enqueued and a Runnable placed on the Swing event handling queue for disposition of the event.

The event disposition method pulls the next event from the front of the event queue. The data model index for the Remote_Theater Management source of the event is obtained and used to obtain the associated Conductor identity. The identity provides the previous processing state and is set with the new state. Then all processing state change listeners are notified of the state change.

Specified by:
Processing_Event_Occurred in interface Processing_Listener
Parameters:
event - A Processing_Event.
See Also:
Processing_Event

Theater_Location

public static String Theater_Location(Message identity)
Get the location of a Conductor from its identity.

If the THEATER_LOCATION_PARAMETER_NAME is not present in the identity the value of the CONDUCTOR_ID_PARAMETER_NAME will be used, without any PID suffix, to produce a fully qualified location.

Parameters:
identity - A Conductor identity Message.
Returns:
A String providing the Theater location of the Conductor. This will be null if the identity is null or neither of the expected parameters is present in the identity.

Conductor_Name

public static String Conductor_Name(Message identity)
Get the name of a Conductor from its identity.

The value of the PIPELINE_PARAMETER_NAME will be returned. N.B.: A Conductor's name is not necessarily the same as its pipeline name.

Parameters:
identity - A Conductor identity Message.
Returns:
A String providing the name of the Conductor. This will be null if the identity is null or neither of the expected parameters is present in the identity.

Pipeline

public static String Pipeline(Message identity)
Get the name of a Conductor pipeline from its identity.

The PIPELINE_PARAMETER_NAME value is obtained.

Parameters:
identity - A Conductor identity Message.
Returns:
A String providing the name of the Conductor pipeline. This will be null if the identity is null or the required parameter is not present in the identity.

Identification

public static String Identification(Message identity)
Get a Conductor identification from its identity.

The CONDUCTOR_ID_PARAMETER_NAME value is obtained.

Parameters:
identity - A Conductor identity Message.
Returns:
A String providing the identification of the Conductor pipeline. This will be null if the identity is null or the required parameter is not present in the identity.

Processing_State

public static int Processing_State(Message identity)
Get the processing state of a Conductor.

The processing state is the value of the PROCESSING_STATE_PARAMETER_NAME from the identity. If this parameter is not present zero will be returned. The expected processing state values are:

Conductor.RUNNING
Source records are being processing.
Conductor.POLLING
No source records are currently available for processing; the Conductor is polling for new source records to process.
Conductor.RUN_TO_WAIT
When processing of the current source record completes Conductor will go into the waiting state.
Conductor.WAITING
The Conductor is waiting to be told to being processing.
Conductor.HALTED
A problem condition caused the Conductor to halt processing. The problem may be the result of the maximum number of sequential source records processing procedure failures having occured, a database access failure, or some other system error.
0 - Unknown
A processing state has not yet been obtained from the Conductor.
The WAITING and HALTED state codes are negative; all others are positive.

Parameters:
identity - A Conductor identity Message. If null, zero is returned.
Returns:
A Conductor processing state value, or zero if none is available.

Processing_State

protected static void Processing_State(Message identity,
                                       int processing_state)
Set the processing state of a Conductor.

N.B.: This method should only be used to set a new processing state by a method that does the neccessary state checks and table view update notification.

The Conductor identity has the PROCESSING_STATE_PARAMETER_NAME set to the processing state value.

Parameters:
identity - A Conductor identity Message. Must not be null.
processing_state - A processing state value.
See Also:
Processing_State(Message)

PIRL

Copyright (C) \ 2003-2009 Bradford Castalia, University of Arizona