DatabaseMonitoringTableModel.java revision 8a8a81b8bac1333b0eeae6f07ca58741ab063722
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/** The table model used to display all the database monitoring information. */
public class DatabaseMonitoringTableModel extends SortableTableModel implements Comparator<BackendDescriptor>
{
private static final long serialVersionUID = 548035716525600536L;
private String[] columnNames = {};
/** The fields to be displayed. */
/** The sort column of the table. */
private int sortColumn;
/** Whether the sorting is ascending or descending. */
private boolean sortAscending = true;
/**
* Sets the data for this table model.
* @param newData the data for this table model.
*/
{
{
}
}
/**
* Updates the table model contents and sorts its contents depending on the
* sort options set by the user.
*/
public void forceResort()
{
}
/**
* Updates the table model contents, sorts its contents depending on the
* sort options set by the user and updates the column structure.
*/
public void forceDataStructureChange()
{
}
/** {@inheritDoc} */
public int getColumnCount()
{
return columnNames.length;
}
/** {@inheritDoc} */
public int getRowCount()
{
}
/** {@inheritDoc} */
{
}
/** {@inheritDoc} */
return columnNames[col];
}
/** {@inheritDoc} */
{
if (result == 0)
{
}
if (!isSortAscending())
{
}
return result;
}
{
for (int i : possibleResults)
{
if (i != 0)
{
return i;
}
}
return 0;
}
/**
* Returns whether the sort is ascending or descending.
* @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
* otherwise.
*/
public boolean isSortAscending()
{
return sortAscending;
}
/**
* Sets whether to sort ascending of descending.
* @param sortAscending whether to sort ascending or descending.
*/
public void setSortAscending(boolean sortAscending)
{
this.sortAscending = sortAscending;
}
/**
* Returns the column index used to sort.
* @return the column index used to sort.
*/
public int getSortColumn()
{
return sortColumn;
}
/**
* Sets the column index used to sort.
* @param sortColumn column index used to sort..
*/
public void setSortColumn(int sortColumn)
{
this.sortColumn = sortColumn;
}
/**
* Returns the fields displayed by this table model.
* @return the fields displayed by this table model.
*/
{
return attributes;
}
/**
* Sets the fields displayed by this table model.
* @param fields the statistic fields displayed by this table model.
*/
{
this.attributes.clear();
int i = 1;
{
columnNames[i] = field;
i++;
}
}
/**
* Updates the array data. This includes resorting it.
*/
private void updateDataArray()
{
{
}
// Add the total: always at the end
{
boolean valueSet = false;
boolean notImplemented = false;
long totalValue = 0;
{
try
{
totalValue += v;
valueSet = true;
}
catch (Throwable t)
{
try
{
totalValue += v;
valueSet = true;
}
{
}
}
}
if (notImplemented)
{
}
else if (valueSet)
{
}
else
{
}
}
}
/**
* Returns the label to be used for the provided backend.
* @param backend the backend.
* @return the label to be used for the provided backend.
*/
{
return backend.getBackendID();
}
/**
* Returns the monitoring entry associated with the provided backend.
* @param backend the backend.
* @return the monitoring entry associated with the provided backend. Returns
* <CODE>null</CODE> if there is no monitoring entry associated.
*/
{
return backend.getMonitoringEntry();
}
{
int i = 1;
{
if (o != null)
{
line[i] = o;
}
else
{
}
i++;
}
return line;
}
}