summaryrefslogtreecommitdiffstats
path: root/pki/base/console/src/com/netscape/admin/certsrv/status
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/console/src/com/netscape/admin/certsrv/status')
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java43
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java43
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java359
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java118
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java43
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java38
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java107
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java202
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java160
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java246
10 files changed, 1359 insertions, 0 deletions
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java
new file mode 100644
index 000000000..c0edc5270
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/AccessLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * AccessLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class AccessLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AccessLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java
new file mode 100644
index 000000000..39bdffc0e
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/AuditLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * AuditLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class AuditLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public AuditLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java
new file mode 100644
index 000000000..bd19a467f
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/CMSLogPanel.java
@@ -0,0 +1,359 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Log Panel to be displayed at the right hand side
+ * <pre>
+ * Top Panel with filter input:
+ * Number of entries: default 25
+ * Source: default all
+ * Log Level: default warning
+ * </pre>
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public abstract class CMSLogPanel extends CMSBasePanel
+ implements IResourceSelectionListener, IRefreshTab, IRefreshTabPanel, MouseListener
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANELNAME = "LOGCONTENT";
+
+ public static int DEFAULT_LOG_ENTRY = 25;
+
+ protected JPanel mFilterPanel, mListPanel, mActionPanel; //panels
+ protected boolean mInit = false; // true if this panel is initialized
+ protected CMSBaseResourceModel mModel;
+ protected LogDataModel mDataModel; //table data model
+
+ protected JScrollPane mScrollPane;
+ protected JTable mTable; //table
+ protected JButton mView, mRefresh, mHelp; //action buttons
+ protected JTextField mNoRecord;
+ protected JComboBox mSource, mLevel, mFile;
+ protected String mHelpToken;
+ protected LogEntryViewDialog mViewer;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public CMSLogPanel( CMSBaseResourceModel model,LogDataModel dataModel) {
+ super(PANELNAME);
+ model.addIResourceSelectionListener(this);
+ mModel = model;
+ mDataModel = dataModel;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual construction of the panel
+ */
+ public void init() {
+ setLayout(new BorderLayout());
+
+ //======== filter panel ======================
+ mFilterPanel = createFilterPanel();
+ add("North",mFilterPanel);
+
+ //======== list panel ========================
+ mListPanel = createListPanel();
+ mListPanel.setBorder(new EmptyBorder(SEPARATED_COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,
+ COMPONENT_SPACE,
+ DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE));
+ add("Center",mListPanel);
+
+ //====== action panel ===========================
+ mActionPanel = createActionPanel();
+ add("South",mActionPanel);
+ updateArchive();
+ refresh();
+ }
+
+ //== IResourceListener ===
+
+ public void select(IResourceObject parent, Object viewInstance) {
+ if (!mInit) {
+ init();
+ mInit = true;
+ }
+
+ //refresh the screen
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ return true;
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("AccessLogPanel: Refresh Log");
+ refresh();
+ }else if (e.getSource().equals(mView)) {
+ if (mDataModel.getRowCount() == 0) {
+ refresh();
+ } else {
+ viewDetail();
+ }
+ }else if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ } else if (e.getSource().equals(mLevel) || e.getSource().equals(mSource)
+ || e.getSource().equals(mFile)) {
+ Debug.println("AccessLogPanel: Changed Log Level or Source or File");
+ refresh();
+ }
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ return this;
+ }
+
+ //==== MOUSELISTENER ======================
+ public void mouseClicked(MouseEvent e) {
+ //Debug.println("CertRepositoryPanel: mouseClicked() -"+e.toString());
+
+ //we track the double click action on the table entry - View op
+ if(e.getClickCount() == 2) {
+ //Debug.println("View Detail");
+ viewDetail();
+ }
+ }
+
+ public void mousePressed(MouseEvent e) { }
+ public void mouseReleased(MouseEvent e) { }
+ public void mouseEntered(MouseEvent e) { }
+ public void mouseExited(MouseEvent e) { }
+
+ /**
+ * refresh the table data
+ */
+ public void refresh() {
+ mDataModel.removeAllRows();
+ Debug.println("CMSLogPanel: refresh()");
+
+ update();
+
+ mTable.invalidate();
+ mTable.validate();
+ mTable.repaint(1);
+ mScrollPane.invalidate();
+ mScrollPane.validate();
+ mScrollPane.repaint(1);
+ if (mDataModel.getRowCount() > 0) {
+ mTable.setRowSelectionInterval(0,0);
+ }
+ }
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * View the log entry in a dialog box
+ * (no assumption of validity)
+ */
+ protected void viewDetail() {
+ //check item selected
+ if (mTable.getSelectedRow()>= 0) {
+ if (mViewer == null)
+ mViewer = new LogEntryViewDialog(mModel.getFrame());
+ mViewer.showDialog(
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),0),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),1),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),2),
+ (String)mDataModel.getValueAt(mTable.getSelectedRow(),3),
+ ((JLabel)mDataModel.getValueAt(mTable.getSelectedRow(),4)).getText());
+ }
+ }
+
+
+ /**
+ * create action button panel
+ */
+ protected JPanel createActionPanel() {
+ //actionlister to this object
+ mView = makeJButton("VIEW");
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ JButton[] buttons = { mView,mRefresh,mHelp };
+ return makeJButtonPanel(buttons,true,true);
+ }
+
+ /**
+ * create log listing panel
+ */
+ protected JPanel createListPanel() {
+ mListPanel = new JPanel();
+ mListPanel.setLayout(new BorderLayout());
+
+ //center table
+ mTable = new JTable(mDataModel);
+ mScrollPane = JTable.createScrollPaneForTable(mTable);
+ mScrollPane.setHorizontalScrollBarPolicy(mScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ mScrollPane.setVerticalScrollBarPolicy(mScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+ mTable.setAutoscrolls(true);
+ mTable.addMouseListener(this);
+ //setColumnWidth(mTable);
+ mTable.setAutoResizeMode(mTable.AUTO_RESIZE_OFF);
+ setColumnWidth(mTable);
+ mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ mListPanel.add("Center",mScrollPane);
+ setLabelCellRenderer(mTable,4);
+ mScrollPane.setBackground(Color.white);
+ return mListPanel;
+ }
+
+
+ protected void setColumnWidth(JTable table) {
+ int i = table.getColumnModel().getColumnCount();
+ for (int x=0; x< i-1; x++) {
+ TableColumn col = table.getColumnModel().getColumn(x);
+ col.setMinWidth(50);
+ col.setResizable( true );
+ }
+ TableColumn col = table.getColumnModel().getColumn(i-1);
+ col.setMinWidth(400);
+ col.setResizable( true );
+ }
+
+ /**
+ * create filter criteria panel
+ */
+ protected JPanel createFilterPanel() {
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ panel.setBorder(makeTitledBorder("OPTIONS"));
+ panel.setLayout(gb);
+
+ //entry
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel noRec = makeJLabel("NUMBERREC");
+ mNoRecord = makeJTextField(10);
+ mNoRecord.setText(Integer.toString(DEFAULT_LOG_ENTRY));
+ addEntryField(panel, noRec, mNoRecord, gbc);
+
+ //source and level
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("SOURCE");
+ mSource = makeJComboBox("SOURCE");
+ JLabel label2 = makeJLabel("LOGLEVEL");
+ mLevel = makeJComboBox("LOGLEVEL");
+ CMSAdminUtil.addEntryField(panel, label1, mSource, label2, mLevel, gbc);
+ mLevel.addActionListener(this);
+ mSource.addActionListener(this);
+
+
+ //file
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ JLabel label3 = makeJLabel("FILE");
+ mFile = new JComboBox();
+ CMSAdminUtil.addEntryField(panel, label3, mFile, gbc);
+ mFile.addActionListener(this);
+
+ return panel;
+ }
+
+ /**
+ * retrieve log entries from the server side and
+ * populate the data model.
+ */
+ protected abstract void update();
+
+ /**
+ * retrieve archieve log file listing from the server
+ * side and poupulate the combobox
+ */
+ protected abstract void updateArchive();
+
+ //Set the first column's cellrender as label cell
+ protected void setLabelCellRenderer(JTable table, int index) {
+ table.getColumnModel().getColumn(index).setCellRenderer(new LabelCellRenderer(new JLabel()));
+ }
+
+ //=== OVERWRITE DIALOG MESSAGE =====================
+
+ protected void showMessageDialog(String keyword, int messageType ) {
+ CMSAdminUtil.showMessageDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected void showMessageDialog(String keyword) {
+ showMessageDialog(keyword, ERROR_MESSAGE);
+ }
+
+ protected int showConfirmDialog(String keyword, int messageType ) {
+ return CMSAdminUtil.showConfirmDialog(mModel.getFrame(), mResource, mPanelName, keyword, messageType);
+ }
+
+ protected int showConfirmDialog(String keyword) {
+ return showConfirmDialog(keyword, WARNING_MESSAGE);
+ }
+
+ protected void showErrorDialog(String message) {
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource, message, ERROR_MESSAGE);
+ }
+
+
+ private static void addEntryField(JPanel panel, JComponent label,
+ JComponent field, GridBagConstraints gbc) {
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,DIFFERENT_COMPONENT_SPACE,0,0);
+ panel.add( label, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ 0,DIFFERENT_COMPONENT_SPACE);
+ panel.add( field, gbc );
+ }
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java b/pki/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java
new file mode 100644
index 000000000..b69eac3a6
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/DefaultLogParser.java
@@ -0,0 +1,118 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+
+/**
+ * Parse the log in the following default format:
+ * pid.thread - [SIMPLEDATEFORMAT][resource][level][message]
+ *
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+class DefaultLogParser implements ILogParser {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private final String SOURCE_PROPERTY = "LOGCONTENT_COMBOBOX_SOURCE_VALUE_";
+ private final String LEVEL_PROPERTY = "LOGCONTENT_COMBOBOX_LOGLEVEL_VALUE_";
+
+ private final String DATE_PATTERN = "dd/MMM/yyyy:hh:mm:ss z";
+ protected ResourceBundle mResource;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public DefaultLogParser() {
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+ public Vector parse(Object entry) throws ParseException {
+ String logEntry = (String)entry;
+ //parsing the log Entry and return segments
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -" +logEntry);
+ int x = logEntry.indexOf("[");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String temp = logEntry.substring(x+1);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+
+ String dateStr = temp.substring(0,x);
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateStr+" "+temp);
+ SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
+ Date date = format.parse(dateStr);
+ String dateColumn = DateFormat.getDateInstance().format(date);
+ String timeColumn = DateFormat.getTimeInstance().format(date);
+
+ //Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateColumn+" "+timeColumn);
+ temp = temp.substring(x+2);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String source = temp.substring(1,x);
+ temp = temp.substring(x+2);
+ x = temp.indexOf("]");
+ if (x == -1)
+ throw new ParseException(logEntry,0);
+ String level = temp.substring(1,x);
+ temp = temp.substring(x+2);
+ Vector row = new Vector();
+ row.addElement(getSourceString(source));
+ row.addElement(getLevelString(level));
+ row.addElement(dateColumn);
+ row.addElement(timeColumn);
+ JLabel detail = new JLabel(temp);
+ detail.setToolTipText(temp);
+ row.addElement(detail);
+ return row;
+ }
+
+ public String getSourceString(String code) {
+ try {
+ return mResource.getString(SOURCE_PROPERTY+code);
+ } catch (MissingResourceException e) {
+ return code;
+ }
+ }
+
+ public String getLevelString(String code) {
+ try {
+ return mResource.getString(LEVEL_PROPERTY+code);
+ } catch (MissingResourceException e) {
+ return code;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java
new file mode 100644
index 000000000..df97978b5
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/ErrorLogDataModel.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+/**
+ * ErrorLogDataModel
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class ErrorLogDataModel extends LogDataModel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ //protected String[] mColumns = {DATE, TIME, DETAILS}; //overwrites the default
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public ErrorLogDataModel() {
+ //XXX SET CORRECT PARSER HERE
+ super();
+ }
+
+ //parser here
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java b/pki/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java
new file mode 100644
index 000000000..c0defd681
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/ILogParser.java
@@ -0,0 +1,38 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.text.*;
+import java.util.*;
+
+/**
+ * Interface for the log parser
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @date 02/04/97
+ */
+public interface ILogParser {
+
+ /**
+ * Parse the log entry into logical data display segments to be displayed
+ * in the table.
+ * Currently, only String object is supported by the log viewer.
+ */
+ public Vector parse(Object logEntry) throws ParseException;
+} \ No newline at end of file
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java
new file mode 100644
index 000000000..61d127524
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/LogDataModel.java
@@ -0,0 +1,107 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import java.awt.event.*;
+import javax.swing.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+
+/**
+ * LogDataModel to be displayed at the right hand side
+ *
+ * We need the log order in REVERSE.
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class LogDataModel extends CMSTableModel
+ implements IDataProcessor
+{
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ public static String ILOGENTRY = "ILOGENTRY";
+
+ protected String[] mColumns = {SOURCE, SEVERITY, DATE, TIME, DETAILS};
+ protected ILogParser mParser = null;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogDataModel() {
+ super();
+ init(mColumns);
+ }
+
+ public LogDataModel(ILogParser parser) {
+ this();
+ mParser = parser;
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * set the log parser
+ */
+ public void setParser(ILogParser parser) {
+ mParser = parser;
+ }
+
+
+ /**
+ * Process data called back
+ */
+ public void processData(Object data) {
+ Vector row;
+ if (mParser == null)
+ mParser = new DefaultLogParser();
+ try {
+ row = mParser.parse((String) data);
+ } catch (ParseException e) {
+ //Debug.println("LogDataModel: processData()");
+ return;
+ }
+ addRow(row);
+ }
+
+ /**
+ * NEED TO OVERWRITE THE TABLE MODEL ADD FUNCTION
+ * SINCE WE ARE PROVIDING REVERSE ORDER ENTRIES IN
+ * LOG FILES
+ */
+ public synchronized void addRow(Vector values) {
+ int row = 0;
+ for (int i=0; i < values.size(); i++) {
+ Vector v = (Vector)_tableColumns.elementAt(i);
+ v.insertElementAt(values.elementAt(i),0);
+ if (i == 0)
+ row = v.size() - 1;
+ }
+ fireTableDataChanged();
+ }
+
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java
new file mode 100644
index 000000000..c86ff02ff
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/LogEntryViewDialog.java
@@ -0,0 +1,202 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import com.netscape.admin.certsrv.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import javax.swing.table.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Policy Implementation Information viewer
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.config
+ */
+public class LogEntryViewDialog extends JDialog
+ implements ActionListener
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String PREFIX = "LOGENTRYVIEWDIALOG";
+
+ private JFrame mParentFrame;
+ private ResourceBundle mResource;
+ private JTextArea mTextArea;
+ private JLabel mSource, mLevel, mDate, mTime;
+
+ private JButton mOK;
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogEntryViewDialog(JFrame parent) {
+ super(parent,true);
+ mParentFrame = parent;
+ mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName());
+ setSize(600, 400);
+ setTitle(mResource.getString(PREFIX+"_TITLE"));
+ setLocationRelativeTo(parent);
+ getRootPane().setDoubleBuffered(true);
+ setDisplay();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * show the windows
+ */
+ public void showDialog(String source, String level,
+ String date, String time, String desc) {
+ //initialize and setup
+ mSource.setText(source);
+ mLevel.setText(level);
+ mDate.setText(date);
+ mTime.setText(time);
+ mTextArea.setText(desc);
+ mTextArea.setCaretPosition(0);
+ this.show();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource().equals(mOK)) {
+ this.hide();
+ }
+ }
+
+ /*==========================================================
+ * private methods
+ *==========================================================*/
+ private void setDisplay() {
+ getContentPane().setLayout(new BorderLayout());
+ JPanel center = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ center.setLayout(gb);
+
+ //content panel
+ JPanel content = makeContentPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ gb.setConstraints(content, gbc);
+ center.add(content);
+
+ //action panel
+ JPanel action = makeActionPane();
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.anchor = gbc.NORTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx = 1.0;
+ gb.setConstraints(action, gbc);
+ center.add(action);
+
+ getContentPane().add("Center",center);
+ }
+
+ private JPanel makeActionPane() {
+ mOK = CMSAdminUtil.makeJButton(mResource, PREFIX, "OK", null, this);
+ Dimension d = mOK.getMinimumSize();
+ if (d.width < CMSAdminUtil.DEFAULT_BUTTON_SIZE) {
+ d.width = CMSAdminUtil.DEFAULT_BUTTON_SIZE;
+ mOK.setMinimumSize(d);
+ }
+ JButton[] buttons = {mOK};
+ return CMSAdminUtil.makeJButtonPanel( buttons );
+ }
+
+ private JPanel makeContentPane() {
+ JPanel content = new JPanel();
+ GridBagLayout gb3 = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ content.setLayout(gb3);
+ //content.setBorder(CMSAdminUtil.makeEtchedBorder());
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "SOURCE", null);
+ mSource = new JLabel();
+ CMSAdminUtil.addEntryField(content, label1, mSource, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "LEVEL", null);
+ mLevel = new JLabel();
+ CMSAdminUtil.addEntryField(content, label2, mLevel, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "DATE", null);
+ mDate = new JLabel();
+ CMSAdminUtil.addEntryField(content, label3, mDate, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label4 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "TIME", null);
+ mTime = new JLabel();
+ CMSAdminUtil.addEntryField(content, label4, mTime, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label5 = CMSAdminUtil.makeJLabel(mResource, PREFIX, "DESC", null);
+ label5.setHorizontalAlignment(JLabel.RIGHT);
+ gbc.anchor = gbc.NORTHEAST;
+ gbc. insets = new Insets(CMSAdminUtil.COMPONENT_SPACE,
+ CMSAdminUtil.COMPONENT_SPACE,0,0);
+ gb3.setConstraints(label5, gbc);
+ content.add(label5);
+
+ CMSAdminUtil.resetGBC(gbc);
+ mTextArea = new JTextArea("",40,500);
+ mTextArea.setLineWrap(true);
+ mTextArea.setFont(mSource.getFont());
+ mTextArea.setEditable(false);
+ mTextArea.setBackground(getBackground());
+ JScrollPane scrollPanel = new JScrollPane(mTextArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPanel.setAlignmentX(LEFT_ALIGNMENT);
+ scrollPanel.setAlignmentY(TOP_ALIGNMENT);
+ scrollPanel.setBackground(getBackground());
+ scrollPanel.setBorder(BorderFactory.createEmptyBorder());
+ scrollPanel.setPreferredSize(new Dimension(500, 200));
+ //gbc.fill = gbc.VERTICAL;
+ gbc.fill = gbc.BOTH;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weightx=1.0;
+ gbc.weighty=1.0;
+ gb3.setConstraints(scrollPanel, gbc);
+ content.add(scrollPanel);
+
+ return content;
+ }
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java
new file mode 100644
index 000000000..36308e21f
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/LogInstancePanel.java
@@ -0,0 +1,160 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+
+import java.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.admin.certsrv.*;
+import com.netscape.certsrv.common.*;
+import com.netscape.management.client.util.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+
+/**
+ * Transactions Log Panel to be displayed at the right hand side
+ *
+ * @author Jack Pan-Chen
+ * @author Michelle Zhao
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class LogInstancePanel extends CMSLogPanel {
+
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private String mSelectedFile;
+ private String mInstanceName;
+ private static final String HELPINDEX = "status-logs-help";
+ private static final String AUDITHELPINDEX = "status-logs-audit-help";
+ private static final String SYSTEMHELPINDEX = "status-logs-system-help";
+ private static final String ERRORHELPINDEX = "status-logs-error-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public LogInstancePanel(CMSBaseResourceModel model) {
+ super(model, new LogDataModel());
+ mHelpToken = HELPINDEX;
+ }
+
+ public LogInstancePanel(String name, CMSBaseResourceModel model) {
+ super(model, new LogDataModel());
+ mInstanceName = name;
+ // xxx this is temperary
+ if (name.equals("transactions"))
+ mHelpToken = AUDITHELPINDEX;
+ else if (name.equals("system"))
+ mHelpToken = SYSTEMHELPINDEX;
+ else if (name.equals("error"))
+ mHelpToken = ERRORHELPINDEX;
+ else
+ mHelpToken = HELPINDEX;
+ }
+
+ /**
+ * retrieve data and process it
+ */
+ protected void update() {
+ AdminConnection connection = mModel.getServerInfo().getAdmin();
+
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.add(Constants.PR_LOG_INSTANCE, mInstanceName);
+ config.add(Constants.PR_LOG_ENTRY,mNoRecord.getText().trim());
+ config.add(Constants.PR_LOG_SOURCE,Integer.toString(mSource.getSelectedIndex()));
+ config.add(Constants.PR_LOG_LEVEL,Integer.toString(mLevel.getSelectedIndex()));
+ if ((mFile.getSelectedIndex()< 0) || (mFile.getSelectedIndex()< 0)) {
+ config.add(Constants.PR_LOG_NAME,Constants.PR_CURRENT_LOG);
+ mSelectedFile = mResource.getString("LOGCONTENT_COMBOBOX_FILE_DEFAULT");
+ } else {
+ String filename = (String) mFile.getSelectedItem();
+ if (filename.equalsIgnoreCase(Constants.PR_CURRENT_LOG))
+ filename = Constants.PR_CURRENT_LOG;
+ config.add(Constants.PR_LOG_NAME, filename);
+ mSelectedFile = (String) mFile.getSelectedItem();
+ }
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = connection.search(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_LOG_CONTENT,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ Debug.println(response.toString());
+
+ //update the table
+ for (Enumeration e = response.getNames(); e.hasMoreElements() ;) {
+ String entry = (String)e.nextElement();
+ mDataModel.processData(entry);
+ }
+
+ updateArchive();
+ }
+
+ /**
+ * retrieve archieve log file listing from the server
+ * side and poupulate the combobox
+ */
+ protected void updateArchive() {
+ AdminConnection connection = mModel.getServerInfo().getAdmin();
+ String value = mResource.getString("LOGCONTENT_COMBOBOX_FILE_DEFAULT");
+ mFile.removeAllItems();
+ mFile.addItem(value);
+
+ //get stuff
+ NameValuePairs response;
+ mModel.progressStart();
+ //construct NVP
+ NameValuePairs config = new NameValuePairs();
+ config.add(Constants.PR_LOG_INSTANCE, mInstanceName);
+ try {
+ response = connection.search(DestDef.DEST_LOG_ADMIN,
+ ScopeDef.SC_LOG_ARCH,
+ config);
+ } catch (EAdminException e) {
+ //display error dialog
+ showErrorDialog(e.getMessage());
+ mModel.progressStop();
+ return;
+ }
+
+ //update the combo
+ for (Enumeration e = response.getNames(); e.hasMoreElements() ;) {
+ String entry = (String)e.nextElement();
+ mFile.addItem(entry);
+ }
+ mModel.progressStop();
+ mFile.setSelectedItem(mSelectedFile);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(mHelpToken);
+ }
+ }
+}
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java b/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java
new file mode 100644
index 000000000..394a567cd
--- /dev/null
+++ b/pki/base/console/src/com/netscape/admin/certsrv/status/StatusPanel.java
@@ -0,0 +1,246 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2007 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.admin.certsrv.status;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import com.netscape.admin.certsrv.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import com.netscape.management.client.*;
+import com.netscape.management.client.util.*;
+import com.netscape.admin.certsrv.connection.*;
+import com.netscape.certsrv.common.*;
+
+/**
+ * Status to be placed at the right hand side
+ *
+ * @author Jack Pan-Chen
+ * @version $Revision$, $Date$
+ * @see com.netscape.admin.certsrv.status
+ */
+public class StatusPanel extends CMSBasePanel
+ implements IResourceSelectionListener, IRefreshTab, IRefreshTabPanel
+{
+ /*==========================================================
+ * variables
+ *==========================================================*/
+ private static String PANEL_NAME = "STATUSPANEL";
+
+ protected boolean mInit = false; // true if this panel is initialized
+ protected JPanel mStatPanel, mActionPanel; //panels
+ protected JButton mRefresh, mHelp; //action buttons
+ protected JLabel mServerName, mServerVersion, mInstallDate, mServerStart, mServerTime;
+
+ protected CMSBaseResourceModel mModel;
+ private AdminConnection mConnection;
+ private static final String HELPINDEX = "status-certsrv-help";
+
+ /*==========================================================
+ * constructors
+ *==========================================================*/
+ public StatusPanel(CMSBaseResourceModel model) {
+ super(PANEL_NAME);
+ model.addIResourceSelectionListener(this);
+ mModel = model;
+ mConnection = model.getServerInfo().getAdmin();
+ }
+
+ /*==========================================================
+ * public methods
+ *==========================================================*/
+
+ /**
+ * Actual Instanciation of the UI components
+ */
+ public void init() {
+ setLayout(new BorderLayout());
+
+ //======== stat panel ========================
+ mStatPanel = createStatPanel();
+ mStatPanel.setBorder(new EmptyBorder(DIFFERENT_COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE));
+ add("Center",mStatPanel);
+
+ //====== action panel ========================
+ mActionPanel = createActionPanel();
+ add("South",mActionPanel);
+ refresh();
+ }
+
+ /*==========================================================
+ * EVNET HANDLER METHODS
+ *==========================================================*/
+
+ //== IResourceListener ===
+
+ public void select(IResourceObject parent, Object viewInstance) {
+ if (!mInit) {
+ init();
+ mInit = true;
+ }
+
+ //refresh the screen
+ invalidate();
+ validate();
+ repaint(1);
+ }
+
+ public boolean unselect(IResourceObject parent, Object viewInstance) {
+ return true;
+ }
+
+ public CMSBasePanel getSelectedTab() {
+ return this;
+ }
+
+ //=== ACTIONLISTENER =====================
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(mRefresh)) {
+ Debug.println("StatusPanel: Refresh");
+ refresh();
+ }
+ if (e.getSource().equals(mHelp)) {
+ CMSAdminUtil.help(HELPINDEX);
+ }
+ }
+
+
+ /*==========================================================
+ * protected methods
+ *==========================================================*/
+
+ /**
+ * create action button panel
+ */
+ protected JPanel createActionPanel() {
+ //actionlister to this object
+ mRefresh = makeJButton("REFRESH");
+ mHelp = makeJButton("HELP");
+ JButton[] buttons = { mRefresh,mHelp };
+ return makeJButtonPanel(buttons,true,true);
+ }
+
+ /**
+ * create log listing panel
+ */
+ protected JPanel createStatPanel() {
+ JPanel outPanel = new JPanel();
+ GridBagLayout gb2 = new GridBagLayout();
+ GridBagConstraints gbc2 = new GridBagConstraints();
+ outPanel.setLayout(gb2);
+
+ JPanel panel = new JPanel();
+ GridBagLayout gb = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ panel.setLayout(gb);
+ panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource, PANEL_NAME, "GENERALINFO"));
+
+ CMSAdminUtil.resetGBC(gbc2);
+ gbc2.anchor = gbc2.NORTH;
+ gbc2.weightx = 1.0;
+ gbc2.weighty = 1.0;
+ gbc2.gridwidth = gbc2.REMAINDER;
+ gbc2.gridheight = gbc2.REMAINDER;
+ outPanel.add(panel, gbc2);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label1 = makeJLabel("SERVERNAME");
+ mServerName = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label1, mServerName, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label2 = makeJLabel("SERVERVERSION");
+ mServerVersion = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label2, mServerVersion, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label5 = makeJLabel("INSTALLDATE");
+ mInstallDate = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label5, mInstallDate, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ JLabel label3 = makeJLabel("SERVERSTARTUP");
+ mServerStart = new JLabel();
+ CMSAdminUtil.addEntryField(panel, label3, mServerStart, gbc);
+
+ CMSAdminUtil.resetGBC(gbc);
+ gbc.gridheight = gbc.REMAINDER;
+ gbc.weighty = 1.0;
+ JLabel label4 = makeJLabel("SERVERTIME");
+ mServerTime = new JLabel();
+ gbc.fill = gbc.NONE;
+ gbc.weightx = 0.0;
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.anchor = gbc.EAST;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE,0);
+ panel.add( label4, gbc );
+
+ gbc.gridx++;
+ gbc.anchor = gbc.WEST;
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.weightx = 1.0;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,
+ COMPONENT_SPACE,COMPONENT_SPACE);
+ panel.add( mServerTime, gbc );
+
+ return outPanel;
+ }
+
+
+ //=============================================
+ // SEND REQUESTS TO THE SERVER SIDE
+ //=============================================
+
+ //retrieve stat from server
+ public void refresh() {
+
+ NameValuePairs params = new NameValuePairs();
+ params.add(Constants.PR_STAT_STARTUP,"");
+ params.add(Constants.PR_STAT_TIME,"");
+
+ NameValuePairs response;
+ mModel.progressStart();
+ try {
+ response = mConnection.read(DestDef.DEST_SERVER_ADMIN,
+ ScopeDef.SC_STAT,
+ Constants.RS_ID_CONFIG,
+ params);
+ } catch (EAdminException e) {
+ //display error dialog
+ CMSAdminUtil.showErrorDialog(mModel.getFrame(), mResource,
+ e.toString(), ERROR_MESSAGE);
+ mModel.progressStop();
+ return;
+ }
+
+ mModel.progressStop();
+ Debug.println("StatusPanel: refresh() "+ response.toString());
+
+ //populate data
+ mServerName.setText(response.getValue(Constants.PR_STAT_INSTANCEID));
+ mServerVersion.setText(response.getValue(Constants.PR_STAT_VERSION));
+ mInstallDate.setText(response.getValue(Constants.PR_STAT_INSTALLDATE));
+ mServerStart.setText(response.getValue(Constants.PR_STAT_STARTUP));
+ mServerTime.setText(response.getValue(Constants.PR_STAT_TIME));
+ }
+
+}