src/com/netscape/management/admserv/panel/LoggingConfigPanel.java | 71 ++++++++--
src/com/netscape/management/admserv/panel/panel.properties | 3
2 files changed, 59 insertions(+), 15 deletions(-)
New commits:
commit 8a5bb4c58ab983c52d471de232053608d8e174bb
Author: Endi S. Dewata <edewata(a)redhat.com>
Date: Fri Apr 23 19:13:04 2010 -0500
Bug 368481 - Unable to change Admin Server log paths in Console
https://bugzilla.redhat.com/show_bug.cgi?id=368481
Resolves: bug 368481
Bug Description: Unable to change Admin Server log paths in Console
Fix Description: The console has been modified to split the log full
path into the path of the log directory and the file name. They will
be shown in separate text fields. Only the file name will be editable.
When the user saves the changes, the directory path will be combined
with the file name, then submitted to the server as a full path.
Reviewed by: rmeggins (and pushed by)
diff --git a/src/com/netscape/management/admserv/panel/LoggingConfigPanel.java
b/src/com/netscape/management/admserv/panel/LoggingConfigPanel.java
index 7699a38..e9a5422 100644
--- a/src/com/netscape/management/admserv/panel/LoggingConfigPanel.java
+++ b/src/com/netscape/management/admserv/panel/LoggingConfigPanel.java
@@ -38,11 +38,12 @@ public class LoggingConfigPanel extends PluginConfigPanel {
IConfigDataModel _configData;
static ResourceSet _resource;
- static String _i18nLogFile, _i18nErrorLogGroupbox,
+ static String _i18nLogPath, _i18nLogFile, _i18nErrorLogGroupbox,
_i18nAccessLogGroupbox;
static {
_resource = new
ResourceSet("com.netscape.management.admserv.panel.panel");
+ _i18nLogPath = _resource.getString("logging","LogPath");
_i18nLogFile = _resource.getString("logging","LogFile");
_i18nAccessLogGroupbox =
_resource.getString("logging","AccessLogGroupbox");
_i18nErrorLogGroupbox =
_resource.getString("logging","ErrorLogGroupbox");
@@ -54,6 +55,9 @@ public class LoggingConfigPanel extends PluginConfigPanel {
SuiConstants.SEPARATED_COMPONENT_SPACE;
public static final int rghtColInset = SuiConstants.COMPONENT_SPACE;
+ JLabel _lblAccessPath, _lblErrorPath;
+ JTextField _txtAccessPath, _txtErrorPath;
+
JLabel _lblAccessFile, _lblErrorFile;
JTextField _txtAccessFile, _txtErrorFile;
@@ -111,21 +115,36 @@ public class LoggingConfigPanel extends PluginConfigPanel {
}
public void setPanelContent(IConfigDataModel data) {
+System.out.println("LoggingConfigPanel.setPanelContent: data:
"+data.getClass().getName());
String value;
value = (String) data.getAttribute(AttrNames.CONFIG_ACCESSLOG);
- _txtAccessFile.setText(value == null ? "" : value);
+ if (value == null) {
+ _txtAccessPath.setText("");
+ _txtAccessFile.setText("");
+ } else {
+ int i = value.lastIndexOf('/');
+ _txtAccessPath.setText(value.substring(0, i));
+ _txtAccessFile.setText(value.substring(i+1));
+ }
value = (String) data.getAttribute(AttrNames.CONFIG_ERRORLOG);
- _txtErrorFile.setText(value == null ? "" : value);
+ if (value == null) {
+ _txtErrorPath.setText("");
+ _txtErrorFile.setText("");
+ } else {
+ int i = value.lastIndexOf('/');
+ _txtErrorPath.setText(value.substring(0, i));
+ _txtErrorFile.setText(value.substring(i+1));
+ }
}
public void getPanelContent(IConfigDataModel data)
throws ValidationException {
try {
data.setAttribute(AttrNames.CONFIG_ACCESSLOG,
- _txtAccessFile.getText());
+ _txtAccessPath.getText()+"/"+_txtAccessFile.getText());
data.setAttribute(AttrNames.CONFIG_ERRORLOG,
- _txtErrorFile.getText());
+ _txtErrorPath.getText()+"/"+_txtErrorFile.getText());
} catch (ValidationException e) {
throw e;
}
@@ -141,48 +160,72 @@ public class LoggingConfigPanel extends PluginConfigPanel {
p.setLayout(gbl = new GridBagLayout());
+ _lblAccessPath = new JLabel(_i18nLogPath);
+ _txtAccessPath = new SingleByteTextField(16);
_lblAccessFile = new JLabel(_i18nLogFile);
_txtAccessFile = new SingleByteTextField(16); // 324429
+ _txtAccessPath.setEditable(false);
+
//gbc.setInsets(0,leftColInset,0,0);
gbc.setGrid(0, 0, 1, 1);
gbc.setSpace(1.0, 0.0, GBC.WEST, //anchor
GBC.HORIZONTAL); //fill
- p.add(createLogGroup(_i18nAccessLogGroupbox, _lblAccessFile,
- _txtAccessFile), gbc);
+ p.add(createLogGroup(_i18nAccessLogGroupbox,
+ _lblAccessPath, _txtAccessPath,
+ _lblAccessFile, _txtAccessFile), gbc);
+ _lblErrorPath = new JLabel(_i18nLogPath);
+ _txtErrorPath = new SingleByteTextField(16);
_lblErrorFile = new JLabel(_i18nLogFile);
_txtErrorFile = new SingleByteTextField(16); // 324429
+ _txtErrorPath.setEditable(false);
+
//gbc.setInsets(0,leftColInset,0,0);
gbc.setGrid(0, 1, 1, 1);
gbc.setSpace(1.0, 0.0, GBC.WEST, //anchor
GBC.HORIZONTAL); //fill
- p.add(createLogGroup(_i18nErrorLogGroupbox, _lblErrorFile,
- _txtErrorFile), gbc);
+ p.add(createLogGroup(_i18nErrorLogGroupbox,
+ _lblErrorPath, _txtErrorPath,
+ _lblErrorFile, _txtErrorFile), gbc);
return p;
}
- private JPanel createLogGroup(String groupTitle, JLabel lbl,
- JTextField txt) {
+ private JPanel createLogGroup(String groupTitle,
+ JLabel lblPath, JTextField txtPath,
+ JLabel lblFile, JTextField txtFile) {
GridBagLayout gbl;
GBC gbc = new GBC();
JPanel group = new JPanel(gbl = new GridBagLayout());
group.setBorder(BaseConfigPanel.createGroupBorder(groupTitle));
- lbl.setFont(BaseConfigPanel.getLabelFont());
+ lblPath.setFont(BaseConfigPanel.getLabelFont());
gbc.setInsets(0, 0, 0, 0);
gbc.setGrid(0, 0, 1, 1);
gbc.setSpace(0.0, 0.0, GBC.WEST, //anchor
GBC.NONE); //fill
- group.add(lbl, gbc);
+ group.add(lblPath, gbc);
gbc.setInsets(0, rghtColInset, 0, 0);
gbc.setGrid(1, 0, 1, 1);
gbc.setSpace(1.0, 0.0, GBC.WEST, // anchor
GBC.HORIZONTAL); //fill
- group.add(txt, gbc);
+ group.add(txtPath, gbc);
+
+ lblFile.setFont(BaseConfigPanel.getLabelFont());
+ gbc.setInsets(0, 0, 0, 0);
+ gbc.setGrid(0, 1, 1, 1);
+ gbc.setSpace(0.0, 0.0, GBC.WEST, //anchor
+ GBC.NONE); //fill
+ group.add(lblFile, gbc);
+
+ gbc.setInsets(0, rghtColInset, 0, 0);
+ gbc.setGrid(1, 1, 1, 1);
+ gbc.setSpace(1.0, 0.0, GBC.WEST, // anchor
+ GBC.HORIZONTAL); //fill
+ group.add(txtFile, gbc);
return group;
}
diff --git a/src/com/netscape/management/admserv/panel/panel.properties
b/src/com/netscape/management/admserv/panel/panel.properties
index d8e7fda..bfdb482 100644
--- a/src/com/netscape/management/admserv/panel/panel.properties
+++ b/src/com/netscape/management/admserv/panel/panel.properties
@@ -188,7 +188,8 @@ network-MsgEnterServerUID=Please enter server UID
#
# Logging panel
#
-logging-LogFile=Log File:
+logging-LogPath=Path:
+logging-LogFile=File Name:
logging-AccessLogGroupbox=Access Log
logging-ErrorLogGroupbox=Error Log