[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit b655b809f54d96d2ea2d8bcfd9e250c91c5682ca
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 16:59:29 2011 -0500
fix scroll bar on downloads page
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
index e824e46..721f811 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
@@ -64,7 +64,6 @@ public class DownloadsView extends LocatableVLayout {
super(locatorId);
setHeight100();
setWidth100();
- setOverflow(Overflow.AUTO);
TitleBar titleBar = new TitleBar(this, MSG.view_adminConfig_downloads(), "global/Download_24.png");
addMember(titleBar);
@@ -74,6 +73,7 @@ public class DownloadsView extends LocatableVLayout {
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
sectionStack.setWidth100();
sectionStack.setHeight100();
+ sectionStack.setOverflow(Overflow.AUTO);
agentSection = new SectionStackSection(MSG.view_admin_downloads_agentDownload());
cliSection = new SectionStackSection(MSG.view_admin_downloads_cliDownload());
13 years, 3 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java | 158 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 47 ++
2 files changed, 190 insertions(+), 15 deletions(-)
New commits:
commit adecbd7152e2b41d21cd8a9dc0acb7aedef7ea84
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 16:37:11 2011 -0500
finish the bulk of the downloads page.
one thing left to do - get a scrollbar to show up when the section stack overflows
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
index eb4274d..e824e46 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
@@ -63,6 +64,7 @@ public class DownloadsView extends LocatableVLayout {
super(locatorId);
setHeight100();
setWidth100();
+ setOverflow(Overflow.AUTO);
TitleBar titleBar = new TitleBar(this, MSG.view_adminConfig_downloads(), "global/Download_24.png");
addMember(titleBar);
@@ -155,11 +157,94 @@ public class DownloadsView extends LocatableVLayout {
}
private void prepareCLISection() {
- // TODO Auto-generated method stub
+ systemManager.getClientVersionProperties(new AsyncCallback<HashMap<String, String>>() {
+ @Override
+ public void onSuccess(HashMap<String, String> result) {
+ String version = result.get("rhq-server.version");
+ String build = result.get("rhq-server.build-number");
+ String md5 = result.get("rhq-client.md5");
+
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("cliForm"));
+ form.setMargin(10);
+ form.setWidth100();
+
+ StaticTextItem versionItem = new StaticTextItem("cliVersion", MSG.view_admin_downloads_cli_version());
+ versionItem.setValue(version);
+ versionItem.setWrapTitle(false);
+
+ StaticTextItem buildItem = new StaticTextItem("cliBuild", MSG.view_admin_downloads_cli_buildNumber());
+ buildItem.setValue(build);
+ buildItem.setWrapTitle(false);
+
+ StaticTextItem md5Item = new StaticTextItem("cliMd5", MSG.view_admin_downloads_cli_md5());
+ md5Item.setValue(md5);
+ md5Item.setWrapTitle(false);
+
+ LinkItem linkItem = new LinkItem("cliLink");
+ linkItem.setTitle(MSG.view_admin_downloads_cli_link_label());
+ linkItem.setLinkTitle(MSG.view_admin_downloads_cli_link_value(version, build));
+ linkItem.setValue("/client/download");
+
+ SpacerItem spacerItem = new SpacerItem("clientSpacer");
+ spacerItem.setHeight(1);
+
+ StaticTextItem helpItem = new StaticTextItem("clientHelp");
+ helpItem.setColSpan(2);
+ helpItem.setShowTitle(false);
+ helpItem.setValue(MSG.view_admin_downloads_cli_help());
+
+ form.setItems(versionItem, buildItem, md5Item, linkItem, spacerItem, helpItem);
+
+ cliSection.setItems(form);
+ cliSection.setExpanded(true);
+ sectionStack.markForRedraw();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_downloads_cli_loadError(), caught);
+ }
+ });
}
private void prepareBundleSection() {
- // TODO Auto-generated method stub
+ systemManager.getBundleDeployerDownload(new AsyncCallback<HashMap<String, String>>() {
+ @Override
+ public void onSuccess(HashMap<String, String> result) {
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("bundleForm"));
+ form.setMargin(10);
+ form.setWidth100();
+
+ // there is only one item in the returned map - key=name, value=url
+ String name = result.keySet().iterator().next();
+ String url = result.values().iterator().next();
+
+ LinkItem linkItem = new LinkItem("bundleLink");
+ linkItem.setTitle(MSG.view_admin_downloads_bundle_link_label());
+ linkItem.setLinkTitle(MSG.view_admin_downloads_bundle_link_value(name));
+ linkItem.setValue(url);
+
+ SpacerItem spacerItem = new SpacerItem("bundleSpacer");
+ spacerItem.setHeight(1);
+
+ StaticTextItem helpItem = new StaticTextItem("bundleHelp");
+ helpItem.setColSpan(2);
+ helpItem.setShowTitle(false);
+ helpItem.setValue(MSG.view_admin_downloads_bundle_help());
+
+ form.setItems(linkItem, spacerItem, helpItem);
+
+ bundleSection.setItems(form);
+ bundleSection.setExpanded(true);
+ sectionStack.markForRedraw();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_downloads_bundle_loadError(), caught);
+ }
+ });
+
}
private void prepareConnectorsSection() {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index b0c7264..aaf8bb6 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -716,12 +716,12 @@ view_admin_downloads_cliDownload = Command Line Client Download
view_admin_downloads_bundleDownload = Bundle Deployer Download
view_admin_downloads_connectorsDownload = Connectors Download
+view_admin_downloads_agent_loadError = Cannot get agent version info
view_admin_downloads_agent_version = Agent Version
view_admin_downloads_agent_buildNumber = Agent Build
view_admin_downloads_agent_md5 = Agent MD5
view_admin_downloads_agent_link_label = Link
view_admin_downloads_agent_link_value = Download Agent {0} ({1})
-view_admin_downloads_agent_loadError = Cannot get agent version info
view_admin_downloads_agent_help = <p> \
This is the RHQ Agent Update Binary jar file. The purpose of this \
jar file is to allow you to install a fresh agent on a machine \
@@ -743,14 +743,31 @@ view_admin_downloads_agent_help = <p> \
</p>
view_admin_downloads_cli_loadError = Cannot get CLI version info
+view_admin_downloads_cli_version = CLI Version
+view_admin_downloads_cli_buildNumber = CLI Build
+view_admin_downloads_cli_md5 = CLI MD5
+view_admin_downloads_cli_link_label = Link
+view_admin_downloads_cli_link_value = Download CLI {0} ({1})
+view_admin_downloads_cli_help = <p> \
+ This is the Command Line Client tool, otherwise known as the CLI. \
+ It is a standalone tool that runs from within a console and provides a \
+ command line interface to the RHQ Server. You can invoke commands via the CLI \
+ as well as run scripts to perform automated tasks. See the documentation for \
+ more information on how to install and use the CLI. \
+ </p>
view_admin_downloads_bundle_loadError = Cannot get bundle deployer info
+view_admin_downloads_bundle_link_label = Link
+view_admin_downloads_bundle_link_value = Download Bundle Deployer {0}
+view_admin_downloads_bundle_help = <p> \
+ This is the Bundle Deployer tool. It is for use by developers and packagers of RHQ bundles. \
+ This standalone tool allows you to test your bundles and their recipes from a console. \
+ </p>
view_admin_downloads_connectors_loadError = Cannot get connectors info
view_admin_downloads_connectors_none = No connectors are available for download
view_admin_downloads_connectors_help = Connectors are software that is needed in order for some products to be manageable by RHQ. You install connectors into some managed products so RHQ agents can talk to them. See the documentation for more information.
-
#==================== Alerts ======================
view_alerts_table_title_group = Group Alert History
view_alerts_table_title_resource = Resource Alert History
commit d3774fec9244fafc3c34dd31de663a6da697b5d1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 16:05:35 2011 -0500
add some help text
add connectors
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
index 69c9bdc..eb4274d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
@@ -20,11 +20,13 @@
package org.rhq.enterprise.gui.coregui.client.admin;
import java.util.HashMap;
+import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.SectionStackSection;
@@ -130,7 +132,15 @@ public class DownloadsView extends LocatableVLayout {
linkItem.setLinkTitle(MSG.view_admin_downloads_agent_link_value(version, build));
linkItem.setValue("/agentupdate/download");
- form.setItems(versionItem, buildItem, md5Item, linkItem);
+ SpacerItem spacerItem = new SpacerItem("agentSpacer");
+ spacerItem.setHeight(10);
+
+ StaticTextItem helpItem = new StaticTextItem("agentHelp");
+ helpItem.setColSpan(2);
+ helpItem.setShowTitle(false);
+ helpItem.setValue(MSG.view_admin_downloads_agent_help());
+
+ form.setItems(versionItem, buildItem, md5Item, linkItem, spacerItem, helpItem);
agentSection.setItems(form);
agentSection.setExpanded(true);
@@ -139,7 +149,7 @@ public class DownloadsView extends LocatableVLayout {
@Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Cannot get agent version info", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_downloads_agent_loadError(), caught);
}
});
}
@@ -153,16 +163,51 @@ public class DownloadsView extends LocatableVLayout {
}
private void prepareConnectorsSection() {
- // TODO Auto-generated method stub
- }
+ systemManager.getConnectorDownloads(new AsyncCallback<HashMap<String, String>>() {
+ @Override
+ public void onSuccess(HashMap<String, String> result) {
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("connectors"));
+ form.setMargin(10);
+ form.setWidth100();
- @Deprecated
- private void cleanSectionStackSection(SectionStackSection section) {
- Canvas[] items = section.getItems();
- if (items != null) {
- for (Canvas canvas : items) {
- canvas.destroy();
+ if (result != null && !result.isEmpty()) {
+ int i = 0;
+ FormItem[] items = new FormItem[result.size() + 1];
+
+ StaticTextItem helpText = new StaticTextItem("connectorHelp");
+ helpText.setColSpan(2);
+ helpText.setShowTitle(false);
+ helpText.setValue(MSG.view_admin_downloads_connectors_help());
+ items[i] = helpText;
+ i++;
+
+ for (Map.Entry<String, String> entry : result.entrySet()) {
+ LinkItem linkItem = new LinkItem("connectorLink" + i);
+ linkItem.setColSpan(2);
+ linkItem.setShowTitle(false);
+ linkItem.setLinkTitle(entry.getKey());
+ linkItem.setValue(entry.getValue());
+ items[i] = linkItem;
+ i++;
+ }
+ form.setItems(items);
+ } else {
+ StaticTextItem item = new StaticTextItem("noConnectors");
+ item.setColSpan(2);
+ item.setShowTitle(false);
+ item.setValue(MSG.view_admin_downloads_connectors_none());
+ form.setItems(item);
+ }
+
+ connectorsSection.setItems(form);
+ connectorsSection.setExpanded(true);
+ sectionStack.markForRedraw();
}
- }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_downloads_connectors_loadError(), caught);
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 5662e52..b0c7264 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -721,6 +721,34 @@ view_admin_downloads_agent_buildNumber = Agent Build
view_admin_downloads_agent_md5 = Agent MD5
view_admin_downloads_agent_link_label = Link
view_admin_downloads_agent_link_value = Download Agent {0} ({1})
+view_admin_downloads_agent_loadError = Cannot get agent version info
+view_admin_downloads_agent_help = <p> \
+ This is the RHQ Agent Update Binary jar file. The purpose of this \
+ jar file is to allow you to install a fresh agent on a machine \
+ where an agent does not yet exist and to allow you to update \
+ an agent that is already installed on a machine. \
+ For more details, run this agent download jar with the --help command line option:<br/> \
+ <b>java -jar <agent-download.jar> --help</b> \
+ </p> \
+ <h3>Agent Install</h3> \
+ <p> \
+ <b>java -jar <agent-download.jar> --install[=<new agent directory>]</b><br/> \
+ This command will install a new agent. If you do not specify the new agent directory, the default will be "." \
+ </p> \
+ <h3>Agent Update</h3> \
+ <p> \
+ <b>java -jar <agent-download.jar> --update[=<old agent home>]</b><br/> \
+ This will update an existing agent that was already installed. \
+ If you do not specify the directory where the old, existing agent was installed, it will assumed to be "rhq-agent". \
+ </p>
+
+view_admin_downloads_cli_loadError = Cannot get CLI version info
+
+view_admin_downloads_bundle_loadError = Cannot get bundle deployer info
+
+view_admin_downloads_connectors_loadError = Cannot get connectors info
+view_admin_downloads_connectors_none = No connectors are available for download
+view_admin_downloads_connectors_help = Connectors are software that is needed in order for some products to be manageable by RHQ. You install connectors into some managed products so RHQ agents can talk to them. See the documentation for more information.
#==================== Alerts ======================
13 years, 3 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 76 ++++++++--
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/SessionAccessServlet.java | 13 +
3 files changed, 81 insertions(+), 11 deletions(-)
New commits:
commit f79d39fba75a583ae9f9970a20df914ef0d96533
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Feb 10 15:29:43 2011 -0500
CoreGUI Session Work
- Increase CoreGUI session timeout from 29 to 60 minutes. Each page
navigation resets the timer.
- Fixed problem where 29 minute timer was never reset even when actively
navigating in the UI.
- Now "pings" portal war every 20 minutes to ensure the HTTP session does
not time out. This allows browser refresh to avoid logging the user out if
performed after the standard http session timeout (30 minutes).
*** NOTE This fix requires a rebuild of Portal WAR. ***
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index fb04a3b..6c034c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -352,6 +352,9 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public void renderView(final ViewPath viewPath) {
Window.setTitle(getViewPathTitle(viewPath));
+ // keep our CoreGUI session alive by refreshing the session timer each time the user performs navigation
+ UserSessionManager.refresh();
+
if (viewPath.isEnd()) {
// default view
History.newItem(DEFAULT_VIEW_PATH);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index 4b63608..97dca94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -73,16 +73,33 @@ import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
public class UserSessionManager {
private static final Messages MSG = CoreGUI.getMessages();
- public static int SESSION_TIMEOUT = 29 * 60 * 1000; // 29 mins, just shorter than the 30-min web session timeout
- private static int LOGOUT_DELAY = 5 * 1000; // wait 5 seconds for in-flight requests to complete before logout
+ // The length of CoreGUI inactivity (no call to refresh()) before a CoreGUI session timeout
+ // Currently: 1 hour
+ private static int SESSION_TIMEOUT = 60 * 60 * 1000;
+
+ // After CoreGUI logiut, the delay before the server-side logout. Thisis the period in which we allow in-flight
+ // async requests to complete.
+ // Currently: 5 seconds
+ private static int LOGOUT_DELAY = 5 * 1000; // 5 seconds
+
+ // We want the CoreGUI session timeout to rule them all. The rhq subject session is refreshed on each SLSB
+ // call. But the HTTP session will die after 30 minutes. Keep it alive until logout by pinging SessionAccessServlet
+ // occasionaly, as specified by this interval (which must be less than the 30 minutes).
+ // Currently: 20 minutes
+ private static int SESSION_ACCESS_REFRESH = 20 * 60 * 1000;
// The web session
public static final String SESSION_NAME = "RHQ_Session";
// The web session scheduled to be logged out on the server side
private static final String DOOMED_SESSION_NAME = "RHQ_DoomedSession";
- // header identifier for triggering updating portal war webUser
- private static final String WEB_USER_UPDATE = "rhq_webuser_update";
+
+ // HTTP Header indicating to SessionAccessServlet to update the portal war webUser
+ private static final String HEADER_WEB_USER_UPDATE = "rhq_webuser_update";
+
+ // HTTP Header indicating to SessionAccessServlet to update the HTTP session access time
+ private static final String HEADER_LAST_ACCESS_UPDATE = "rhq_last_access_update";
+
private static final String LOCATOR_ID = "SessionManagerLogin";
private static Subject sessionSubject;
@@ -95,7 +112,7 @@ public class UserSessionManager {
}
};
- private static Timer sessionTimer = new Timer() {
+ private static Timer coreGuiSessionTimer = new Timer() {
@Override
public void run() {
Log.info("Session timer expired.");
@@ -103,6 +120,14 @@ public class UserSessionManager {
}
};
+ private static Timer httpSessionTimer = new Timer() {
+ @Override
+ public void run() {
+ Log.info("HTTP Session refresh timer expired.");
+ refreshHttpSession();
+ }
+ };
+
enum State {
IS_LOGGED_IN, //
IS_REGISTERING, //
@@ -169,7 +194,7 @@ public class UserSessionManager {
// new sessions get the full 29 minutes to expire
Log.info("sessionAccess-schedulingSessionTimeout: " + SESSION_TIMEOUT);
- sessionTimer.schedule(SESSION_TIMEOUT);
+ coreGuiSessionTimer.schedule(SESSION_TIMEOUT);
} else {
// existing sessions should expire 29 minutes from the previous access time
@@ -184,7 +209,7 @@ public class UserSessionManager {
}
Log.info("sessionAccess-reschedulingSessionTimeout: " + expiryMillis);
- sessionTimer.schedule((int) expiryMillis);
+ coreGuiSessionTimer.schedule((int) expiryMillis);
}
// Certain logins may not follow a "LogOut" history item. Specifically, if the session timer
@@ -371,7 +396,7 @@ public class UserSessionManager {
private static void scheduleWebUserUpdate(final Subject loggedInSubject) {
final RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/sessionAccess");
//add header to signal SessionAccessServlet to update the WebUser for the successfully logged in user
- b.setHeader(WEB_USER_UPDATE, String.valueOf(loggedInSubject.getSessionId()));
+ b.setHeader(HEADER_WEB_USER_UPDATE, String.valueOf(loggedInSubject.getSessionId()));
try {
b.setCallback(new RequestCallback() {
public void onResponseReceived(final Request request, final Response response) {
@@ -419,6 +444,7 @@ public class UserSessionManager {
sessionState = State.IS_LOGGED_IN;
userPreferences = new UserPreferences(loggedInSubject);
refresh();
+ httpSessionTimer.schedule(SESSION_ACCESS_REFRESH);
//conditionally update session information and server side WebUser when updated.
if ((sessionSubject != null) && (loggedInSubject.getId() != storedSessionSubjectId)) {
@@ -472,7 +498,7 @@ public class UserSessionManager {
sessionState = State.IS_LOGGED_IN;
Log.info("Refreshing session timer...");
- sessionTimer.schedule(millis);
+ coreGuiSessionTimer.schedule(millis);
}
public static void logout() {
@@ -482,12 +508,13 @@ public class UserSessionManager {
sessionState = State.IS_LOGGED_OUT;
Log.info("Destroying session timer...");
- sessionTimer.cancel();
+ coreGuiSessionTimer.cancel();
+ Log.info("Destroying http session refresh timer...");
+ httpSessionTimer.cancel();
// log out the web session on the server-side in a delayed fashion,
// allowing enough time to pass to let in-flight requests complete
scheduleLogoutServerSide(String.valueOf(sessionSubject.getSessionId()));
-
}
private static void scheduleLogoutServerSide(String sessionId) {
@@ -584,4 +611,31 @@ public class UserSessionManager {
public static UserPreferences getUserPreferences() {
return userPreferences;
}
+
+ private static void refreshHttpSession() {
+ final RequestBuilder b = new RequestBuilder(RequestBuilder.POST, "/sessionAccess");
+
+ // add header to signal SessionAccessServlet to refresh the http lastAccess time (basically a no-op as the
+ // request will make that happen).
+ b.setHeader(HEADER_LAST_ACCESS_UPDATE, "dummy");
+
+ try {
+ b.setCallback(new RequestCallback() {
+ public void onResponseReceived(final Request request, final Response response) {
+ Log.trace("Successfully submitted request to update HTTP accessTime");
+ }
+
+ @Override
+ public void onError(Request request, Throwable t) {
+ Log.trace("Error updating HTTP accessTime", t);
+ }
+ });
+ b.send();
+ } catch (RequestException e) {
+ Log.trace("Error requesting update of HTTP accessTime", e);
+ } finally {
+ httpSessionTimer.schedule(SESSION_ACCESS_REFRESH);
+ }
+ }
+
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/SessionAccessServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/SessionAccessServlet.java
index e07dc39..8935dcd 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/SessionAccessServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/SessionAccessServlet.java
@@ -66,6 +66,19 @@ public class SessionAccessServlet extends HttpServlet {
//check for web user update request from coregui. This is usually only set during ldap logins(case insensitive or registration.)
String sessionWebUserUpdate = request.getHeader("rhq_webuser_update");
+ // check for HTTP session lastAccess update request from coregui. This "ping" happens at regular intervals
+ // to keep the http session alive until a coreGui logout event takes place. Note, the HTTP session
+ // lastAccess value is different than the rhq subject's session lastAccess.
+ String sessionLastAccessUpdate = request.getHeader("rhq_last_access_update");
+
+ // If this is an HTTP session update request just return success. The access time has been updated already,
+ // just due to this request being sent.
+ if (sessionLastAccessUpdate != null) {
+ ServletOutputStream out = response.getOutputStream();
+ out.write("success".getBytes());
+ return;
+ }
+
/*
* check if the user object is in the session. if not, then the user is not validated, the response output
* will not contain the "<subjectId>:<sessionId>:<lastAccess>", which will forward the user to the login page
13 years, 3 months
[rhq] modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java | 168 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java | 34 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java | 124 +++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 16
modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_24.png |binary
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 5
10 files changed, 356 insertions(+), 16 deletions(-)
New commits:
commit 0bdeb3eb1c3bfa742697f6cdac57b0c80d80af36
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 15:09:25 2011 -0500
the start of the new gwt download page
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java
index 8f10652..ea518e4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java
@@ -45,6 +45,8 @@ public class ServerDetails implements Serializable {
DATABASE_DRIVER_VERSION, //
SERVER_TIMEZONE, //
SERVER_LOCAL_TIME, //
+ SERVER_INSTALL_DIR, // where RHQ is installed, the top directory where everything else is
+ SERVER_HOME_DIR, // where the RHQ server's JBossAS deployment is; this is under the install dir
CURRENT_MEASUREMENT_TABLE, //
NEXT_MEASUREMENT_TABLE_ROTATION;
};
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 224389c..7c57829 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -63,7 +63,6 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
.view_adminTopology_partitionEvents());
// TODO this iframe page view id should go away in favor of the gwt view page view_id, when available
- private static final ViewName PAGE_DOWNLOADS_VIEW_ID = new ViewName("Downloads", MSG.view_adminConfig_downloads());
private static final ViewName PAGE_PLUGINS_VIEW_ID = new ViewName("Plugins", MSG.view_adminConfig_plugins());
// TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available
@@ -187,11 +186,10 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
});
templatesItem.setRefreshRequired(true); // we always need a new page
- NavigationItem downloadsItem = new NavigationItem(PAGE_DOWNLOADS_VIEW_ID,
- "subsystems/bundle/BundleDeployment_16.png", new ViewFactory() {
+ NavigationItem downloadsItem = new NavigationItem(DownloadsView.VIEW_ID, "global/Download_16.png",
+ new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_DOWNLOADS_VIEW_ID.getName()),
- "/rhq/admin/downloads-body.xhtml?nomenu=true");
+ return new DownloadsView(extendLocatorId(DownloadsView.VIEW_ID.getName()));
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
new file mode 100644
index 0000000..69c9bdc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/DownloadsView.java
@@ -0,0 +1,168 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.admin;
+
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.SystemGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A simple page to view the downloads the server provides (like
+ * the agent update binary and the CLI distro).
+ *
+ * @author John Mazzitelli
+ */
+public class DownloadsView extends LocatableVLayout {
+
+ public static final ViewName VIEW_ID = new ViewName("Downloads", MSG.view_adminConfig_downloads());
+ public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ + AdministrationView.SECTION_CONFIGURATION_VIEW_ID + "/" + VIEW_ID;
+
+ private final SystemGWTServiceAsync systemManager = GWTServiceLookup.getSystemService();
+
+ private LocatableSectionStack sectionStack;
+ private SectionStackSection agentSection;
+ private SectionStackSection cliSection;
+ private SectionStackSection bundleSection;
+ private SectionStackSection connectorsSection;
+
+ public DownloadsView(String locatorId) {
+ super(locatorId);
+ setHeight100();
+ setWidth100();
+
+ TitleBar titleBar = new TitleBar(this, MSG.view_adminConfig_downloads(), "global/Download_24.png");
+ addMember(titleBar);
+
+ sectionStack = new LocatableSectionStack(extendLocatorId("stack"));
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth100();
+ sectionStack.setHeight100();
+
+ agentSection = new SectionStackSection(MSG.view_admin_downloads_agentDownload());
+ cliSection = new SectionStackSection(MSG.view_admin_downloads_cliDownload());
+ bundleSection = new SectionStackSection(MSG.view_admin_downloads_bundleDownload());
+ connectorsSection = new SectionStackSection(MSG.view_admin_downloads_connectorsDownload());
+
+ agentSection.setExpanded(false);
+ cliSection.setExpanded(false);
+ bundleSection.setExpanded(false);
+ connectorsSection.setExpanded(false);
+
+ sectionStack.addSection(agentSection);
+ sectionStack.addSection(cliSection);
+ sectionStack.addSection(bundleSection);
+ sectionStack.addSection(connectorsSection);
+
+ addMember(sectionStack);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ prepareAgentSection();
+ prepareCLISection();
+ prepareBundleSection();
+ prepareConnectorsSection();
+ }
+
+ private void prepareAgentSection() {
+ systemManager.getAgentVersionProperties(new AsyncCallback<HashMap<String, String>>() {
+ @Override
+ public void onSuccess(HashMap<String, String> result) {
+ String version = result.get("rhq-agent.latest.version");
+ String build = result.get("rhq-agent.latest.build-number");
+ String md5 = result.get("rhq-agent.latest.md5");
+
+ LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("agentForm"));
+ form.setMargin(10);
+ form.setWidth100();
+
+ StaticTextItem versionItem = new StaticTextItem("agentVersion", MSG
+ .view_admin_downloads_agent_version());
+ versionItem.setValue(version);
+ versionItem.setWrapTitle(false);
+
+ StaticTextItem buildItem = new StaticTextItem("agentBuild", MSG
+ .view_admin_downloads_agent_buildNumber());
+ buildItem.setValue(build);
+ buildItem.setWrapTitle(false);
+
+ StaticTextItem md5Item = new StaticTextItem("agentMd5", MSG.view_admin_downloads_agent_md5());
+ md5Item.setValue(md5);
+ md5Item.setWrapTitle(false);
+
+ LinkItem linkItem = new LinkItem("agentLink");
+ linkItem.setTitle(MSG.view_admin_downloads_agent_link_label());
+ linkItem.setLinkTitle(MSG.view_admin_downloads_agent_link_value(version, build));
+ linkItem.setValue("/agentupdate/download");
+
+ form.setItems(versionItem, buildItem, md5Item, linkItem);
+
+ agentSection.setItems(form);
+ agentSection.setExpanded(true);
+ sectionStack.markForRedraw();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Cannot get agent version info", caught);
+ }
+ });
+ }
+
+ private void prepareCLISection() {
+ // TODO Auto-generated method stub
+ }
+
+ private void prepareBundleSection() {
+ // TODO Auto-generated method stub
+ }
+
+ private void prepareConnectorsSection() {
+ // TODO Auto-generated method stub
+ }
+
+ @Deprecated
+ private void cleanSectionStackSection(SectionStackSection section) {
+ Canvas[] items = section.getItems();
+ if (items != null) {
+ for (Canvas canvas : items) {
+ canvas.destroy();
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
index ed1d7cc..6d8aaa2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
@@ -106,7 +106,8 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
setHeight100();
setWidth100();
- TitleBar titleBar = new TitleBar(this, "System Settings", "subsystems/configure/Configure_24.png");
+ TitleBar titleBar = new TitleBar(this, MSG.view_adminConfig_systemSettings(),
+ "subsystems/configure/Configure_24.png");
addMember(titleBar);
canvas = new LocatableVLayout("innerLayout");
@@ -304,8 +305,7 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
* @return system settings config def
*/
private ConfigurationDefinition getSystemSettingsDefinition(Configuration config) {
- ConfigurationDefinition def = new ConfigurationDefinition("sysset", MSG
- .view_admin_systemSettings_systemSettings());
+ ConfigurationDefinition def = new ConfigurationDefinition("sysset", MSG.view_adminConfig_systemSettings());
///////////////////////////////////
// General Configuration Properties
@@ -538,6 +538,8 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
.view_admin_systemSettings_serverDetails_tz());
final StaticTextItem serverTime = new StaticTextItem("localtime", MSG
.view_admin_systemSettings_serverDetails_time());
+ final StaticTextItem serverInstallDir = new StaticTextItem("installdir", MSG
+ .view_admin_systemSettings_serverDetails_installDir());
final StaticTextItem dbUrl = new StaticTextItem("dbUrl", MSG.view_admin_systemSettings_serverDetails_dbUrl());
final StaticTextItem dbProductName = new StaticTextItem("dbProductName", MSG
.view_admin_systemSettings_serverDetails_dbName());
@@ -557,6 +559,7 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
productBuildNumber.setWrapTitle(false);
serverTimezone.setWrapTitle(false);
serverTime.setWrapTitle(false);
+ serverInstallDir.setWrapTitle(false);
dbUrl.setWrapTitle(false);
dbProductName.setWrapTitle(false);
dbProductVersion.setWrapTitle(false);
@@ -565,8 +568,9 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
currentMeasRawTable.setWrapTitle(false);
nextMeasTableRotation.setWrapTitle(false);
- form.setItems(productName, productVersion, productBuildNumber, serverTimezone, serverTime, dbUrl,
- dbProductName, dbProductVersion, dbDriverName, dbDriverVersion, currentMeasRawTable, nextMeasTableRotation);
+ form.setItems(productName, productVersion, productBuildNumber, serverTimezone, serverTime, serverInstallDir,
+ dbUrl, dbProductName, dbProductVersion, dbDriverName, dbDriverVersion, currentMeasRawTable,
+ nextMeasTableRotation);
GWTServiceLookup.getSystemService().getServerDetails(new AsyncCallback<ServerDetails>() {
@@ -580,6 +584,7 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
HashMap<Detail, String> details = result.getDetails();
serverTimezone.setValue(details.get(ServerDetails.Detail.SERVER_TIMEZONE));
serverTime.setValue(details.get(ServerDetails.Detail.SERVER_LOCAL_TIME));
+ serverInstallDir.setValue(details.get(ServerDetails.Detail.SERVER_INSTALL_DIR));
dbUrl.setValue(details.get(ServerDetails.Detail.DATABASE_CONNECTION_URL));
dbProductName.setValue(details.get(ServerDetails.Detail.DATABASE_PRODUCT_NAME));
dbProductVersion.setValue(details.get(ServerDetails.Detail.DATABASE_PRODUCT_VERSION));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
index 0a47e29..03f164c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
@@ -39,5 +39,37 @@ public interface SystemGWTService extends RemoteService {
HashMap<String, String> getSystemConfiguration() throws RuntimeException;
- void setSystemConfiguration(HashMap<String, String> properties, boolean skipValidation) throws RuntimeException;
+ void setSystemConfiguration(HashMap<String, String> properties, boolean skipValidation);
+
+ /**
+ * @return metadata properties about the agent download available on the server.
+ */
+ HashMap<String, String> getAgentVersionProperties();
+
+ /**
+ * Returns the name and download URL (key and value respectively) of all connector downloads
+ * available on the server. The URL is relative to the server's host and port (i.e. only
+ * the path of the URL is returned).
+ *
+ * @return information about connectors that can be downloaded from the server
+ */
+ HashMap<String, String> getConnectorDownloads();
+
+ /**
+ * @return metadata properties about the CLI download available on the server.
+ */
+ HashMap<String, String> getClientVersionProperties();
+
+ /**
+ * Returns the name and download URL (key and value respectively) of the
+ * standalone bundle deployer tool available on the server for download.
+ * The URL is relative to the server's host and port (i.e. only
+ * the path of the URL is returned).
+ *
+ * The bundle deployer is a standalone tool that bundle authors/developers can use
+ * to test their bundles prior to uploading to RHQ and deploying to managed platforms.
+ *
+ * @return information about the bundle deployer tool that can be downloaded from the server
+ */
+ HashMap<String, String> getBundleDeployerDownload();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
index 1b5180b..c2dae6e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
@@ -18,7 +18,11 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -26,6 +30,7 @@ import org.rhq.core.domain.common.ProductInfo;
import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.SystemGWTService;
+import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -41,11 +46,12 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
private static final long serialVersionUID = 1L;
private SystemManagerLocal systemManager = LookupUtil.getSystemManager();
+ private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
@Override
public ProductInfo getProductInfo() throws RuntimeException {
try {
- return this.systemManager.getServerDetails(getSessionSubject()).getProductInfo();
+ return systemManager.getServerDetails(getSessionSubject()).getProductInfo();
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
@@ -54,7 +60,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
@Override
public ServerDetails getServerDetails() throws RuntimeException {
try {
- return this.systemManager.getServerDetails(getSessionSubject());
+ return systemManager.getServerDetails(getSessionSubject());
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
@@ -63,7 +69,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
@Override
public HashMap<String, String> getSystemConfiguration() throws RuntimeException {
try {
- Properties props = this.systemManager.getSystemConfiguration(getSessionSubject());
+ Properties props = systemManager.getSystemConfiguration(getSessionSubject());
return convertFromProperties(props);
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
@@ -74,12 +80,122 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
public void setSystemConfiguration(HashMap<String, String> map, boolean skipValidation) throws RuntimeException {
try {
Properties props = convertToProperties(map);
- this.systemManager.setSystemConfiguration(getSessionSubject(), props, skipValidation);
+ systemManager.setSystemConfiguration(getSessionSubject(), props, skipValidation);
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
+ @Override
+ public HashMap<String, String> getAgentVersionProperties() throws RuntimeException {
+ try {
+ File file = agentManager.getAgentUpdateVersionFile();
+
+ Properties props = new Properties();
+ props.load(new FileInputStream(file));
+
+ return convertFromProperties(props);
+ } catch (Throwable t) {
+ throw new RuntimeException("Agent download information not available. " + ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
+ public HashMap<String, String> getConnectorDownloads() throws RuntimeException {
+ try {
+ File downloadDir = getConnectorDownloadsDir();
+ List<File> files = getFiles(downloadDir);
+ if (files == null) {
+ return new HashMap<String, String>(0);
+ }
+ HashMap<String, String> map = new HashMap<String, String>(files.size());
+ for (File file : files) {
+ // key is the filename, value is the relative URL to download the file from the server
+ map.put(file.getName(), "/downloads/connectors/" + file.getName());
+ }
+ return map;
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+
+ }
+
+ private File getConnectorDownloadsDir() {
+ File serverHomeDir = getServerHomeDir();
+ File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/connectors");
+ if (!downloadDir.exists()) {
+ throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]");
+ }
+ return downloadDir;
+ }
+
+ private File getClientDownloadDir() {
+ File serverHomeDir = getServerHomeDir();
+ File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/rhq-client");
+ if (!downloadDir.exists()) {
+ throw new RuntimeException("Server is missing client download directory at [" + downloadDir + "]");
+ }
+ return downloadDir;
+ }
+
+ @Override
+ public HashMap<String, String> getClientVersionProperties() throws RuntimeException {
+ File versionFile = new File(getClientDownloadDir(), "rhq-client-version.properties");
+ try {
+ Properties p = new Properties();
+ p.load(new FileInputStream(versionFile));
+ return convertFromProperties(p);
+ } catch (Throwable t) {
+ throw new RuntimeException("Unable to retrieve client version info. " + ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
+ public HashMap<String, String> getBundleDeployerDownload() throws RuntimeException {
+ try {
+ File downloadDir = getBundleDeployerDownloadDir();
+ List<File> files = getFiles(downloadDir);
+ if (files.isEmpty()) {
+ throw new RuntimeException("Missing bundle deployer download file");
+ }
+ File file = files.get(0);
+ HashMap<String, String> ret = new HashMap<String, String>(1);
+ ret.put(file.getName(), "/downloads/bundle-deployer/" + file.getName());
+ return ret;
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+
+ }
+
+ private File getBundleDeployerDownloadDir() {
+ File serverHomeDir = getServerHomeDir();
+ File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/bundle-deployer");
+ if (!downloadDir.exists()) {
+ throw new RuntimeException("Missing bundle deployer download directory at [" + downloadDir + "]");
+ }
+ return downloadDir;
+ }
+
+ private File getServerHomeDir() {
+ ServerDetails details = systemManager.getServerDetails(LookupUtil.getSubjectManager().getOverlord());
+ File serverHomeDir = new File(details.getDetails().get(ServerDetails.Detail.SERVER_HOME_DIR));
+ return serverHomeDir;
+ }
+
+ private static List<File> getFiles(File downloadDir) {
+ File[] filesArray = downloadDir.listFiles();
+ List<File> files = new ArrayList<File>();
+ if (filesArray != null) {
+ for (File file : filesArray) {
+ if (file.isFile()) {
+ files.add(file);
+ }
+ }
+ }
+ return files;
+ }
+
// GWT does not support java.util.Properties - we have to convert to/from Properties <-> HashMap
private Properties convertToProperties(HashMap<String, String> map) {
Properties props = new Properties();
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 539fa4c..5662e52 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -643,7 +643,6 @@ view_admin_systemSettings_cannotLoadSettings = Cannot obtain the current system
view_admin_systemSettings_savedSettings = You successfully saved the system properties
view_admin_systemSettings_saveFailure = Failed to save the system settings
view_admin_systemSettings_fixBeforeSaving = Please fix the invalid values before saving
-view_admin_systemSettings_systemSettings = System Settings
view_admin_systemSettings_group_general = General Configuration Properties
view_admin_systemSettings_group_dataMgr = Data Manager Configuration Properties
view_admin_systemSettings_group_baseline = Automatic Baseline Configuration Properties
@@ -653,6 +652,7 @@ view_admin_systemSettings_serverDetails = Server Details
view_admin_systemSettings_serverDetails_buildNumber = Build Number
view_admin_systemSettings_serverDetails_tz = Server Time Zone
view_admin_systemSettings_serverDetails_time = Server Local Time
+view_admin_systemSettings_serverDetails_installDir = Server Installation Directory
view_admin_systemSettings_serverDetails_dbUrl = Database Connection URL
view_admin_systemSettings_serverDetails_dbName = Database Product Name
view_admin_systemSettings_serverDetails_dbVersion = Database Product Version
@@ -709,6 +709,20 @@ view_admin_systemSettings_LDAPBindDN_desc = The username to connect to the LDAP
view_admin_systemSettings_LDAPBindPW_name = Password
view_admin_systemSettings_LDAPBindPW_desc = The credentials of the user used to connect to the LDAP server when querying the LDAP user database.
+# Administration/Downloads
+#------------------------------
+view_admin_downloads_agentDownload = Agent Download
+view_admin_downloads_cliDownload = Command Line Client Download
+view_admin_downloads_bundleDownload = Bundle Deployer Download
+view_admin_downloads_connectorsDownload = Connectors Download
+
+view_admin_downloads_agent_version = Agent Version
+view_admin_downloads_agent_buildNumber = Agent Build
+view_admin_downloads_agent_md5 = Agent MD5
+view_admin_downloads_agent_link_label = Link
+view_admin_downloads_agent_link_value = Download Agent {0} ({1})
+
+
#==================== Alerts ======================
view_alerts_table_title_group = Group Alert History
view_alerts_table_title_resource = Resource Alert History
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_16.png
new file mode 100644
index 0000000..737dba9
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_24.png
new file mode 100644
index 0000000..95640f1
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Download_24.png differ
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index 27eea7c..1d4cb36 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -548,7 +548,10 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
}
}
+ @RequiredPermission(Permission.MANAGE_SETTINGS)
public ServerDetails getServerDetails(Subject subject) {
+ CoreServerMBean coreServerMBean = LookupUtil.getCoreServer();
+
ServerDetails serverDetails = new ServerDetails();
serverDetails.setProductInfo(getProductInfo(subject));
@@ -558,6 +561,8 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
DateFormat localTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL);
details.put(ServerDetails.Detail.SERVER_LOCAL_TIME, localTimeFormatter.format(new Date()));
details.put(ServerDetails.Detail.SERVER_TIMEZONE, TimeZone.getDefault().getDisplayName());
+ details.put(ServerDetails.Detail.SERVER_HOME_DIR, coreServerMBean.getJBossServerHomeDir().getAbsolutePath());
+ details.put(ServerDetails.Detail.SERVER_INSTALL_DIR, coreServerMBean.getInstallDir().getAbsolutePath());
SystemDatabaseInformation dbInfo = SystemDatabaseInformation.getInstance();
details.put(ServerDetails.Detail.DATABASE_CONNECTION_URL, dbInfo.getDatabaseConnectionURL());
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 21 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java | 5 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java | 6 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 4 -
4 files changed, 22 insertions(+), 14 deletions(-)
New commits:
commit 15049a6f457c56107c6e5878e57f2149e7e002bd
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 13:00:33 2011 -0500
put view ids in the view classes themselves to be consistent with the rest of the gwt views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index dbb23d5..224389c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -62,10 +62,7 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
private static final ViewName PAGE_PARTITION_EVENTS_VIEW_ID = new ViewName("PartitionEvents", MSG
.view_adminTopology_partitionEvents());
- // TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available
- private static final ViewName PAGE_SYSTEM_SETTINGS_VIEW_ID = new ViewName("SystemSettings", MSG
- .view_adminConfig_systemSettings());
- public static final ViewName PAGE_TEMPLATES_VIEW_ID = new ViewName("Templates", MSG.view_adminConfig_templates());
+ // TODO this iframe page view id should go away in favor of the gwt view page view_id, when available
private static final ViewName PAGE_DOWNLOADS_VIEW_ID = new ViewName("Downloads", MSG.view_adminConfig_downloads());
private static final ViewName PAGE_PLUGINS_VIEW_ID = new ViewName("Plugins", MSG.view_adminConfig_plugins());
@@ -174,20 +171,20 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
}
private NavigationSection buildConfigurationSection() {
- NavigationItem systemSettingsItem = new NavigationItem(PAGE_SYSTEM_SETTINGS_VIEW_ID,
+ NavigationItem systemSettingsItem = new NavigationItem(SystemSettingsView.VIEW_ID,
"subsystems/configure/Configure_16.png", new ViewFactory() {
public Canvas createView() {
- return new SystemSettingsView(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID.getName()));
+ return new SystemSettingsView(extendLocatorId(SystemSettingsView.VIEW_ID.getName()));
}
});
systemSettingsItem.setRefreshRequired(true); // refresh so it always reloads the latest settings
- NavigationItem templatesItem = new NavigationItem(PAGE_TEMPLATES_VIEW_ID, ImageManager.getMetricEditIcon(),
- new ViewFactory() {
- public Canvas createView() {
- return new ResourceTypeTreeView(extendLocatorId(PAGE_TEMPLATES_VIEW_ID.getName()));
- }
- });
+ NavigationItem templatesItem = new NavigationItem(ResourceTypeTreeView.VIEW_ID, ImageManager
+ .getMetricEditIcon(), new ViewFactory() {
+ public Canvas createView() {
+ return new ResourceTypeTreeView(extendLocatorId(ResourceTypeTreeView.VIEW_ID.getName()));
+ }
+ });
templatesItem.setRefreshRequired(true); // we always need a new page
NavigationItem downloadsItem = new NavigationItem(PAGE_DOWNLOADS_VIEW_ID,
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
index 48ca489..ed1d7cc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
@@ -47,6 +47,7 @@ import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
@@ -61,6 +62,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class SystemSettingsView extends LocatableVLayout implements PropertyValueChangeListener {
+ public static final ViewName VIEW_ID = new ViewName("SystemSettings", MSG.view_adminConfig_systemSettings());
+ public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ + AdministrationView.SECTION_CONFIGURATION_VIEW_ID + "/" + VIEW_ID;
+
private LocatableVLayout canvas;
private ConfigurationEditor editor;
private IButton saveButton;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index 01a5571..ee04115 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -47,9 +47,11 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.TemplateAlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.TypesLoadedCallback;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
@@ -66,6 +68,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
*/
public class ResourceTypeTreeView extends LocatableVLayout implements BookmarkableView {
+ public static final ViewName VIEW_ID = new ViewName("Templates", MSG.view_adminConfig_templates());
+ public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ + AdministrationView.SECTION_CONFIGURATION_VIEW_ID + "/" + VIEW_ID;
+
private Layout gridCanvas;
private Layout alertTemplateCanvas;
private Layout metricTemplateCanvas;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 4349039..7a29da1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -32,7 +32,6 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.admin.templates.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.SubsystemResourceAlertView;
@@ -138,7 +137,8 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
NavigationItem alertDefinitionsItem = new NavigationItem(new ViewName("AlertDefinitions", MSG
.view_reports_alertDefinitions()), "subsystems/alert/Alerts_16.png", new ViewFactory() {
public Canvas createView() {
- return new ResourceTypeTreeView(extendLocatorId(AdministrationView.PAGE_TEMPLATES_VIEW_ID.getName()));
+ // TODO this isn't really want we want - we need to impl a true view with all alert definitions in a table
+ return new ResourceTypeTreeView(extendLocatorId(ResourceTypeTreeView.VIEW_ID.getName()));
}
});
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java | 32 ++++++----
1 file changed, 20 insertions(+), 12 deletions(-)
New commits:
commit 3e15cda2b90623da67e8a98f4bd25cde83902056
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 12:26:49 2011 -0500
fix id conflict
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
index 614fb1d..d5c3a66 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
@@ -178,15 +178,19 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
this.sectionStack.addSection(section);
}
- public void setContent(Canvas newContent) {
+ public void destroyCurrentContent() {
// A call to destroy (e.g. certain IFrames/FullHTMLPane) can actually remove multiple children of the
// contentCanvas. As such, we need to query for the children after each destroy to ensure only valid children
- // are in the array.
- Canvas[] children;
- while ((children = contentCanvas.getChildren()).length > 0) {
- children[0].destroy();
+ // are in the array. Note that we need to make sure we do this destroy before we create the new content
+ if (contentCanvas != null) {
+ Canvas[] children;
+ while ((children = contentCanvas.getChildren()).length > 0) {
+ children[0].destroy();
+ }
}
+ }
+ public void setContent(Canvas newContent) {
contentCanvas.addChild(newContent);
contentCanvas.markForRedraw();
currentContent = newContent;
@@ -217,12 +221,15 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
// Only update the content pane if the item has an associated view factory.
ViewFactory viewFactory = item.getViewFactory();
- Canvas content = (viewFactory != null) ? viewFactory.createView() : null;
- if (content != null) {
- setContent(content);
-
- if (content instanceof BookmarkableView) {
- ((BookmarkableView) content).renderView(viewPath.next().next());
+ if (viewFactory != null) {
+ destroyCurrentContent();
+ Canvas content = viewFactory.createView();
+ if (content != null) {
+ setContent(content);
+
+ if (content instanceof BookmarkableView) {
+ ((BookmarkableView) content).renderView(viewPath.next().next());
+ }
}
}
}
@@ -230,7 +237,8 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
public void renderView(ViewPath viewPath) {
if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
if (viewPath.isEnd()) {
- // Display default view
+ // Display default view - note that defaultView() will create new content, so we have to destroy the old, current content
+ destroyCurrentContent();
setContent(defaultView());
initSectionPageTreeGrids();
} else {
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java | 234 ++++------
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 72 +++
2 files changed, 179 insertions(+), 127 deletions(-)
New commits:
commit 51a76f575f79bf7e597c83f238c2457821f89f6f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 10:04:36 2011 -0500
i18n system settings page
fix bug - ldap section should not be hidden if ldap is selected
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
index 3684193..48ca489 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
@@ -189,7 +189,7 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
@Override
public void onFailure(Throwable t) {
- CoreGUI.getErrorHandler().handleError("Cannot obtain the current system settings", t);
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_systemSettings_cannotLoadSettings(), t);
}
});
}
@@ -249,17 +249,17 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
@Override
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
- new Message("You successfully saved the system properties", Message.Severity.Info));
+ new Message(MSG.view_admin_systemSettings_savedSettings(), Message.Severity.Info));
}
@Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to save the system settings", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_systemSettings_saveFailure(), caught);
}
});
} else {
CoreGUI.getMessageCenter().notify(
- new Message("Please fix the invalid values before saving", Severity.Warning, EnumSet
+ new Message(MSG.view_admin_systemSettings_fixBeforeSaving(), Severity.Warning, EnumSet
.of(Message.Option.Transient)));
}
}
@@ -299,54 +299,51 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
* @return system settings config def
*/
private ConfigurationDefinition getSystemSettingsDefinition(Configuration config) {
- ConfigurationDefinition def = new ConfigurationDefinition("sysset", "System settings");
+ ConfigurationDefinition def = new ConfigurationDefinition("sysset", MSG
+ .view_admin_systemSettings_systemSettings());
///////////////////////////////////
// General Configuration Properties
PropertyGroupDefinition generalGroup = new PropertyGroupDefinition("general");
- generalGroup.setDisplayName("General Configuration Properties");
+ generalGroup.setDisplayName(MSG.view_admin_systemSettings_group_general());
generalGroup.setDefaultHidden(false);
generalGroup.setOrder(0);
- PropertyDefinitionSimple baseUrl = new PropertyDefinitionSimple(Constant.BaseURL,
- "A URL to the server GUI, used mainly within alert email notification", true, PropertySimpleType.STRING);
- baseUrl.setDisplayName("GUI Console URL");
+ PropertyDefinitionSimple baseUrl = new PropertyDefinitionSimple(Constant.BaseURL, MSG
+ .view_admin_systemSettings_BaseURL_desc(), true, PropertySimpleType.STRING);
+ baseUrl.setDisplayName(MSG.view_admin_systemSettings_BaseURL_name());
baseUrl.setPropertyGroupDefinition(generalGroup);
baseUrl.setDefaultValue("http://localhost:7080");
def.put(baseUrl);
PropertyDefinitionSimple agentMaxQuietTimeAllowed = new PropertyDefinitionSimple(
- Constant.AgentMaxQuietTimeAllowed,
- "If this amount of time passes without hearing from an agent, that quiet agent will be considered down. This value is specified in minutes.",
- true, PropertySimpleType.INTEGER);
- agentMaxQuietTimeAllowed.setDisplayName("Agent Max Quiet Time Allowed");
+ Constant.AgentMaxQuietTimeAllowed, MSG.view_admin_systemSettings_AgentMaxQuietTimeAllowed_desc(), true,
+ PropertySimpleType.INTEGER);
+ agentMaxQuietTimeAllowed.setDisplayName(MSG.view_admin_systemSettings_AgentMaxQuietTimeAllowed_name());
agentMaxQuietTimeAllowed.setPropertyGroupDefinition(generalGroup);
agentMaxQuietTimeAllowed.addConstraints(new IntegerRangeConstraint(Long.valueOf(2), null)); // don't allow less than 2m since it will cause too many false backfills
agentMaxQuietTimeAllowed.setDefaultValue("15");
def.put(agentMaxQuietTimeAllowed);
- PropertyDefinitionSimple enableAgentAutoUpdate = new PropertyDefinitionSimple(
- Constant.EnableAgentAutoUpdate,
- "Determines if the server will allow agents to auto-update themselves. You will not be able to download agent distributions from the server if this is disabled.",
- true, PropertySimpleType.BOOLEAN);
- enableAgentAutoUpdate.setDisplayName("Enable Agent Auto-Updates");
+ PropertyDefinitionSimple enableAgentAutoUpdate = new PropertyDefinitionSimple(Constant.EnableAgentAutoUpdate,
+ MSG.view_admin_systemSettings_EnableAgentAutoUpdate_desc(), true, PropertySimpleType.BOOLEAN);
+ enableAgentAutoUpdate.setDisplayName(MSG.view_admin_systemSettings_EnableAgentAutoUpdate_name());
enableAgentAutoUpdate.setPropertyGroupDefinition(generalGroup);
enableAgentAutoUpdate.setDefaultValue("true");
def.put(enableAgentAutoUpdate);
- PropertyDefinitionSimple enableDebugMode = new PropertyDefinitionSimple(Constant.EnableDebugMode,
- "If enabled, the server will enter debug mode", true, PropertySimpleType.BOOLEAN);
- enableDebugMode.setDisplayName("Enable Debug Mode");
+ PropertyDefinitionSimple enableDebugMode = new PropertyDefinitionSimple(Constant.EnableDebugMode, MSG
+ .view_admin_systemSettings_EnableDebugMode_desc(), true, PropertySimpleType.BOOLEAN);
+ enableDebugMode.setDisplayName(MSG.view_admin_systemSettings_EnableDebugMode_name());
enableDebugMode.setPropertyGroupDefinition(generalGroup);
enableDebugMode.setDefaultValue("false");
def.put(enableDebugMode);
PropertyDefinitionSimple enableExperimentalFeatures = new PropertyDefinitionSimple(
- Constant.EnableExperimentalFeatures,
- "If enabled, any experimental features that exist in the current product will be available.", true,
+ Constant.EnableExperimentalFeatures, MSG.view_admin_systemSettings_EnableExperimentalFeatures_desc(), true,
PropertySimpleType.BOOLEAN);
- enableExperimentalFeatures.setDisplayName("Enable Experimental Features");
+ enableExperimentalFeatures.setDisplayName(MSG.view_admin_systemSettings_EnableExperimentalFeatures_name());
enableExperimentalFeatures.setPropertyGroupDefinition(generalGroup);
enableExperimentalFeatures.setDefaultValue("false");
def.put(enableExperimentalFeatures);
@@ -355,68 +352,61 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
// Data Manager Configuration Properties
PropertyGroupDefinition dataManagerGroup = new PropertyGroupDefinition("datamanager");
- dataManagerGroup.setDisplayName("Data Manager Configuration Properties");
+ dataManagerGroup.setDisplayName(MSG.view_admin_systemSettings_group_dataMgr());
dataManagerGroup.setDefaultHidden(false);
dataManagerGroup.setOrder(1);
- PropertyDefinitionSimple dataMaintenance = new PropertyDefinitionSimple(
- Constant.DataMaintenance,
- "How often database maintenance is performed (for example, vacuuming if using Postgres). This is specified in hours.",
- true, PropertySimpleType.INTEGER);
- dataMaintenance.setDisplayName("Database Maintenance Period");
+ PropertyDefinitionSimple dataMaintenance = new PropertyDefinitionSimple(Constant.DataMaintenance, MSG
+ .view_admin_systemSettings_DataMaintenance_desc(), true, PropertySimpleType.INTEGER);
+ dataMaintenance.setDisplayName(MSG.view_admin_systemSettings_DataMaintenance_name());
dataMaintenance.setPropertyGroupDefinition(dataManagerGroup);
dataMaintenance.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
dataMaintenance.setDefaultValue("1");
def.put(dataMaintenance);
- PropertyDefinitionSimple availabilityPurge = new PropertyDefinitionSimple(Constant.AvailabilityPurge,
- "How old availability data must be before being purged from the database. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- availabilityPurge.setDisplayName("Delete Availability Data Older Than");
+ PropertyDefinitionSimple availabilityPurge = new PropertyDefinitionSimple(Constant.AvailabilityPurge, MSG
+ .view_admin_systemSettings_AvailabilityPurge_desc(), true, PropertySimpleType.INTEGER);
+ availabilityPurge.setDisplayName(MSG.view_admin_systemSettings_AvailabilityPurge_name());
availabilityPurge.setPropertyGroupDefinition(dataManagerGroup);
availabilityPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
availabilityPurge.setDefaultValue("365");
def.put(availabilityPurge);
- PropertyDefinitionSimple alertPurge = new PropertyDefinitionSimple(Constant.AlertPurge,
- "How old alert history items must be before being purged from the database. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- alertPurge.setDisplayName("Delete Alerts Older Than");
+ PropertyDefinitionSimple alertPurge = new PropertyDefinitionSimple(Constant.AlertPurge, MSG
+ .view_admin_systemSettings_AlertPurge_desc(), true, PropertySimpleType.INTEGER);
+ alertPurge.setDisplayName(MSG.view_admin_systemSettings_AlertPurge_name());
alertPurge.setPropertyGroupDefinition(dataManagerGroup);
alertPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
alertPurge.setDefaultValue("31");
def.put(alertPurge);
- PropertyDefinitionSimple traitPurge = new PropertyDefinitionSimple(Constant.TraitPurge,
- "How old measurement trait data must be before being purged from the database. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- traitPurge.setDisplayName("Delete Measurement Traits Older Than");
+ PropertyDefinitionSimple traitPurge = new PropertyDefinitionSimple(Constant.TraitPurge, MSG
+ .view_admin_systemSettings_TraitPurge_desc(), true, PropertySimpleType.INTEGER);
+ traitPurge.setDisplayName(MSG.view_admin_systemSettings_TraitPurge_name());
traitPurge.setPropertyGroupDefinition(dataManagerGroup);
traitPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
traitPurge.setDefaultValue("365");
def.put(traitPurge);
- PropertyDefinitionSimple rtDataPurge = new PropertyDefinitionSimple(Constant.RtDataPurge,
- "How old response time data must be before being purged from the database. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- rtDataPurge.setDisplayName("Delete Response Time Data Older Than");
+ PropertyDefinitionSimple rtDataPurge = new PropertyDefinitionSimple(Constant.RtDataPurge, MSG
+ .view_admin_systemSettings_RtDataPurge_desc(), true, PropertySimpleType.INTEGER);
+ rtDataPurge.setDisplayName(MSG.view_admin_systemSettings_RtDataPurge_name());
rtDataPurge.setPropertyGroupDefinition(dataManagerGroup);
rtDataPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
rtDataPurge.setDefaultValue("31");
def.put(rtDataPurge);
- PropertyDefinitionSimple eventPurge = new PropertyDefinitionSimple(Constant.EventPurge,
- "How old event data must be before being purged from the database. This is specified in days.", true,
- PropertySimpleType.INTEGER);
- eventPurge.setDisplayName("Delete Events Older Than");
+ PropertyDefinitionSimple eventPurge = new PropertyDefinitionSimple(Constant.EventPurge, MSG
+ .view_admin_systemSettings_EventPurge_desc(), true, PropertySimpleType.INTEGER);
+ eventPurge.setDisplayName(MSG.view_admin_systemSettings_EventPurge_name());
eventPurge.setPropertyGroupDefinition(dataManagerGroup);
eventPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
eventPurge.setDefaultValue("14");
def.put(eventPurge);
- PropertyDefinitionSimple dataReindex = new PropertyDefinitionSimple(Constant.DataReindex,
- "If enabled, certain database tables will be re-indexed periodically.", true, PropertySimpleType.BOOLEAN);
- dataReindex.setDisplayName("Reindex Data Tables Nightly");
+ PropertyDefinitionSimple dataReindex = new PropertyDefinitionSimple(Constant.DataReindex, MSG
+ .view_admin_systemSettings_DataReindex_desc(), true, PropertySimpleType.BOOLEAN);
+ dataReindex.setDisplayName(MSG.view_admin_systemSettings_DataReindex_name());
dataReindex.setPropertyGroupDefinition(dataManagerGroup);
dataReindex.setDefaultValue("true");
def.put(dataReindex);
@@ -425,24 +415,21 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
// Automatic Baseline Configuration Properties
PropertyGroupDefinition baselineGroup = new PropertyGroupDefinition("baseline");
- baselineGroup.setDisplayName("Automatic Baseline Configuration Properties");
+ baselineGroup.setDisplayName(MSG.view_admin_systemSettings_group_baseline());
baselineGroup.setDefaultHidden(false);
baselineGroup.setOrder(2);
- PropertyDefinitionSimple baselineFrequency = new PropertyDefinitionSimple(
- Constant.BaselineFrequency,
- "The frequency which the auto-calculation of baselines will be performed. If 0, baseline auto-calculation is disabled. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- baselineFrequency.setDisplayName("Baseline Calculation Frequency");
+ PropertyDefinitionSimple baselineFrequency = new PropertyDefinitionSimple(Constant.BaselineFrequency, MSG
+ .view_admin_systemSettings_BaselineFrequency_desc(), true, PropertySimpleType.INTEGER);
+ baselineFrequency.setDisplayName(MSG.view_admin_systemSettings_BaselineFrequency_name());
baselineFrequency.setPropertyGroupDefinition(baselineGroup);
baselineFrequency.addConstraints(new IntegerRangeConstraint(Long.valueOf(0), null));
baselineFrequency.setDefaultValue("3");
def.put(baselineFrequency);
- PropertyDefinitionSimple baselineDataSet = new PropertyDefinitionSimple(Constant.BaselineDataSet,
- "The amount of past measurement data that is used to determine a baseline. This is specified in days.",
- true, PropertySimpleType.INTEGER);
- baselineDataSet.setDisplayName("Baseline Dataset");
+ PropertyDefinitionSimple baselineDataSet = new PropertyDefinitionSimple(Constant.BaselineDataSet, MSG
+ .view_admin_systemSettings_BaselineDataSet_desc(), true, PropertySimpleType.INTEGER);
+ baselineDataSet.setDisplayName(MSG.view_admin_systemSettings_BaselineDataSet_name());
baselineDataSet.setPropertyGroupDefinition(baselineGroup);
baselineDataSet.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), Long.valueOf(14))); // can't do more than 14 days since our raw tables don't hold more
baselineDataSet.setDefaultValue("7");
@@ -452,90 +439,76 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
// LDAP Configuration Properties
PropertyGroupDefinition ldapGroup = new PropertyGroupDefinition("ldap");
- ldapGroup.setDisplayName("LDAP Configuration Properties");
- ldapGroup.setDefaultHidden(Boolean.parseBoolean(config.getSimpleValue(Constant.JAASProvider, "false"))); // show if LDAP is in use
+ ldapGroup.setDisplayName(MSG.view_admin_systemSettings_group_ldap());
+ ldapGroup.setDefaultHidden(!Boolean.parseBoolean(config.getSimpleValue(Constant.JAASProvider, "false"))); // show if LDAP is in use
ldapGroup.setOrder(3);
- PropertyDefinitionSimple jaasProvider = new PropertyDefinitionSimple(Constant.JAASProvider,
- "Should LDAP be used to determine user identity?", true, PropertySimpleType.BOOLEAN);
- jaasProvider.setDisplayName("Enable LDAP");
+ PropertyDefinitionSimple jaasProvider = new PropertyDefinitionSimple(Constant.JAASProvider, MSG
+ .view_admin_systemSettings_JAASProvider_desc(), true, PropertySimpleType.BOOLEAN);
+ jaasProvider.setDisplayName(MSG.view_admin_systemSettings_JAASProvider_name());
jaasProvider.setPropertyGroupDefinition(ldapGroup);
jaasProvider.setDefaultValue("false");
def.put(jaasProvider);
- PropertyDefinitionSimple ldapUrl = new PropertyDefinitionSimple(Constant.LDAPUrl, "URL to the LDAP server",
- true, PropertySimpleType.STRING);
- ldapUrl.setDisplayName("LDAP URL");
+ PropertyDefinitionSimple ldapUrl = new PropertyDefinitionSimple(Constant.LDAPUrl, MSG
+ .view_admin_systemSettings_LDAPUrl_desc(), true, PropertySimpleType.STRING);
+ ldapUrl.setDisplayName(MSG.view_admin_systemSettings_LDAPUrl_name());
ldapUrl.setPropertyGroupDefinition(ldapGroup);
ldapUrl.setDefaultValue("ldap://localhost");
def.put(ldapUrl);
- PropertyDefinitionSimple ldapProtocol = new PropertyDefinitionSimple(Constant.LDAPProtocol,
- "Should communication with the LDAP server be done over SSL", true, PropertySimpleType.BOOLEAN);
- ldapProtocol.setDisplayName("SSL");
+ PropertyDefinitionSimple ldapProtocol = new PropertyDefinitionSimple(Constant.LDAPProtocol, MSG
+ .view_admin_systemSettings_LDAPProtocol_desc(), true, PropertySimpleType.BOOLEAN);
+ ldapProtocol.setDisplayName(MSG.view_admin_systemSettings_LDAPProtocol_name());
ldapProtocol.setPropertyGroupDefinition(ldapGroup);
ldapProtocol.setDefaultValue("false");
def.put(ldapProtocol);
- PropertyDefinitionSimple ldapLoginProperty = new PropertyDefinitionSimple(
- Constant.LDAPLoginProperty,
- "The LDAP property that contains the user name. Defaults to cn. If multiple matches are found, the first entry found is used.",
- false, PropertySimpleType.STRING);
- ldapLoginProperty.setDisplayName("Login Property");
+ PropertyDefinitionSimple ldapLoginProperty = new PropertyDefinitionSimple(Constant.LDAPLoginProperty, MSG
+ .view_admin_systemSettings_LDAPLoginProperty_desc(), false, PropertySimpleType.STRING);
+ ldapLoginProperty.setDisplayName(MSG.view_admin_systemSettings_LDAPLoginProperty_name());
ldapLoginProperty.setPropertyGroupDefinition(ldapGroup);
ldapLoginProperty.setDefaultValue("cn");
def.put(ldapLoginProperty);
- PropertyDefinitionSimple ldapFilter = new PropertyDefinitionSimple(
- Constant.LDAPFilter,
- "Any additional filters to apply when doing the LDAP search. This is useful if the population to authenticate can be identified via a given LDAP property, e.g. RHQUser=true",
- false, PropertySimpleType.STRING);
- ldapFilter.setDisplayName("Search Filter");
+ PropertyDefinitionSimple ldapFilter = new PropertyDefinitionSimple(Constant.LDAPFilter, MSG
+ .view_admin_systemSettings_LDAPFilter_desc(), false, PropertySimpleType.STRING);
+ ldapFilter.setDisplayName(MSG.view_admin_systemSettings_LDAPFilter_name());
ldapFilter.setPropertyGroupDefinition(ldapGroup);
ldapFilter.setDefaultValue("");
def.put(ldapFilter);
- PropertyDefinitionSimple ldapGroupFilter = new PropertyDefinitionSimple(
- Constant.LDAPGroupFilter,
- "LDAP search filter that must return all LDAP groups available for authorization. This is used for LDAP group authorization.",
- false, PropertySimpleType.STRING);
- ldapGroupFilter.setDisplayName("Group Search Filter");
+ PropertyDefinitionSimple ldapGroupFilter = new PropertyDefinitionSimple(Constant.LDAPGroupFilter, MSG
+ .view_admin_systemSettings_LDAPGroupFilter_desc(), false, PropertySimpleType.STRING);
+ ldapGroupFilter.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupFilter_name());
ldapGroupFilter.setPropertyGroupDefinition(ldapGroup);
ldapGroupFilter.setDefaultValue("rhqadmin");
def.put(ldapGroupFilter);
- PropertyDefinitionSimple ldapGroupMember = new PropertyDefinitionSimple(
- Constant.LDAPGroupMember,
- "LDAP search filter that is used in conjunction with the group search filter to determine user authorization. This is used for LDAP group authorization.",
- false, PropertySimpleType.STRING);
- ldapGroupMember.setDisplayName("Group Member Filter");
+ PropertyDefinitionSimple ldapGroupMember = new PropertyDefinitionSimple(Constant.LDAPGroupMember, MSG
+ .view_admin_systemSettings_LDAPGroupMember_desc(), false, PropertySimpleType.STRING);
+ ldapGroupMember.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupMember_name());
ldapGroupMember.setPropertyGroupDefinition(ldapGroup);
ldapGroupMember.setDefaultValue("");
def.put(ldapGroupMember);
- PropertyDefinitionSimple ldapBaseDN = new PropertyDefinitionSimple(
- Constant.LDAPBaseDN,
- "The base of the directory tree to search for usernames and passwords while authenticating users, e.g. ou=People,dc=jboss,dc=com",
- false, PropertySimpleType.STRING);
- ldapBaseDN.setDisplayName("Search Base");
+ PropertyDefinitionSimple ldapBaseDN = new PropertyDefinitionSimple(Constant.LDAPBaseDN, MSG
+ .view_admin_systemSettings_LDAPBaseDN_desc(), false, PropertySimpleType.STRING);
+ ldapBaseDN.setDisplayName(MSG.view_admin_systemSettings_LDAPBaseDN_name());
ldapBaseDN.setPropertyGroupDefinition(ldapGroup);
ldapBaseDN.setDefaultValue("o=RedHat,c=US");
def.put(ldapBaseDN);
- PropertyDefinitionSimple ldapBindDN = new PropertyDefinitionSimple(
- Constant.LDAPBindDN,
- "The username to connect to the LDAP server when querying the LDAP server's user database. This is typically the full LDAP distinguished name (DN) of a manager user, e.g. cn=Manager,dc=jboss,dc=com.",
- false, PropertySimpleType.STRING);
- ldapBindDN.setDisplayName("Username");
+ PropertyDefinitionSimple ldapBindDN = new PropertyDefinitionSimple(Constant.LDAPBindDN, MSG
+ .view_admin_systemSettings_LDAPBindDN_desc(), false, PropertySimpleType.STRING);
+ ldapBindDN.setDisplayName(MSG.view_admin_systemSettings_LDAPBindDN_name());
ldapBindDN.setPropertyGroupDefinition(ldapGroup);
ldapBindDN.setDefaultValue("");
def.put(ldapBindDN);
- PropertyDefinitionSimple ldapBindPW = new PropertyDefinitionSimple(
- Constant.LDAPBindPW,
- "The credentials of the user used to connect to the LDAP server when querying the LDAP server's user database.",
- false, PropertySimpleType.PASSWORD);
- ldapBindPW.setDisplayName("Password");
+ PropertyDefinitionSimple ldapBindPW = new PropertyDefinitionSimple(Constant.LDAPBindPW, MSG
+ .view_admin_systemSettings_LDAPBindPW_desc(), false, PropertySimpleType.PASSWORD);
+ ldapBindPW.setDisplayName(MSG.view_admin_systemSettings_LDAPBindPW_name());
ldapBindPW.setPropertyGroupDefinition(ldapGroup);
ldapBindPW.setDefaultValue("");
def.put(ldapBindPW);
@@ -549,23 +522,30 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
form.setWidth100();
form.setExtraSpace(15);
form.setIsGroup(true);
- form.setGroupTitle("Server Details");
-
- final StaticTextItem productName = new StaticTextItem("productname", "Name");
- final StaticTextItem productVersion = new StaticTextItem("productversion", "Version");
- final StaticTextItem productBuildNumber = new StaticTextItem("productbuild", "Build Number");
-
- final StaticTextItem serverTimezone = new StaticTextItem("timezone", "Server Time Zone");
- final StaticTextItem serverTime = new StaticTextItem("localtime", "Server Local Time");
- final StaticTextItem dbUrl = new StaticTextItem("dbUrl", "Database Connection URL");
- final StaticTextItem dbProductName = new StaticTextItem("dbProductName", "Database Product Name");
- final StaticTextItem dbProductVersion = new StaticTextItem("dbProductVersion", "Database Product Version");
- final StaticTextItem dbDriverName = new StaticTextItem("dbDriverName", "Database Driver Name");
- final StaticTextItem dbDriverVersion = new StaticTextItem("dbDriverVersion", "Database Driver Version");
- final StaticTextItem currentMeasRawTable = new StaticTextItem("currentMeasRawTable",
- "Current Measurement Raw Table");
- final StaticTextItem nextMeasTableRotation = new StaticTextItem("nextMeasTableRotation",
- "Next Measurement Table Rotation");
+ form.setGroupTitle(MSG.view_admin_systemSettings_serverDetails());
+
+ final StaticTextItem productName = new StaticTextItem("productname", MSG.common_title_name());
+ final StaticTextItem productVersion = new StaticTextItem("productversion", MSG.common_title_version());
+ final StaticTextItem productBuildNumber = new StaticTextItem("productbuild", MSG
+ .view_admin_systemSettings_serverDetails_buildNumber());
+
+ final StaticTextItem serverTimezone = new StaticTextItem("timezone", MSG
+ .view_admin_systemSettings_serverDetails_tz());
+ final StaticTextItem serverTime = new StaticTextItem("localtime", MSG
+ .view_admin_systemSettings_serverDetails_time());
+ final StaticTextItem dbUrl = new StaticTextItem("dbUrl", MSG.view_admin_systemSettings_serverDetails_dbUrl());
+ final StaticTextItem dbProductName = new StaticTextItem("dbProductName", MSG
+ .view_admin_systemSettings_serverDetails_dbName());
+ final StaticTextItem dbProductVersion = new StaticTextItem("dbProductVersion", MSG
+ .view_admin_systemSettings_serverDetails_dbVersion());
+ final StaticTextItem dbDriverName = new StaticTextItem("dbDriverName", MSG
+ .view_admin_systemSettings_serverDetails_dbDriverName());
+ final StaticTextItem dbDriverVersion = new StaticTextItem("dbDriverVersion", MSG
+ .view_admin_systemSettings_serverDetails_dbDriverVersion());
+ final StaticTextItem currentMeasRawTable = new StaticTextItem("currentMeasRawTable", MSG
+ .view_admin_systemSettings_serverDetails_currentTable());
+ final StaticTextItem nextMeasTableRotation = new StaticTextItem("nextMeasTableRotation", MSG
+ .view_admin_systemSettings_serverDetails_nextRotation());
productName.setWrapTitle(false);
productVersion.setWrapTitle(false);
@@ -606,7 +586,7 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
@Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Cannot get server details", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_admin_systemSettings_cannotLoadServerDetails(), caught);
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 258eb98..539fa4c 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -637,6 +637,78 @@ view_remoteAgentInstall_stopAgentResults = Agent stop results: [{0}]
view_remoteAgentInstall_success = Agent installation complete
view_remoteAgentInstall_updateStatus = Update Status
+# Administration/SystemSettings
+#------------------------------
+view_admin_systemSettings_cannotLoadSettings = Cannot obtain the current system settings
+view_admin_systemSettings_savedSettings = You successfully saved the system properties
+view_admin_systemSettings_saveFailure = Failed to save the system settings
+view_admin_systemSettings_fixBeforeSaving = Please fix the invalid values before saving
+view_admin_systemSettings_systemSettings = System Settings
+view_admin_systemSettings_group_general = General Configuration Properties
+view_admin_systemSettings_group_dataMgr = Data Manager Configuration Properties
+view_admin_systemSettings_group_baseline = Automatic Baseline Configuration Properties
+view_admin_systemSettings_group_ldap = LDAP Configuration Properties
+view_admin_systemSettings_cannotLoadServerDetails = Cannot load server details
+view_admin_systemSettings_serverDetails = Server Details
+view_admin_systemSettings_serverDetails_buildNumber = Build Number
+view_admin_systemSettings_serverDetails_tz = Server Time Zone
+view_admin_systemSettings_serverDetails_time = Server Local Time
+view_admin_systemSettings_serverDetails_dbUrl = Database Connection URL
+view_admin_systemSettings_serverDetails_dbName = Database Product Name
+view_admin_systemSettings_serverDetails_dbVersion = Database Product Version
+view_admin_systemSettings_serverDetails_dbDriverName = Database Driver Name
+view_admin_systemSettings_serverDetails_dbDriverVersion = Database Driver Version
+view_admin_systemSettings_serverDetails_currentTable = Current Measurement Raw Table
+view_admin_systemSettings_serverDetails_nextRotation = Next Measurement Table Rotation
+view_admin_systemSettings_BaseURL_name = GUI Console URL
+view_admin_systemSettings_BaseURL_desc = A URL to the server GUI, used mainly within alert email notifications.
+view_admin_systemSettings_AgentMaxQuietTimeAllowed_name = Agent Max Quiet Time Allowed
+view_admin_systemSettings_AgentMaxQuietTimeAllowed_desc = If this amount of time passes without hearing from an agent, that quiet agent will be considered down. This value is specified in minutes.
+view_admin_systemSettings_EnableAgentAutoUpdate_name = Enable Agent Auto-Updates
+view_admin_systemSettings_EnableAgentAutoUpdate_desc = Determines if the server will allow agents to auto-update themselves. You will not be able to download agent distributions from the server if this is disabled.
+view_admin_systemSettings_EnableDebugMode_name = Enable Debug Mode
+view_admin_systemSettings_EnableDebugMode_desc = If enabled, the server will enter debug mode.
+view_admin_systemSettings_EnableExperimentalFeatures_name = Enable Experimental Features
+view_admin_systemSettings_EnableExperimentalFeatures_desc = If enabled, any experimental features that exist in the current product will be available.
+view_admin_systemSettings_DataMaintenance_name = Database Maintenance Period
+view_admin_systemSettings_DataMaintenance_desc = How often database maintenance is performed (for example, vacuuming if using Postgres). This is specified in hours.
+view_admin_systemSettings_AvailabilityPurge_name = Delete Availability Data Older Than
+view_admin_systemSettings_AvailabilityPurge_desc = How old availability data must be before being purged from the database. This is specified in days.
+view_admin_systemSettings_AlertPurge_name = Delete Alerts Older Than
+view_admin_systemSettings_AlertPurge_desc = How old alert history items must be before being purged from the database. This is specified in days.
+view_admin_systemSettings_TraitPurge_name = Delete Measurement Traits Older Than
+view_admin_systemSettings_TraitPurge_desc = How old measurement trait data must be before being purged from the database. This is specified in days.
+view_admin_systemSettings_RtDataPurge_name = Delete Response Time Data Older Than
+view_admin_systemSettings_RtDataPurge_desc = How old response time data must be before being purged from the database. This is specified in days.
+view_admin_systemSettings_EventPurge_name = Delete Events Older Than
+view_admin_systemSettings_EventPurge_desc = How old event data must be before being purged from the database. This is specified in days.
+view_admin_systemSettings_DataReindex_name = Reindex Data Tables Nightly
+view_admin_systemSettings_DataReindex_desc = If enabled, certain database tables will be re-indexed periodically.
+view_admin_systemSettings_BaselineFrequency_name = Baseline Calculation Frequency
+view_admin_systemSettings_BaselineFrequency_desc = The frequency which the auto-calculation of baselines will be performed. If 0, baseline auto-calculation is disabled. This is specified in days.
+view_admin_systemSettings_BaselineDataSet_name = Baseline Dataset
+view_admin_systemSettings_BaselineDataSet_desc = The amount of past measurement data that is used to determine a baseline. This is specified in days.
+view_admin_systemSettings_JAASProvider_name = Enable LDAP
+view_admin_systemSettings_JAASProvider_desc = Should LDAP be used to determine user identity?
+view_admin_systemSettings_LDAPUrl_name = LDAP URL
+view_admin_systemSettings_LDAPUrl_desc = URL to the LDAP Server
+view_admin_systemSettings_LDAPProtocol_name = SSL
+view_admin_systemSettings_LDAPProtocol_desc = Should communication with the LDAP server be done over SSL?
+view_admin_systemSettings_LDAPLoginProperty_name = Login Property
+view_admin_systemSettings_LDAPLoginProperty_desc = The LDAP property that contains the user name. Defaults to "cn". If multiple matches are found, the first entry found is used.
+view_admin_systemSettings_LDAPFilter_name = Search Filter
+view_admin_systemSettings_LDAPFilter_desc = Any additional filters to apply when doing the LDAP search. This is useful if the population to authenticate can be identified via a given LDAP property, e.g. RHQUser=true
+view_admin_systemSettings_LDAPGroupFilter_name = Group Search Filter
+view_admin_systemSettings_LDAPGroupFilter_desc = LDAP search filter that must return all LDAP groups available for authorization. This is used for LDAP group authorization.
+view_admin_systemSettings_LDAPGroupMember_name = Group Member Filter
+view_admin_systemSettings_LDAPGroupMember_desc = LDAP search filter that is used in conjunction with the group search filter to determine user authorization. This is used for LDAP group authorization.
+view_admin_systemSettings_LDAPBaseDN_name = Search Base
+view_admin_systemSettings_LDAPBaseDN_desc = The base of the directory tree to search for usernames and passwords while authenticating users, e.g. ou=People,dc=redhat,dc=com
+view_admin_systemSettings_LDAPBindDN_name = Username
+view_admin_systemSettings_LDAPBindDN_desc = The username to connect to the LDAP server when querying the LDAP user database. This is typically the full LDAP distinguished name (DN) of a manager user, e.g. cn=Manager,dc=redhat,dc=com
+view_admin_systemSettings_LDAPBindPW_name = Password
+view_admin_systemSettings_LDAPBindPW_desc = The credentials of the user used to connect to the LDAP server when querying the LDAP user database.
+
#==================== Alerts ======================
view_alerts_table_title_group = Group Alert History
view_alerts_table_title_resource = Resource Alert History
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java | 38 ++++++++--
1 file changed, 34 insertions(+), 4 deletions(-)
New commits:
commit bec7a6e48d4af51cea64c215d896339ca8346432
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 10 08:45:32 2011 -0500
make sure we set valid values when rendering
have the ldap settings group already expanded if LDAP is enabled
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
index 561904f..3684193 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
@@ -144,13 +144,30 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
|| Constant.EventPurge.equals(name) || Constant.BaselineFrequency.equals(name)
|| Constant.BaselineDataSet.equals(name)) {
value = convertMillisToDays(value);
+ } else if (Constant.EnableAgentAutoUpdate.equals(name)) {
+ if (value.trim().length() == 0) {
+ value = "false"; // if, for some reason, this value was empty, use false - let the user explicitly enable it
+ }
+ } else if (Constant.EnableDebugMode.equals(name)) {
+ if (value.trim().length() == 0) {
+ value = "false";
+ }
+ } else if (Constant.EnableExperimentalFeatures.equals(name)) {
+ if (value.trim().length() == 0) {
+ value = "false";
+ }
+ } else if (Constant.DataReindex.equals(name)) {
+ if (value.trim().length() == 0) {
+ value = "true";
+ }
}
PropertySimple prop = new PropertySimple(name, value);
config.put(prop);
}
- editor = new ConfigurationEditor(extendLocatorId("configEditor"), getSystemSettingsDefinition(), config);
+ editor = new ConfigurationEditor(extendLocatorId("configEditor"), getSystemSettingsDefinition(config),
+ config);
editor.addPropertyValueChangeListener(SystemSettingsView.this);
canvas.addMember(editor);
@@ -274,12 +291,19 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
/**
* This returns the metadata describing the system settings.
*
+ * @param config the current configuration settings from the server. Some values will
+ * be converted to the types the definition will expect - for example,
+ * the JAAS setting will not be "LDAP" or "JDBC" as the server would know it,
+ * rather the value will be "true" or "false" (i.e. is ldap enabled or not?)
+ *
* @return system settings config def
*/
- private ConfigurationDefinition getSystemSettingsDefinition() {
+ private ConfigurationDefinition getSystemSettingsDefinition(Configuration config) {
ConfigurationDefinition def = new ConfigurationDefinition("sysset", "System settings");
+ ///////////////////////////////////
// General Configuration Properties
+
PropertyGroupDefinition generalGroup = new PropertyGroupDefinition("general");
generalGroup.setDisplayName("General Configuration Properties");
generalGroup.setDefaultHidden(false);
@@ -327,7 +351,9 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
enableExperimentalFeatures.setDefaultValue("false");
def.put(enableExperimentalFeatures);
- // Data Manager Configuration Properties
+ ////////////////////////////////////////
+ // Data Manager Configuration Properties
+
PropertyGroupDefinition dataManagerGroup = new PropertyGroupDefinition("datamanager");
dataManagerGroup.setDisplayName("Data Manager Configuration Properties");
dataManagerGroup.setDefaultHidden(false);
@@ -395,7 +421,9 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
dataReindex.setDefaultValue("true");
def.put(dataReindex);
+ //////////////////////////////////////////////
// Automatic Baseline Configuration Properties
+
PropertyGroupDefinition baselineGroup = new PropertyGroupDefinition("baseline");
baselineGroup.setDisplayName("Automatic Baseline Configuration Properties");
baselineGroup.setDefaultHidden(false);
@@ -420,10 +448,12 @@ public class SystemSettingsView extends LocatableVLayout implements PropertyValu
baselineDataSet.setDefaultValue("7");
def.put(baselineDataSet);
+ ////////////////////////////////
// LDAP Configuration Properties
+
PropertyGroupDefinition ldapGroup = new PropertyGroupDefinition("ldap");
ldapGroup.setDisplayName("LDAP Configuration Properties");
- ldapGroup.setDefaultHidden(true);
+ ldapGroup.setDefaultHidden(Boolean.parseBoolean(config.getSimpleValue(Constant.JAASProvider, "false"))); // show if LDAP is in use
ldapGroup.setOrder(3);
PropertyDefinitionSimple jaasProvider = new PropertyDefinitionSimple(Constant.JAASProvider,
13 years, 3 months
[rhq] 2 commits - modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java | 78 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java | 585 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/LdapGWTServiceImpl.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java | 61 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigAction.java | 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigPrepAction.java | 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/role/AddLdapGroupsFormPrepareAction.java | 17
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java | 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/AuthenticateUserAction.java | 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/framework/ServerInfoUIBean.java | 7
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/ConfigTag.java | 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/ContextUtils.java | 3
modules/enterprise/gui/portal-war/src/main/webapp/admin/config/SystemInfoForm.jsp | 27
modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/RHQConstants.java | 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 32
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementCompressionManagerBean.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementDataManagerUtility.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJob.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 53
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java | 26
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java | 38
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemDatabaseInformation.java | 135 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemInformation.java | 114 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 17
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java | 3
35 files changed, 1072 insertions(+), 248 deletions(-)
New commits:
commit f9fa2e8a1cd0c90801740e2966d5d2d636801ce9
Merge: 38d2349... 8b6f271...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 9 22:19:37 2011 -0500
Merge branch 'sysconfig'
commit 8b6f2711e3cf32e42bcf984617de51e67cceed8c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 9 22:18:25 2011 -0500
convert the JSF system settings page to GWT - Admin>SystemSettings
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java
new file mode 100644
index 0000000..8f10652
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/ServerDetails.java
@@ -0,0 +1,78 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser 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.
+ */
+
+package org.rhq.core.domain.common;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+/**
+ * Provides simple strings to describe certain server details, useful for end users that have a need to see
+ * this data. This is meant to be used as a read-only pojo to be shared to clients.
+ *
+ * Some of the fields in this pojo may be empty if the user didn't have permissions to see those fields.
+ *
+ * @author John Mazzitelli
+ */
+public class ServerDetails implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public enum Detail {
+ DATABASE_CONNECTION_URL, //
+ DATABASE_PRODUCT_NAME, //
+ DATABASE_PRODUCT_VERSION, //
+ DATABASE_DRIVER_NAME, //
+ DATABASE_DRIVER_VERSION, //
+ SERVER_TIMEZONE, //
+ SERVER_LOCAL_TIME, //
+ CURRENT_MEASUREMENT_TABLE, //
+ NEXT_MEASUREMENT_TABLE_ROTATION;
+ };
+
+ private HashMap<Detail, String> details = new HashMap<Detail, String>(Detail.values().length);
+ private ProductInfo productInfo;
+
+ /**
+ * @return information about the product itself (like its version).
+ */
+ public ProductInfo getProductInfo() {
+ return this.productInfo;
+ }
+
+ public void setProductInfo(ProductInfo info) {
+ this.productInfo = info;
+ }
+
+ /**
+ * Returns details about the server that returned this object. The keys are one of the
+ * {@link Detail} enums. You are not guaranteed to have all details in the returned map;
+ * if the user doesn't have the permissions necessary, some details will not be available.
+ */
+ public HashMap<Detail, String> getDetails() {
+ return this.details;
+ }
+
+ public void setDetails(HashMap<Detail, String> details) {
+ this.details = details;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index f0ef562..b8e0dbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -252,7 +252,7 @@ public class LinkManager {
public static String getAdminSysConfigLink() {
if (GWT) {
- return "#Administration/Configuration/System Settings";
+ return "#Administration/Configuration/SystemSettings";
} else {
return "/admin/config/Config.do?mode=edit";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 57bcb1c..dbb23d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -177,10 +177,10 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
NavigationItem systemSettingsItem = new NavigationItem(PAGE_SYSTEM_SETTINGS_VIEW_ID,
"subsystems/configure/Configure_16.png", new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID.getName()),
- "/admin/config/Config.do?mode=edit&nomenu=true");
+ return new SystemSettingsView(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID.getName()));
}
});
+ systemSettingsItem.setRefreshRequired(true); // refresh so it always reloads the latest settings
NavigationItem templatesItem = new NavigationItem(PAGE_TEMPLATES_VIEW_ID, ImageManager.getMetricEditIcon(),
new ViewFactory() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
new file mode 100644
index 0000000..561904f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/SystemSettingsView.java
@@ -0,0 +1,585 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.admin;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
+import org.rhq.core.domain.common.ServerDetails.Detail;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertyGroupDefinition;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A simple form to view and edit the server system settings.
+ *
+ * @author John Mazzitelli
+ */
+public class SystemSettingsView extends LocatableVLayout implements PropertyValueChangeListener {
+
+ private LocatableVLayout canvas;
+ private ConfigurationEditor editor;
+ private IButton saveButton;
+
+ private interface Constant {
+ // note: all these names of simple properties must match those in the server's RHQConstants
+ String BaseURL = "CAM_BASE_URL";
+ String AgentMaxQuietTimeAllowed = "AGENT_MAX_QUIET_TIME_ALLOWED";
+ String EnableAgentAutoUpdate = "ENABLE_AGENT_AUTO_UPDATE";
+ String EnableDebugMode = "ENABLE_DEBUG_MODE";
+ String EnableExperimentalFeatures = "ENABLE_EXPERIMENTAL_FEATURES";
+ String DataMaintenance = "CAM_DATA_MAINTENANCE";
+ String AvailabilityPurge = "AVAILABILITY_PURGE";
+ String AlertPurge = "ALERT_PURGE";
+ String TraitPurge = "TRAIT_PURGE";
+ String RtDataPurge = "RT_DATA_PURGE";
+ String EventPurge = "EVENT_PURGE";
+ String DataReindex = "DATA_REINDEX_NIGHTLY";
+ String BaselineFrequency = "CAM_BASELINE_FREQUENCY";
+ String BaselineDataSet = "CAM_BASELINE_DATASET";
+
+ String JAASProvider = "CAM_JAAS_PROVIDER"; // value must be one of JDBCJAASProvider or LDAPJAASProvider
+ String JDBCJAASProvider = "JDBC"; // this isn't really a property name, its a value for the JAASProvider property
+ String LDAPJAASProvider = "LDAP"; // this isn't really a property name, its a value for the JAASProvider property
+ String LDAPUrl = "CAM_LDAP_NAMING_PROVIDER_URL";
+ String LDAPProtocol = "CAM_LDAP_PROTOCOL"; // must be either "ssl" or empty string ("")
+ String LDAPLoginProperty = "CAM_LDAP_LOGIN_PROPERTY";
+ String LDAPFilter = "CAM_LDAP_FILTER";
+ String LDAPGroupFilter = "CAM_LDAP_GROUP_FILTER";
+ String LDAPGroupMember = "CAM_LDAP_GROUP_MEMBER";
+ String LDAPBaseDN = "CAM_LDAP_BASE_DN";
+ String LDAPBindDN = "CAM_LDAP_BIND_DN";
+ String LDAPBindPW = "CAM_LDAP_BIND_PW";
+ }
+
+ public SystemSettingsView(String locatorId) {
+ super(locatorId);
+ setHeight100();
+ setWidth100();
+
+ TitleBar titleBar = new TitleBar(this, "System Settings", "subsystems/configure/Configure_24.png");
+ addMember(titleBar);
+
+ canvas = new LocatableVLayout("innerLayout");
+ canvas.setHeight100();
+ canvas.setWidth100();
+ canvas.setMargin(15);
+ addMember(canvas);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ GWTServiceLookup.getSystemService().getSystemConfiguration(new AsyncCallback<HashMap<String, String>>() {
+ @Override
+ public void onSuccess(HashMap<String, String> result) {
+
+ canvas.addMember(getServerDetails());
+
+ Configuration config = new Configuration();
+ for (Map.Entry<String, String> entry : result.entrySet()) {
+ String name = entry.getKey();
+ String value = (entry.getValue() == null) ? "" : entry.getValue();
+
+ // some of our properties are actually different values on the server than how they are to be
+ // visualized in the UI.
+ // -- JAASProvider is a boolean in the UI but is "LDAP" if it was true and "JDBC" if it was false
+ // -- LDAPProtocol is a boolean in the UI but is "ssl" if true and "" if it was false
+ // -- some other numerical values need to be converted from milliseconds
+ if (Constant.JAASProvider.equals(name)) {
+ value = Boolean.toString(value.equals(Constant.LDAPJAASProvider));
+ } else if (Constant.LDAPProtocol.equals(name)) {
+ value = Boolean.toString(value.equalsIgnoreCase("ssl"));
+ } else if (Constant.AgentMaxQuietTimeAllowed.equals(name)) {
+ value = convertMillisToMinutes(value);
+ } else if (Constant.DataMaintenance.equals(name)) {
+ value = convertMillisToHours(value);
+ } else if (Constant.AvailabilityPurge.equals(name) || Constant.AlertPurge.equals(name)
+ || Constant.TraitPurge.equals(name) || Constant.RtDataPurge.equals(name)
+ || Constant.EventPurge.equals(name) || Constant.BaselineFrequency.equals(name)
+ || Constant.BaselineDataSet.equals(name)) {
+ value = convertMillisToDays(value);
+ }
+
+ PropertySimple prop = new PropertySimple(name, value);
+ config.put(prop);
+ }
+
+ editor = new ConfigurationEditor(extendLocatorId("configEditor"), getSystemSettingsDefinition(), config);
+ editor.addPropertyValueChangeListener(SystemSettingsView.this);
+ canvas.addMember(editor);
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+ toolStrip.setMembersMargin(5);
+ toolStrip.setLayoutMargin(5);
+
+ saveButton = new LocatableIButton(extendLocatorId("Save"), MSG.common_button_save());
+ saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+ toolStrip.addMember(saveButton);
+
+ canvas.addMember(toolStrip);
+ }
+
+ @Override
+ public void onFailure(Throwable t) {
+ CoreGUI.getErrorHandler().handleError("Cannot obtain the current system settings", t);
+ }
+ });
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ if (event.isValidationStateChanged()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
+ this.saveButton.enable();
+ } else {
+ this.saveButton.disable();
+ }
+ }
+ }
+
+ private void save() {
+ if (editor.validate()) {
+ Map<String, PropertySimple> simpleProperties = editor.getConfiguration().getSimpleProperties();
+ HashMap<String, String> props = new HashMap<String, String>();
+ for (PropertySimple simple : simpleProperties.values()) {
+ String value = (simple.getStringValue() != null) ? simple.getStringValue() : "";
+
+ // some of our properties actually need different values on the server than how they were
+ // visualized in the UI.
+ // -- JAASProvider is a boolean in the UI but must be "LDAP" if it was true and "JDBC" if it was false
+ // -- LDAPProtocol is a boolean in the UI but must be "ssl" if true and "" if it was false
+ // -- some other numerical values need to be converted to milliseconds
+ if (Constant.JAASProvider.equals(simple.getName())) {
+ if (Boolean.parseBoolean(value)) {
+ value = Constant.LDAPJAASProvider;
+ } else {
+ value = Constant.JDBCJAASProvider;
+ }
+ } else if (Constant.LDAPProtocol.equals(simple.getName())) {
+ if (Boolean.parseBoolean(value)) {
+ value = "ssl";
+ } else {
+ value = "";
+ }
+ } else if (Constant.AgentMaxQuietTimeAllowed.equals(simple.getName())) {
+ value = convertMinutesToMillis(value);
+ } else if (Constant.DataMaintenance.equals(simple.getName())) {
+ value = convertHoursToMillis(value);
+ } else if (Constant.AvailabilityPurge.equals(simple.getName())
+ || Constant.AlertPurge.equals(simple.getName()) || Constant.TraitPurge.equals(simple.getName())
+ || Constant.RtDataPurge.equals(simple.getName()) || Constant.EventPurge.equals(simple.getName())
+ || Constant.BaselineFrequency.equals(simple.getName())
+ || Constant.BaselineDataSet.equals(simple.getName())) {
+ value = convertDaysToMillis(value);
+ }
+
+ props.put(simple.getName(), value);
+ }
+
+ GWTServiceLookup.getSystemService().setSystemConfiguration(props, false, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("You successfully saved the system properties", Message.Severity.Info));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to save the system settings", caught);
+ }
+ });
+ } else {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Please fix the invalid values before saving", Severity.Warning, EnumSet
+ .of(Message.Option.Transient)));
+ }
+ }
+
+ private String convertMinutesToMillis(String num) {
+ return String.valueOf(Long.parseLong(num) * 60 * 1000);
+ }
+
+ private String convertHoursToMillis(String num) {
+ return String.valueOf(Long.parseLong(num) * 60 * 60 * 1000);
+ }
+
+ private String convertDaysToMillis(String num) {
+ return String.valueOf(Long.parseLong(num) * 24 * 60 * 60 * 1000);
+ }
+
+ private String convertMillisToMinutes(String num) {
+ return String.valueOf(Long.parseLong(num) / (60 * 1000));
+ }
+
+ private String convertMillisToHours(String num) {
+ return String.valueOf(Long.parseLong(num) / (60 * 60 * 1000));
+ }
+
+ private String convertMillisToDays(String num) {
+ return String.valueOf(Long.parseLong(num) / (24 * 60 * 60 * 1000));
+ }
+
+ /**
+ * This returns the metadata describing the system settings.
+ *
+ * @return system settings config def
+ */
+ private ConfigurationDefinition getSystemSettingsDefinition() {
+ ConfigurationDefinition def = new ConfigurationDefinition("sysset", "System settings");
+
+ // General Configuration Properties
+ PropertyGroupDefinition generalGroup = new PropertyGroupDefinition("general");
+ generalGroup.setDisplayName("General Configuration Properties");
+ generalGroup.setDefaultHidden(false);
+ generalGroup.setOrder(0);
+
+ PropertyDefinitionSimple baseUrl = new PropertyDefinitionSimple(Constant.BaseURL,
+ "A URL to the server GUI, used mainly within alert email notification", true, PropertySimpleType.STRING);
+ baseUrl.setDisplayName("GUI Console URL");
+ baseUrl.setPropertyGroupDefinition(generalGroup);
+ baseUrl.setDefaultValue("http://localhost:7080");
+ def.put(baseUrl);
+
+ PropertyDefinitionSimple agentMaxQuietTimeAllowed = new PropertyDefinitionSimple(
+ Constant.AgentMaxQuietTimeAllowed,
+ "If this amount of time passes without hearing from an agent, that quiet agent will be considered down. This value is specified in minutes.",
+ true, PropertySimpleType.INTEGER);
+ agentMaxQuietTimeAllowed.setDisplayName("Agent Max Quiet Time Allowed");
+ agentMaxQuietTimeAllowed.setPropertyGroupDefinition(generalGroup);
+ agentMaxQuietTimeAllowed.addConstraints(new IntegerRangeConstraint(Long.valueOf(2), null)); // don't allow less than 2m since it will cause too many false backfills
+ agentMaxQuietTimeAllowed.setDefaultValue("15");
+ def.put(agentMaxQuietTimeAllowed);
+
+ PropertyDefinitionSimple enableAgentAutoUpdate = new PropertyDefinitionSimple(
+ Constant.EnableAgentAutoUpdate,
+ "Determines if the server will allow agents to auto-update themselves. You will not be able to download agent distributions from the server if this is disabled.",
+ true, PropertySimpleType.BOOLEAN);
+ enableAgentAutoUpdate.setDisplayName("Enable Agent Auto-Updates");
+ enableAgentAutoUpdate.setPropertyGroupDefinition(generalGroup);
+ enableAgentAutoUpdate.setDefaultValue("true");
+ def.put(enableAgentAutoUpdate);
+
+ PropertyDefinitionSimple enableDebugMode = new PropertyDefinitionSimple(Constant.EnableDebugMode,
+ "If enabled, the server will enter debug mode", true, PropertySimpleType.BOOLEAN);
+ enableDebugMode.setDisplayName("Enable Debug Mode");
+ enableDebugMode.setPropertyGroupDefinition(generalGroup);
+ enableDebugMode.setDefaultValue("false");
+ def.put(enableDebugMode);
+
+ PropertyDefinitionSimple enableExperimentalFeatures = new PropertyDefinitionSimple(
+ Constant.EnableExperimentalFeatures,
+ "If enabled, any experimental features that exist in the current product will be available.", true,
+ PropertySimpleType.BOOLEAN);
+ enableExperimentalFeatures.setDisplayName("Enable Experimental Features");
+ enableExperimentalFeatures.setPropertyGroupDefinition(generalGroup);
+ enableExperimentalFeatures.setDefaultValue("false");
+ def.put(enableExperimentalFeatures);
+
+ // Data Manager Configuration Properties
+ PropertyGroupDefinition dataManagerGroup = new PropertyGroupDefinition("datamanager");
+ dataManagerGroup.setDisplayName("Data Manager Configuration Properties");
+ dataManagerGroup.setDefaultHidden(false);
+ dataManagerGroup.setOrder(1);
+
+ PropertyDefinitionSimple dataMaintenance = new PropertyDefinitionSimple(
+ Constant.DataMaintenance,
+ "How often database maintenance is performed (for example, vacuuming if using Postgres). This is specified in hours.",
+ true, PropertySimpleType.INTEGER);
+ dataMaintenance.setDisplayName("Database Maintenance Period");
+ dataMaintenance.setPropertyGroupDefinition(dataManagerGroup);
+ dataMaintenance.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ dataMaintenance.setDefaultValue("1");
+ def.put(dataMaintenance);
+
+ PropertyDefinitionSimple availabilityPurge = new PropertyDefinitionSimple(Constant.AvailabilityPurge,
+ "How old availability data must be before being purged from the database. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ availabilityPurge.setDisplayName("Delete Availability Data Older Than");
+ availabilityPurge.setPropertyGroupDefinition(dataManagerGroup);
+ availabilityPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ availabilityPurge.setDefaultValue("365");
+ def.put(availabilityPurge);
+
+ PropertyDefinitionSimple alertPurge = new PropertyDefinitionSimple(Constant.AlertPurge,
+ "How old alert history items must be before being purged from the database. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ alertPurge.setDisplayName("Delete Alerts Older Than");
+ alertPurge.setPropertyGroupDefinition(dataManagerGroup);
+ alertPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ alertPurge.setDefaultValue("31");
+ def.put(alertPurge);
+
+ PropertyDefinitionSimple traitPurge = new PropertyDefinitionSimple(Constant.TraitPurge,
+ "How old measurement trait data must be before being purged from the database. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ traitPurge.setDisplayName("Delete Measurement Traits Older Than");
+ traitPurge.setPropertyGroupDefinition(dataManagerGroup);
+ traitPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ traitPurge.setDefaultValue("365");
+ def.put(traitPurge);
+
+ PropertyDefinitionSimple rtDataPurge = new PropertyDefinitionSimple(Constant.RtDataPurge,
+ "How old response time data must be before being purged from the database. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ rtDataPurge.setDisplayName("Delete Response Time Data Older Than");
+ rtDataPurge.setPropertyGroupDefinition(dataManagerGroup);
+ rtDataPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ rtDataPurge.setDefaultValue("31");
+ def.put(rtDataPurge);
+
+ PropertyDefinitionSimple eventPurge = new PropertyDefinitionSimple(Constant.EventPurge,
+ "How old event data must be before being purged from the database. This is specified in days.", true,
+ PropertySimpleType.INTEGER);
+ eventPurge.setDisplayName("Delete Events Older Than");
+ eventPurge.setPropertyGroupDefinition(dataManagerGroup);
+ eventPurge.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
+ eventPurge.setDefaultValue("14");
+ def.put(eventPurge);
+
+ PropertyDefinitionSimple dataReindex = new PropertyDefinitionSimple(Constant.DataReindex,
+ "If enabled, certain database tables will be re-indexed periodically.", true, PropertySimpleType.BOOLEAN);
+ dataReindex.setDisplayName("Reindex Data Tables Nightly");
+ dataReindex.setPropertyGroupDefinition(dataManagerGroup);
+ dataReindex.setDefaultValue("true");
+ def.put(dataReindex);
+
+ // Automatic Baseline Configuration Properties
+ PropertyGroupDefinition baselineGroup = new PropertyGroupDefinition("baseline");
+ baselineGroup.setDisplayName("Automatic Baseline Configuration Properties");
+ baselineGroup.setDefaultHidden(false);
+ baselineGroup.setOrder(2);
+
+ PropertyDefinitionSimple baselineFrequency = new PropertyDefinitionSimple(
+ Constant.BaselineFrequency,
+ "The frequency which the auto-calculation of baselines will be performed. If 0, baseline auto-calculation is disabled. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ baselineFrequency.setDisplayName("Baseline Calculation Frequency");
+ baselineFrequency.setPropertyGroupDefinition(baselineGroup);
+ baselineFrequency.addConstraints(new IntegerRangeConstraint(Long.valueOf(0), null));
+ baselineFrequency.setDefaultValue("3");
+ def.put(baselineFrequency);
+
+ PropertyDefinitionSimple baselineDataSet = new PropertyDefinitionSimple(Constant.BaselineDataSet,
+ "The amount of past measurement data that is used to determine a baseline. This is specified in days.",
+ true, PropertySimpleType.INTEGER);
+ baselineDataSet.setDisplayName("Baseline Dataset");
+ baselineDataSet.setPropertyGroupDefinition(baselineGroup);
+ baselineDataSet.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), Long.valueOf(14))); // can't do more than 14 days since our raw tables don't hold more
+ baselineDataSet.setDefaultValue("7");
+ def.put(baselineDataSet);
+
+ // LDAP Configuration Properties
+ PropertyGroupDefinition ldapGroup = new PropertyGroupDefinition("ldap");
+ ldapGroup.setDisplayName("LDAP Configuration Properties");
+ ldapGroup.setDefaultHidden(true);
+ ldapGroup.setOrder(3);
+
+ PropertyDefinitionSimple jaasProvider = new PropertyDefinitionSimple(Constant.JAASProvider,
+ "Should LDAP be used to determine user identity?", true, PropertySimpleType.BOOLEAN);
+ jaasProvider.setDisplayName("Enable LDAP");
+ jaasProvider.setPropertyGroupDefinition(ldapGroup);
+ jaasProvider.setDefaultValue("false");
+ def.put(jaasProvider);
+
+ PropertyDefinitionSimple ldapUrl = new PropertyDefinitionSimple(Constant.LDAPUrl, "URL to the LDAP server",
+ true, PropertySimpleType.STRING);
+ ldapUrl.setDisplayName("LDAP URL");
+ ldapUrl.setPropertyGroupDefinition(ldapGroup);
+ ldapUrl.setDefaultValue("ldap://localhost");
+ def.put(ldapUrl);
+
+ PropertyDefinitionSimple ldapProtocol = new PropertyDefinitionSimple(Constant.LDAPProtocol,
+ "Should communication with the LDAP server be done over SSL", true, PropertySimpleType.BOOLEAN);
+ ldapProtocol.setDisplayName("SSL");
+ ldapProtocol.setPropertyGroupDefinition(ldapGroup);
+ ldapProtocol.setDefaultValue("false");
+ def.put(ldapProtocol);
+
+ PropertyDefinitionSimple ldapLoginProperty = new PropertyDefinitionSimple(
+ Constant.LDAPLoginProperty,
+ "The LDAP property that contains the user name. Defaults to cn. If multiple matches are found, the first entry found is used.",
+ false, PropertySimpleType.STRING);
+ ldapLoginProperty.setDisplayName("Login Property");
+ ldapLoginProperty.setPropertyGroupDefinition(ldapGroup);
+ ldapLoginProperty.setDefaultValue("cn");
+ def.put(ldapLoginProperty);
+
+ PropertyDefinitionSimple ldapFilter = new PropertyDefinitionSimple(
+ Constant.LDAPFilter,
+ "Any additional filters to apply when doing the LDAP search. This is useful if the population to authenticate can be identified via a given LDAP property, e.g. RHQUser=true",
+ false, PropertySimpleType.STRING);
+ ldapFilter.setDisplayName("Search Filter");
+ ldapFilter.setPropertyGroupDefinition(ldapGroup);
+ ldapFilter.setDefaultValue("");
+ def.put(ldapFilter);
+
+ PropertyDefinitionSimple ldapGroupFilter = new PropertyDefinitionSimple(
+ Constant.LDAPGroupFilter,
+ "LDAP search filter that must return all LDAP groups available for authorization. This is used for LDAP group authorization.",
+ false, PropertySimpleType.STRING);
+ ldapGroupFilter.setDisplayName("Group Search Filter");
+ ldapGroupFilter.setPropertyGroupDefinition(ldapGroup);
+ ldapGroupFilter.setDefaultValue("rhqadmin");
+ def.put(ldapGroupFilter);
+
+ PropertyDefinitionSimple ldapGroupMember = new PropertyDefinitionSimple(
+ Constant.LDAPGroupMember,
+ "LDAP search filter that is used in conjunction with the group search filter to determine user authorization. This is used for LDAP group authorization.",
+ false, PropertySimpleType.STRING);
+ ldapGroupMember.setDisplayName("Group Member Filter");
+ ldapGroupMember.setPropertyGroupDefinition(ldapGroup);
+ ldapGroupMember.setDefaultValue("");
+ def.put(ldapGroupMember);
+
+ PropertyDefinitionSimple ldapBaseDN = new PropertyDefinitionSimple(
+ Constant.LDAPBaseDN,
+ "The base of the directory tree to search for usernames and passwords while authenticating users, e.g. ou=People,dc=jboss,dc=com",
+ false, PropertySimpleType.STRING);
+ ldapBaseDN.setDisplayName("Search Base");
+ ldapBaseDN.setPropertyGroupDefinition(ldapGroup);
+ ldapBaseDN.setDefaultValue("o=RedHat,c=US");
+ def.put(ldapBaseDN);
+
+ PropertyDefinitionSimple ldapBindDN = new PropertyDefinitionSimple(
+ Constant.LDAPBindDN,
+ "The username to connect to the LDAP server when querying the LDAP server's user database. This is typically the full LDAP distinguished name (DN) of a manager user, e.g. cn=Manager,dc=jboss,dc=com.",
+ false, PropertySimpleType.STRING);
+ ldapBindDN.setDisplayName("Username");
+ ldapBindDN.setPropertyGroupDefinition(ldapGroup);
+ ldapBindDN.setDefaultValue("");
+ def.put(ldapBindDN);
+
+ PropertyDefinitionSimple ldapBindPW = new PropertyDefinitionSimple(
+ Constant.LDAPBindPW,
+ "The credentials of the user used to connect to the LDAP server when querying the LDAP server's user database.",
+ false, PropertySimpleType.PASSWORD);
+ ldapBindPW.setDisplayName("Password");
+ ldapBindPW.setPropertyGroupDefinition(ldapGroup);
+ ldapBindPW.setDefaultValue("");
+ def.put(ldapBindPW);
+
+ return def;
+
+ }
+
+ private DynamicForm getServerDetails() {
+ DynamicForm form = new LocatableDynamicForm(extendLocatorId("serverDetails"));
+ form.setWidth100();
+ form.setExtraSpace(15);
+ form.setIsGroup(true);
+ form.setGroupTitle("Server Details");
+
+ final StaticTextItem productName = new StaticTextItem("productname", "Name");
+ final StaticTextItem productVersion = new StaticTextItem("productversion", "Version");
+ final StaticTextItem productBuildNumber = new StaticTextItem("productbuild", "Build Number");
+
+ final StaticTextItem serverTimezone = new StaticTextItem("timezone", "Server Time Zone");
+ final StaticTextItem serverTime = new StaticTextItem("localtime", "Server Local Time");
+ final StaticTextItem dbUrl = new StaticTextItem("dbUrl", "Database Connection URL");
+ final StaticTextItem dbProductName = new StaticTextItem("dbProductName", "Database Product Name");
+ final StaticTextItem dbProductVersion = new StaticTextItem("dbProductVersion", "Database Product Version");
+ final StaticTextItem dbDriverName = new StaticTextItem("dbDriverName", "Database Driver Name");
+ final StaticTextItem dbDriverVersion = new StaticTextItem("dbDriverVersion", "Database Driver Version");
+ final StaticTextItem currentMeasRawTable = new StaticTextItem("currentMeasRawTable",
+ "Current Measurement Raw Table");
+ final StaticTextItem nextMeasTableRotation = new StaticTextItem("nextMeasTableRotation",
+ "Next Measurement Table Rotation");
+
+ productName.setWrapTitle(false);
+ productVersion.setWrapTitle(false);
+ productBuildNumber.setWrapTitle(false);
+ serverTimezone.setWrapTitle(false);
+ serverTime.setWrapTitle(false);
+ dbUrl.setWrapTitle(false);
+ dbProductName.setWrapTitle(false);
+ dbProductVersion.setWrapTitle(false);
+ dbDriverName.setWrapTitle(false);
+ dbDriverVersion.setWrapTitle(false);
+ currentMeasRawTable.setWrapTitle(false);
+ nextMeasTableRotation.setWrapTitle(false);
+
+ form.setItems(productName, productVersion, productBuildNumber, serverTimezone, serverTime, dbUrl,
+ dbProductName, dbProductVersion, dbDriverName, dbDriverVersion, currentMeasRawTable, nextMeasTableRotation);
+
+ GWTServiceLookup.getSystemService().getServerDetails(new AsyncCallback<ServerDetails>() {
+
+ @Override
+ public void onSuccess(ServerDetails result) {
+ ProductInfo productInfo = result.getProductInfo();
+ productName.setValue(productInfo.getName());
+ productVersion.setValue(productInfo.getVersion());
+ productBuildNumber.setValue(productInfo.getBuildNumber());
+
+ HashMap<Detail, String> details = result.getDetails();
+ serverTimezone.setValue(details.get(ServerDetails.Detail.SERVER_TIMEZONE));
+ serverTime.setValue(details.get(ServerDetails.Detail.SERVER_LOCAL_TIME));
+ dbUrl.setValue(details.get(ServerDetails.Detail.DATABASE_CONNECTION_URL));
+ dbProductName.setValue(details.get(ServerDetails.Detail.DATABASE_PRODUCT_NAME));
+ dbProductVersion.setValue(details.get(ServerDetails.Detail.DATABASE_PRODUCT_VERSION));
+ dbDriverName.setValue(details.get(ServerDetails.Detail.DATABASE_DRIVER_NAME));
+ dbDriverVersion.setValue(details.get(ServerDetails.Detail.DATABASE_DRIVER_VERSION));
+ currentMeasRawTable.setValue(details.get(ServerDetails.Detail.CURRENT_MEASUREMENT_TABLE));
+ nextMeasTableRotation.setValue(details.get(ServerDetails.Detail.NEXT_MEASUREMENT_TABLE_ROTATION));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Cannot get server details", caught);
+ }
+ });
+
+ return form;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
index 1da3e7f..0a47e29 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SystemGWTService.java
@@ -18,13 +18,26 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.HashMap;
+
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
/**
+ * Provides information about the server as well as a way to reconfigure parts of the server.
+ *
+ * @author John Mazzitelli
* @author Ian Springer
*/
public interface SystemGWTService extends RemoteService {
+
ProductInfo getProductInfo() throws RuntimeException;
+
+ ServerDetails getServerDetails() throws RuntimeException;
+
+ HashMap<String, String> getSystemConfiguration() throws RuntimeException;
+
+ void setSystemConfiguration(HashMap<String, String> properties, boolean skipValidation) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/LdapGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/LdapGWTServiceImpl.java
index 6e3363e..9293c4b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/LdapGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/LdapGWTServiceImpl.java
@@ -149,7 +149,8 @@ public class LdapGWTServiceImpl extends AbstractGWTServiceImpl implements LdapGW
*/
public Boolean checkLdapConfiguredStatus() throws RuntimeException {
try {
- String provider = systemManager.getSystemConfiguration().getProperty(RHQConstants.JAASProvider);
+ String provider = systemManager.getSystemConfiguration(subjectManager.getOverlord()).getProperty(
+ RHQConstants.JAASProvider);
return ((provider != null) && provider.equals(RHQConstants.LDAPJAASProvider));
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
index eb1f3c9..1b5180b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
@@ -18,13 +18,22 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.SystemGWTService;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
+ * Provides access to the system manager that allows you to obtain information about
+ * the server as well as allowing you to reconfigure parts of the server.
+ *
+ * @author John Mazzitelli
* @author Ian Springer
*/
public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements SystemGWTService {
@@ -33,11 +42,61 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
private SystemManagerLocal systemManager = LookupUtil.getSystemManager();
+ @Override
public ProductInfo getProductInfo() throws RuntimeException {
try {
- return this.systemManager.getProductInfo(getSessionSubject());
+ return this.systemManager.getServerDetails(getSessionSubject()).getProductInfo();
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
+ public ServerDetails getServerDetails() throws RuntimeException {
+ try {
+ return this.systemManager.getServerDetails(getSessionSubject());
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ @Override
+ public HashMap<String, String> getSystemConfiguration() throws RuntimeException {
+ try {
+ Properties props = this.systemManager.getSystemConfiguration(getSessionSubject());
+ return convertFromProperties(props);
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
+
+ @Override
+ public void setSystemConfiguration(HashMap<String, String> map, boolean skipValidation) throws RuntimeException {
+ try {
+ Properties props = convertToProperties(map);
+ this.systemManager.setSystemConfiguration(getSessionSubject(), props, skipValidation);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
+
+ // GWT does not support java.util.Properties - we have to convert to/from Properties <-> HashMap
+ private Properties convertToProperties(HashMap<String, String> map) {
+ Properties props = new Properties();
+ if (map != null) {
+ props.putAll(map);
+ }
+ return props;
+ }
+
+ private HashMap<String, String> convertFromProperties(Properties props) {
+ if (props == null) {
+ return new HashMap<String, String>(0);
+ }
+ HashMap<String, String> map = new HashMap<String, String>(props.size());
+ for (Map.Entry<Object, Object> entry : props.entrySet()) {
+ map.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
+ }
+ return map;
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigAction.java
index 9dfd4aa..7301478 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigAction.java
@@ -59,7 +59,8 @@ public class EditConfigAction extends BaseAction {
if (cForm.isOkClicked()) {
try {
log.trace("Getting config");
- Properties props = cForm.saveConfigProperties(systemManager.getSystemConfiguration());
+ Properties props = cForm.saveConfigProperties(systemManager.getSystemConfiguration(LookupUtil
+ .getSubjectManager().getOverlord()));
log.trace("Setting config");
if (LookupUtil.getAuthorizationManager().isSystemSuperuser(whoami)
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigPrepAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigPrepAction.java
index ebdcf80..c1d3ae9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigPrepAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/config/EditConfigPrepAction.java
@@ -20,11 +20,13 @@ package org.rhq.enterprise.gui.admin.config;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.actions.TilesAction;
+
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -34,7 +36,7 @@ public class EditConfigPrepAction extends TilesAction {
HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemConfigForm cForm = (SystemConfigForm) form;
SystemManagerLocal systemManager = LookupUtil.getSystemManager();
- cForm.loadConfigProperties(systemManager.getSystemConfiguration());
+ cForm.loadConfigProperties(systemManager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord()));
return null;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/role/AddLdapGroupsFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/role/AddLdapGroupsFormPrepareAction.java
index a704fb1..1a1a841 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/role/AddLdapGroupsFormPrepareAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/role/AddLdapGroupsFormPrepareAction.java
@@ -20,16 +20,13 @@ package org.rhq.enterprise.gui.admin.role;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.SortedSet;
import java.util.TreeMap;
-import java.util.TreeSet;
import javax.ejb.EJBException;
import javax.servlet.http.HttpServletRequest;
@@ -45,7 +42,6 @@ import org.apache.struts.action.ActionMessages;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.actions.TilesAction;
-import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.resource.group.LdapGroup;
import org.rhq.core.domain.util.PageControl;
@@ -56,7 +52,6 @@ import org.rhq.enterprise.gui.legacy.util.RequestUtils;
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
import org.rhq.enterprise.gui.util.WebUtility;
import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.exception.LdapCommunicationException;
import org.rhq.enterprise.server.exception.LdapFilterException;
import org.rhq.enterprise.server.resource.group.LdapGroupManagerLocal;
@@ -178,7 +173,7 @@ public class AddLdapGroupsFormPrepareAction extends TilesAction {
} else if (cause instanceof LdapCommunicationException) {
ActionMessages actionMessages = new ActionMessages();
SystemManagerLocal manager = LookupUtil.getSystemManager();
- Properties options = manager.getSystemConfiguration();
+ Properties options = manager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord());
String providerUrl = options.getProperty(RHQConstants.LDAPUrl, "(unavailable)");
actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"admin.role.LdapCommunicationMessage", providerUrl));
@@ -192,7 +187,7 @@ public class AddLdapGroupsFormPrepareAction extends TilesAction {
} catch (LdapCommunicationException lce) {
ActionMessages actionMessages = new ActionMessages();
SystemManagerLocal manager = LookupUtil.getSystemManager();
- Properties options = manager.getSystemConfiguration();
+ Properties options = manager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord());
String providerUrl = options.getProperty(RHQConstants.LDAPUrl, "(unavailable)");
actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("admin.role.LdapCommunicationMessage",
providerUrl));
@@ -318,8 +313,7 @@ public class AddLdapGroupsFormPrepareAction extends TilesAction {
if (descending) {
keyList = new ArrayList<String>(groupNames.keySet());
Collections.reverse(keyList);
- }
- else {
+ } else {
keyList = new ArrayList<String>(groupNames.keySet());
Collections.sort(keyList);
}
@@ -335,9 +329,8 @@ public class AddLdapGroupsFormPrepareAction extends TilesAction {
if (descending) {
keyList = new ArrayList<String>(groupDescriptions.keySet());
Collections.reverse(keyList);
- }
- else {
- keyList = new ArrayList<String>( groupDescriptions.keySet());
+ } else {
+ keyList = new ArrayList<String>(groupDescriptions.keySet());
Collections.sort(keyList);
}
for (String key : keyList) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
index b318a55..e5c0e46 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
@@ -161,7 +161,8 @@ public class AgentUpdateServlet extends HttpServlet {
private int getDownloadLimit() {
// if the server cloud was configured to disallow updates, return 0
- Properties systemConfig = LookupUtil.getSystemManager().getSystemConfiguration();
+ Properties systemConfig = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord());
if (!Boolean.parseBoolean(systemConfig.getProperty(RHQConstants.EnableAgentAutoUpdate))) {
return 0;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/AuthenticateUserAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/AuthenticateUserAction.java
index ce44bb3..7b1c036 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/AuthenticateUserAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authentication/AuthenticateUserAction.java
@@ -206,7 +206,8 @@ public class AuthenticateUserAction extends TilesAction {
String provider = (String) context.getAttribute(Constants.JAAS_PROVIDER_CTX_ATTR);
if (provider == null) {
- provider = LookupUtil.getSystemManager().getSystemConfiguration().getProperty(RHQConstants.JAASProvider);
+ provider = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord()).getProperty(RHQConstants.JAASProvider);
context.setAttribute(Constants.JAAS_PROVIDER_CTX_ATTR, provider);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/framework/ServerInfoUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/framework/ServerInfoUIBean.java
index efe3dba..0689f49 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/framework/ServerInfoUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/framework/ServerInfoUIBean.java
@@ -51,13 +51,14 @@ public class ServerInfoUIBean {
public boolean isDebugModeEnabled() {
SystemManagerLocal systemManager = LookupUtil.getSystemManager();
- return Boolean.valueOf(systemManager.getSystemConfiguration().getProperty(RHQConstants.EnableDebugMode));
+ return Boolean.valueOf(systemManager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord())
+ .getProperty(RHQConstants.EnableDebugMode));
}
public boolean isExperimentalFeaturesEnabled() {
SystemManagerLocal systemManager = LookupUtil.getSystemManager();
- return Boolean.valueOf(systemManager.getSystemConfiguration().getProperty(
- RHQConstants.EnableExperimentalFeatures));
+ return Boolean.valueOf(systemManager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord())
+ .getProperty(RHQConstants.EnableExperimentalFeatures));
}
public String getFacesVersion() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/ConfigTag.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/ConfigTag.java
index 4b58884..121003c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/ConfigTag.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/ConfigTag.java
@@ -19,11 +19,14 @@
package org.rhq.enterprise.gui.legacy.taglib;
import java.util.Properties;
+
import javax.servlet.jsp.JspException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.taglibs.standard.tag.common.core.NullAttributeException;
import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
+
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -77,7 +80,7 @@ public class ConfigTag extends VarSetterBaseTag {
SystemManagerLocal systemManager = LookupUtil.getSystemManager();
log.trace("getting CAM config property [" + prop + "]");
- Properties conf = systemManager.getSystemConfiguration();
+ Properties conf = systemManager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord());
String propVal = conf.getProperty(prop);
if (value != null) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/ContextUtils.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/ContextUtils.java
index 31d5fc4..994bf64 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/ContextUtils.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/ContextUtils.java
@@ -249,7 +249,8 @@ public class ContextUtils {
public static boolean usingLDAPAuthentication(ServletContext context) throws Exception {
String provider = (String) context.getAttribute(Constants.JAAS_PROVIDER_CTX_ATTR);
if (provider == null) {
- provider = LookupUtil.getSystemManager().getSystemConfiguration().getProperty(RHQConstants.JAASProvider);
+ provider = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord()).getProperty(RHQConstants.JAASProvider);
context.setAttribute(Constants.JAAS_PROVIDER_CTX_ATTR, provider);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/SystemInfoForm.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/SystemInfoForm.jsp
index 43c6691..f40c932 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/SystemInfoForm.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/SystemInfoForm.jsp
@@ -5,7 +5,10 @@
<%@ page import="java.util.Date" %>
<%@ page import="java.util.TimeZone" %>
<%@ page import="org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility" %>
-<%@ page import="org.rhq.enterprise.server.util.SystemInformation" %>
+<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
+<%@ page import="org.rhq.core.domain.common.ServerDetails" %>
+<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
+<%@ page import="org.rhq.core.domain.auth.Subject" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
@@ -20,46 +23,46 @@
<!-- / -->
<%
- SystemInformation info = SystemInformation.getInstance();
- DateFormat localTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL);
+ Subject subject = SessionUtils.getWebUser(session).getSubject();
+ ServerDetails info = LookupUtil.getSystemManager().getServerDetails(subject);
%>
<!-- SYSTEM-WIDE CONTENTS -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap" width="45%" class="BlockLabel"><fmt:message key="admin.settings.TimeZone"/></td>
- <td nowrap="nowrap" width="55%" class="BlockContent"><%= TimeZone.getDefault().getDisplayName()%></td>
+ <td nowrap="nowrap" width="55%" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.SERVER_TIMEZONE) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.LocalTime"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= localTimeFormatter.format(new Date(System.currentTimeMillis()))%></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.SERVER_LOCAL_TIME) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.DatabaseURL"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= info.getDatabaseConnectionURL() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.DATABASE_CONNECTION_URL) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.DatabaseProductName"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= info.getDatabaseProductName() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.DATABASE_PRODUCT_NAME) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.DatabaseProductVersion"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= info.getDatabaseProductVersion() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.DATABASE_PRODUCT_VERSION) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.DatabaseDriverName"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= info.getDatabaseDriverName() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.DATABASE_DRIVER_NAME) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.DatabaseDriverVersion"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= info.getDatabaseDriverVersion() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.DATABASE_DRIVER_VERSION) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.RawTable"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= MeasurementDataManagerUtility.getCurrentRawTable() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.CURRENT_MEASUREMENT_TABLE) %></td>
</tr>
<tr>
<td nowrap="nowrap" class="BlockLabel"><fmt:message key="admin.settings.System.RotationTime"/></td>
- <td nowrap="nowrap" class="BlockContent"><%= MeasurementDataManagerUtility.getNextRotationTime() %></td>
+ <td nowrap="nowrap" class="BlockContent"><%= info.getDetails().get(ServerDetails.Detail.NEXT_MEASUREMENT_TABLE_ROTATION) %></td>
</tr>
<tr>
<td colspan="2" class="BlockBottomLine"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
diff --git a/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java b/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
index 05d8e2c..bef4bd5 100644
--- a/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
+++ b/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
@@ -28,6 +28,7 @@ import org.jboss.remoting.security.SSLSocketBuilder;
import org.jboss.remoting.transport.http.ssl.HTTPSClientInvoker;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.ServerDetails;
import org.rhq.enterprise.communications.util.SecurityUtil;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerRemote;
import org.rhq.enterprise.server.alert.AlertManagerRemote;
@@ -54,7 +55,6 @@ import org.rhq.enterprise.server.resource.ResourceTypeManagerRemote;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerRemote;
import org.rhq.enterprise.server.search.SavedSearchManagerRemote;
import org.rhq.enterprise.server.support.SupportManagerRemote;
-import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.system.SystemManagerRemote;
import org.rhq.enterprise.server.tagging.TagManagerRemote;
@@ -187,9 +187,10 @@ public class RemoteClient {
this.subject = getSubjectManagerRemote().login(user, password);
this.loggedIn = true;
- ServerVersion version = getSystemManagerRemote().getServerVersion(this.subject);
+ ServerDetails details = getSystemManagerRemote().getServerDetails(this.subject);
// TODO: what to do with this?
- System.out.println("Remote server version is: " + version);
+ System.out.println("Remote server version is: " + details.getProductInfo().getVersion() + " ("
+ + details.getProductInfo().getBuildNumber() + ")");
return this.subject;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/RHQConstants.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/RHQConstants.java
index 2db5828..e992271 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/RHQConstants.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/RHQConstants.java
@@ -32,15 +32,12 @@ public class RHQConstants {
public static final String PERSISTENCE_UNIT_NAME = "rhqpu";
public static final String TRANSACTION_MANAGER_JNDI_NAME = "java:/TransactionManager";
+ // JAAS settings
public static final String JAASProvider = "CAM_JAAS_PROVIDER";
-
- /**
- * Valid JAAS Providers *
- */
public static final String JDBCJAASProvider = "JDBC";
public static final String LDAPJAASProvider = "LDAP";
- // LDAP Configuration props
+ // LDAP JAAS properties
public static final String LDAPFactory = "CAM_LDAP_NAMING_FACTORY_INITIAL";
public static final String LDAPUrl = "CAM_LDAP_NAMING_PROVIDER_URL";
public static final String LDAPProtocol = "CAM_LDAP_PROTOCOL";
@@ -52,9 +49,7 @@ public class RHQConstants {
public static final String LDAPBindDN = "CAM_LDAP_BIND_DN";
public static final String LDAPBindPW = "CAM_LDAP_BIND_PW";
- /**
- * Base URL for the application *
- */
+ // Base URL for the application - (i think this is only used for alert emails)
public static final String BaseURL = "CAM_BASE_URL";
// how long can an agent be quiet (i.e. not send an avail report) before we consider it down and backfill it
@@ -106,14 +101,17 @@ public class RHQConstants {
// How much data to include
public static final String BaselineDataSet = "CAM_BASELINE_DATASET";
+ //allow plugin initiated resource name & description upgrades (resource key is always upgradable)
+ public static final String AllowResourceGenericPropertiesUpgrade = "RESOURCE_GENERIC_PROPERTIES_UPGRADE";
+
+ /////////////////////////////////////////////////////
+ // the settings below are not used today and can probably be removed at some point
+
// Help related
public static final String HelpUser = "CAM_HELP_USER";
public static final String HelpUserPassword = "CAM_HELP_PASSWORD";
// Syslog Actions enabled
public static final String SyslogActionsEnabled = "CAM_SYSLOG_ACTIONS_ENABLED";
-
- //allow plugin initiated resource name & description upgrades (resource key is always upgradable)
- public static final String AllowResourceGenericPropertiesUpgrade = "RESOURCE_GENERIC_PROPERTIES_UPGRADE";
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 6e79a42..d25d1c4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -247,11 +247,12 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
deleteAlertsQuery = entityManager.createNamedQuery(Alert.QUERY_DELETE_BY_RESOURCE_TEMPLATE);
deleteAlertsQuery.setParameter("resourceTypeId", context.resourceTypeId);
- deleteConditionLogsQuery = entityManager.createNamedQuery(AlertConditionLog.QUERY_DELETE_BY_RESOURCE_TEMPLATE);
+ deleteConditionLogsQuery = entityManager
+ .createNamedQuery(AlertConditionLog.QUERY_DELETE_BY_RESOURCE_TEMPLATE);
deleteConditionLogsQuery.setParameter("resourceTypeId", context.resourceTypeId);
- deleteNotificationLogsQuery = entityManager.createNamedQuery(
- AlertNotificationLog.QUERY_DELETE_BY_RESOURCE_TEMPLATE);
+ deleteNotificationLogsQuery = entityManager
+ .createNamedQuery(AlertNotificationLog.QUERY_DELETE_BY_RESOURCE_TEMPLATE);
deleteNotificationLogsQuery.setParameter("resourceTypeId", context.resourceTypeId);
} else {
@@ -925,7 +926,8 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
public String prettyPrintAlertURL(Alert alert) {
StringBuilder builder = new StringBuilder();
- String baseUrl = systemManager.getSystemConfiguration().getProperty(RHQConstants.BaseURL);
+ String baseUrl = systemManager.getSystemConfiguration(subjectManager.getOverlord()).getProperty(
+ RHQConstants.BaseURL);
builder.append(baseUrl);
if (!baseUrl.endsWith("/")) {
builder.append("/");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 89ad056..8080247 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -362,7 +362,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
}
// get the configuration properties and use the JAAS modules to perform the login
- Properties config = systemManager.getSystemConfiguration();
+ Properties config = systemManager.getSystemConfiguration(getOverlord());
try {
UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password.toCharArray());
@@ -449,7 +449,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
} else {//Start LDAP check.
//retrieve configuration properties and do LDAP check(permissions check in SubjectGWTImpl)
- Properties config = systemManager.getSystemConfiguration();
+ Properties config = systemManager.getSystemConfiguration(getOverlord());
//determine if ldap configured.
boolean ldapConfigured = config.getProperty(RHQConstants.JAASProvider).equals(
@@ -509,7 +509,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
//Subject.id guaranteed to be > 0 then iii)authorization updates for ldap groups necessary
//BZ-580127: only do group authz check if one or both of group filter fields is set
- Properties options = systemManager.getSystemConfiguration();
+ Properties options = systemManager.getSystemConfiguration(getOverlord());
String groupFilter = options.getProperty(RHQConstants.LDAPGroupFilter, "");
String groupMember = options.getProperty(RHQConstants.LDAPGroupMember, "");
if ((groupFilter.trim().length() > 0) || (groupMember.trim().length() > 0)) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
index 25db8ff..e20bf6b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
@@ -58,6 +58,7 @@ import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.agentclient.AgentClient;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -99,6 +100,10 @@ public class AgentManagerBean implements AgentManagerLocal {
private SystemManagerLocal systemManager;
@EJB
+ @IgnoreDependency
+ private SubjectManagerLocal subjectManager;
+
+ @EJB
private AuthorizationManagerLocal authorizationManager;
// constants used for the agent update version file
@@ -212,7 +217,8 @@ public class AgentManagerBean implements AgentManagerLocal {
long maximumQuietTimeAllowed = 900000L;
try {
- String prop = systemManager.getSystemConfiguration().getProperty(RHQConstants.AgentMaxQuietTimeAllowed);
+ String prop = systemManager.getSystemConfiguration(subjectManager.getOverlord()).getProperty(
+ RHQConstants.AgentMaxQuietTimeAllowed);
if (prop != null) {
maximumQuietTimeAllowed = Long.parseLong(prop);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
index 7787dba..be7a0ab 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
@@ -65,7 +65,8 @@ public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceM
public void installJaasModules() {
try {
log.info("Installing RHQ Server's JAAS login modules");
- Properties conf = LookupUtil.getSystemManager().getSystemConfiguration();
+ Properties conf = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord());
registerJaasModules(conf);
} catch (Exception e) {
log.fatal("Error deploying JAAS login modules", e);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 8f21177..d8e3859 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -119,15 +119,13 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
@EJB
private PluginManagerLocal pluginManager;
- public ResourceSyncInfo mergeInventoryReport(InventoryReport report)
- throws InvalidInventoryReportException {
+ public ResourceSyncInfo mergeInventoryReport(InventoryReport report) throws InvalidInventoryReportException {
validateInventoryReport(report);
- InventoryReportFilter filter = new DeletedResourceTypeFilter(subjectManager, resourceTypeManager,
- pluginManager);
+ InventoryReportFilter filter = new DeletedResourceTypeFilter(subjectManager, resourceTypeManager, pluginManager);
if (!filter.accept(report)) {
- throw new StaleTypeException("The report contains one or more resource types that have been marked for " +
- "deletion.");
+ throw new StaleTypeException("The report contains one or more resource types that have been marked for "
+ + "deletion.");
}
Agent agent = report.getAgent();
@@ -136,10 +134,9 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
Agent knownAgent = agentManager.getAgentByName(agent.getName());
if (knownAgent == null) {
throw new InvalidInventoryReportException("Unknown Agent named [" + agent.getName()
- + "] sent an inventory report - that report will be ignored. "
+ + "] sent an inventory report - that report will be ignored. "
+ "This error is harmless and should stop appearing after a short while if the platform of the agent ["
- + agent.getName()
- + "] was recently removed from the inventory. In any other case this is a bug.");
+ + agent.getName() + "] was recently removed from the inventory. In any other case this is a bug.");
}
if (log.isDebugEnabled()) {
@@ -434,8 +431,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
public Set<ResourceUpgradeResponse> upgradeResources(Set<ResourceUpgradeRequest> upgradeRequests) {
Set<ResourceUpgradeResponse> result = new HashSet<ResourceUpgradeResponse>();
- boolean allowGenericPropertiesUpgrade = Boolean.parseBoolean(systemManager.getSystemConfiguration()
- .getProperty(RHQConstants.AllowResourceGenericPropertiesUpgrade, "false"));
+ boolean allowGenericPropertiesUpgrade = Boolean.parseBoolean(systemManager.getSystemConfiguration(
+ subjectManager.getOverlord()).getProperty(RHQConstants.AllowResourceGenericPropertiesUpgrade, "false"));
for (ResourceUpgradeRequest request : upgradeRequests) {
Resource existingResource = this.entityManager.find(Resource.class, request.getResourceId());
@@ -508,9 +505,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
private ResourceUpgradeResponse upgradeResource(@NotNull Resource resource, ResourceUpgradeRequest upgradeRequest,
boolean allowGenericPropertiesUpgrade) {
if (upgradeRequest.getUpgradeErrorMessage() != null) {
- ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
- upgradeRequest.getUpgradeErrorMessage(), upgradeRequest.getUpgradeErrorStackTrace(),
- upgradeRequest.getTimestamp());
+ ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE, upgradeRequest
+ .getUpgradeErrorMessage(), upgradeRequest.getUpgradeErrorStackTrace(), upgradeRequest.getTimestamp());
resourceManager.addResourceError(error);
return null;
}
@@ -688,8 +684,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
continue;
}
}
- existingResource = resourceManager.getResourceByParentAndKey(overlord, existingParent,
- resource.getResourceKey(), resourceType.getPlugin(), resourceType.getName());
+ existingResource = resourceManager.getResourceByParentAndKey(overlord, existingParent, resource
+ .getResourceKey(), resourceType.getPlugin(), resourceType.getName());
}
if (existingResource != null) {
@@ -918,8 +914,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
throw new IllegalArgumentException("Can only commit resources with status: " + results);
}
- PageList<Resource> resources = resourceManager.findResourceByIds(subject, resourceIds, false,
- PageControl.getUnlimitedInstance());
+ PageList<Resource> resources = resourceManager.findResourceByIds(subject, resourceIds, false, PageControl
+ .getUnlimitedInstance());
List<Resource> platforms = new ArrayList<Resource>();
List<Resource> servers = new ArrayList<Resource>();
for (Resource res : resources) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java
index 10bdbc7..282ae1a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementBaselineManagerBean.java
@@ -98,7 +98,7 @@ public class MeasurementBaselineManagerBean implements MeasurementBaselineManage
@TransactionAttribute(TransactionAttributeType.NEVER)
public void calculateAutoBaselines() {
- Properties conf = systemManager.getSystemConfiguration();
+ Properties conf = systemManager.getSystemConfiguration(subjectManager.getOverlord());
// frequency is how often the baselines are recalculated
// data set is how far back for a particular scheduled measurement is included in the baseline calcs
@@ -120,8 +120,12 @@ public class MeasurementBaselineManagerBean implements MeasurementBaselineManage
measurementBaselineManager.calculateAutoBaselines(amountOfData, baselinesOlderThanTime);
// everything was calculated successfully, remember this time
- conf = systemManager.getSystemConfiguration(); // reload the config in case it was changed since we started
- systemManager.setSystemConfiguration(subjectManager.getOverlord(), conf, true);
+ conf = systemManager.getSystemConfiguration(subjectManager.getOverlord()); // reload the config in case it was changed since we started
+ try {
+ systemManager.setSystemConfiguration(subjectManager.getOverlord(), conf, true);
+ } catch (Exception e) {
+ log.error("Failed to remember the time when we just calc'ed baselines - it may recalculate again soon.", e);
+ }
}
@TransactionAttribute(TransactionAttributeType.NEVER)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementCompressionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementCompressionManagerBean.java
index cff76b2..a09899e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementCompressionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementCompressionManagerBean.java
@@ -36,6 +36,7 @@ import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.annotation.IgnoreDependency;
import org.jboss.annotation.ejb.TransactionTimeout;
import org.rhq.core.clientapi.util.TimeUtil;
@@ -43,6 +44,7 @@ import org.rhq.core.util.StopWatch;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.measurement.instrumentation.MeasurementMonitor;
import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility;
import org.rhq.enterprise.server.system.SystemManagerLocal;
@@ -71,6 +73,9 @@ public class MeasurementCompressionManagerBean implements MeasurementCompression
private SessionContext ctx;
@EJB
+ @IgnoreDependency
+ private SubjectManagerLocal subjectManager;
+ @EJB
private SystemManagerLocal systemManager;
@EJB
private MeasurementCompressionManagerLocal compressionManager;
@@ -85,7 +90,7 @@ public class MeasurementCompressionManagerBean implements MeasurementCompression
private void loadPurgeDefaults() {
this.log.debug("Loading default purge intervals");
- Properties conf = systemManager.getSystemConfiguration();
+ Properties conf = systemManager.getSystemConfiguration(subjectManager.getOverlord());
try {
this.purge1h = Long.parseLong(conf.getProperty(RHQConstants.DataPurge1Hour));
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementDataManagerUtility.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementDataManagerUtility.java
index 7a82255..281beb2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementDataManagerUtility.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementDataManagerUtility.java
@@ -111,7 +111,8 @@ public class MeasurementDataManagerUtility {
LOG.debug("Loading default purge intervals");
try {
- Properties conf = LookupUtil.getSystemManager().getSystemConfiguration();
+ Properties conf = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord());
purge1h = Long.parseLong(conf.getProperty(RHQConstants.DataPurge1Hour));
purge6h = Long.parseLong(conf.getProperty(RHQConstants.DataPurge6Hour));
purge1d = Long.parseLong(conf.getProperty(RHQConstants.DataPurge1Day));
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
index 37d72e7..eafae9d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
@@ -53,7 +53,6 @@ import org.rhq.core.domain.resource.group.LdapGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.server.PersistenceUtility;
-import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -87,7 +86,7 @@ public class LdapGroupManagerBean implements LdapGroupManagerLocal {
private SystemManagerLocal systemManager;
public Set<Map<String, String>> findAvailableGroups() {
- Properties options = systemManager.getSystemConfiguration();
+ Properties options = systemManager.getSystemConfiguration(subjectManager.getOverlord());
Set<Map<String, String>> emptyAvailableGroups = new HashSet<Map<String, String>>();
//retrieve the filters.
@@ -100,7 +99,7 @@ public class LdapGroupManagerBean implements LdapGroupManagerLocal {
}
public Set<String> findAvailableGroupsFor(String userName) {
- Properties options = systemManager.getSystemConfiguration();
+ Properties options = systemManager.getSystemConfiguration(subjectManager.getOverlord());
String groupFilter = options.getProperty(RHQConstants.LDAPGroupFilter, "");
String groupMember = options.getProperty(RHQConstants.LDAPGroupMember, "");
String userDN = getUserDN(options, userName);
@@ -257,7 +256,7 @@ public class LdapGroupManagerBean implements LdapGroupManagerLocal {
}
public Map<String, String> findLdapUserDetails(String userName) {
- Properties options = systemManager.getSystemConfiguration();
+ Properties options = systemManager.getSystemConfiguration(subjectManager.getOverlord());
HashMap<String, String> userDetails = new HashMap<String, String>();
// Load our LDAP specific properties
Properties env = getProperties(options);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJob.java
index 240403f..ffc5dfc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJob.java
@@ -83,7 +83,8 @@ public class DataPurgeJob extends AbstractStatefulJob {
LOG.info("Data Purge Job STARTING");
try {
- Properties systemConfig = LookupUtil.getSystemManager().getSystemConfiguration();
+ Properties systemConfig = LookupUtil.getSystemManager().getSystemConfiguration(
+ LookupUtil.getSubjectManager().getOverlord());
compressMeasurementData(LookupUtil.getMeasurementCompressionManager());
purgeEverything(systemConfig);
performDatabaseMaintenance(LookupUtil.getSystemManager(), systemConfig);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index dd65ec1..27eea7c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -24,11 +24,14 @@ import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
+import java.text.DateFormat;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.TimeZone;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -47,6 +50,7 @@ import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.annotation.IgnoreDependency;
import org.jboss.deployment.MainDeployerMBean;
import org.jboss.mx.util.MBeanServerLocator;
@@ -55,15 +59,19 @@ import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.domain.common.SystemConfiguration;
+import org.rhq.core.domain.common.ServerDetails.Detail;
import org.rhq.core.server.PersistenceUtility;
import org.rhq.core.util.ObjectNameFactory;
import org.rhq.core.util.StopWatch;
import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.core.CoreServerMBean;
import org.rhq.enterprise.server.core.CustomJaasDeploymentServiceMBean;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SystemDatabaseInformation;
@Stateless
public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemote {
@@ -97,6 +105,11 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
@EJB
private SystemManagerLocal systemManager;
+
+ @EJB
+ @IgnoreDependency
+ private SubjectManagerLocal subjectManager;
+
private static Properties systemConfigurationCache = null;
private final String TIMER_DATA = "SystemManagerBean.reloadConfigCache";
@@ -157,7 +170,8 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
}
}
- public Properties getSystemConfiguration() {
+ @RequiredPermission(Permission.MANAGE_SETTINGS)
+ public Properties getSystemConfiguration(Subject subject) {
if (systemConfigurationCache == null) {
loadSystemConfigurationCache();
@@ -199,7 +213,7 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
@SuppressWarnings("unchecked")
@RequiredPermission(Permission.MANAGE_SETTINGS)
- public void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation) {
+ public void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation) throws Exception {
// first, we need to get the current settings so we'll know if we need to persist or merge the new ones
List<SystemConfiguration> configs;
configs = entityManager.createNamedQuery(SystemConfiguration.QUERY_FIND_ALL).getResultList();
@@ -517,7 +531,8 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
public boolean isDebugModeEnabled() {
try {
- return Boolean.valueOf(getSystemConfiguration().getProperty(RHQConstants.EnableDebugMode, "false"));
+ Subject su = this.subjectManager.getOverlord();
+ return Boolean.valueOf(getSystemConfiguration(su).getProperty(RHQConstants.EnableDebugMode, "false"));
} catch (Throwable t) {
return false; // paranoid catch-all
}
@@ -525,22 +540,38 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
public boolean isExperimentalFeaturesEnabled() {
try {
- return Boolean.valueOf(getSystemConfiguration().getProperty(RHQConstants.EnableExperimentalFeatures,
+ Subject su = this.subjectManager.getOverlord();
+ return Boolean.valueOf(getSystemConfiguration(su).getProperty(RHQConstants.EnableExperimentalFeatures,
"false"));
} catch (Throwable t) {
return false; // paranoid catch-all
}
}
- public ServerVersion getServerVersion(Subject subject) throws Exception {
- CoreServerMBean coreServer = LookupUtil.getCoreServer();
- String version = coreServer.getVersion();
- String buildNumber = coreServer.getBuildNumber();
- ServerVersion serverVersion = new ServerVersion(version, buildNumber);
- return serverVersion;
+ public ServerDetails getServerDetails(Subject subject) {
+ ServerDetails serverDetails = new ServerDetails();
+
+ serverDetails.setProductInfo(getProductInfo(subject));
+
+ HashMap<Detail, String> details = serverDetails.getDetails();
+
+ DateFormat localTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL);
+ details.put(ServerDetails.Detail.SERVER_LOCAL_TIME, localTimeFormatter.format(new Date()));
+ details.put(ServerDetails.Detail.SERVER_TIMEZONE, TimeZone.getDefault().getDisplayName());
+
+ SystemDatabaseInformation dbInfo = SystemDatabaseInformation.getInstance();
+ details.put(ServerDetails.Detail.DATABASE_CONNECTION_URL, dbInfo.getDatabaseConnectionURL());
+ details.put(ServerDetails.Detail.DATABASE_DRIVER_NAME, dbInfo.getDatabaseDriverName());
+ details.put(ServerDetails.Detail.DATABASE_DRIVER_VERSION, dbInfo.getDatabaseDriverVersion());
+ details.put(ServerDetails.Detail.DATABASE_PRODUCT_NAME, dbInfo.getDatabaseProductName());
+ details.put(ServerDetails.Detail.DATABASE_PRODUCT_VERSION, dbInfo.getDatabaseProductVersion());
+ details.put(ServerDetails.Detail.CURRENT_MEASUREMENT_TABLE, dbInfo.getCurrentMeasurementTable());
+ details.put(ServerDetails.Detail.NEXT_MEASUREMENT_TABLE_ROTATION, dbInfo.getNextMeasurementTableRotation());
+
+ return serverDetails;
}
- public ProductInfo getProductInfo(Subject subject) {
+ private ProductInfo getProductInfo(Subject subject) {
CoreServerMBean coreServer = LookupUtil.getCoreServer();
ProductInfo productInfo = coreServer.getProductInfo();
return productInfo;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
index 7aa9b6d..3db7b08 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
@@ -24,7 +24,7 @@ import javax.ejb.Local;
import org.rhq.core.db.DatabaseType;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
/**
* Provides access to the server cloud's system configuration as well as some methods
@@ -50,24 +50,6 @@ public interface SystemManagerLocal {
void scheduleConfigCacheReloader();
/**
- * Get the server cloud configuration. These are the server configurations that will be
- * the same for all servers in the HA server cloud.
- *
- * @return Properties
- */
- Properties getSystemConfiguration();
-
- /**
- * Set the server cloud configuration. The given properties will be the new settings
- * for all servers in the HA server cloud.
- *
- * @param subject the user who wants to change the settings
- * @param properties the new system configuration settings
- * @param skipValidation if true, validation will not be performed on the properties
- */
- void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation);
-
- /**
* Creates and registers the Hibernate Statistics MBean. This allows us to monitor
* our own Hibernate usage.
*/
@@ -159,7 +141,9 @@ public interface SystemManagerLocal {
//
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ServerVersion getServerVersion(Subject subject) throws Exception;
+ ServerDetails getServerDetails(Subject subject);
+
+ Properties getSystemConfiguration(Subject subject);
- ProductInfo getProductInfo(Subject subject);
+ void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation) throws Exception;
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
index cb04a95..d1bafbc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
@@ -18,13 +18,15 @@
*/
package org.rhq.enterprise.server.system;
+import java.util.Properties;
+
import javax.ejb.Remote;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
/**
* @author John Mazzitelli
@@ -33,15 +35,39 @@ import org.rhq.core.domain.common.ProductInfo;
@Remote
public interface SystemManagerRemote {
/**
- * Provides version information of the server processing the request.
+ * Provides details (such as product version) of the server processing the request.
+ *
+ * @param subject user making the request
*
- * @return server version information
+ * @return server details
*/
@WebMethod
- ServerVersion getServerVersion( //
- @WebParam(name = "subject") Subject subject) throws Exception;
+ ServerDetails getServerDetails( //
+ @WebParam(name = "subject") Subject subject);
+ /**
+ * Get the server cloud configuration. These are the server configurations that will be
+ * the same for all servers in the HA server cloud.
+ *
+ * @param subject user making the request
+ *
+ * @return Properties
+ */
@WebMethod
- ProductInfo getProductInfo(
+ Properties getSystemConfiguration( //
@WebParam(name = "subject") Subject subject);
+
+ /**
+ * Set the server cloud configuration. The given properties will be the new settings
+ * for all servers in the HA server cloud.
+ *
+ * @param subject the user who wants to change the settings
+ * @param properties the new system configuration settings
+ * @param skipValidation if true, validation will not be performed on the properties
+ */
+ @WebMethod
+ void setSystemConfiguration( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "properties") Properties properties, //
+ @WebParam(name = "skipValidation") boolean skipValidation) throws Exception;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemDatabaseInformation.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemDatabaseInformation.java
new file mode 100644
index 0000000..d0f2f41
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemDatabaseInformation.java
@@ -0,0 +1,135 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.util;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.common.ServerDetails;
+import org.rhq.core.util.jdbc.JDBCUtil;
+import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility;
+
+/**
+ * Returns information about the database.
+ *
+ * @see ServerDetails
+ *
+ * @author Joseph Marques
+ * @author John Mazzitelli
+ */
+public final class SystemDatabaseInformation {
+
+ private final Log log = LogFactory.getLog(SystemDatabaseInformation.class);
+
+ private Map<Property, String> properties;
+
+ public enum Property {
+ DATABASE_CONNECTION_URL, //
+ DATABASE_PRODUCT_NAME, //
+ DATABASE_PRODUCT_VERSION, //
+ DATABASE_DRIVER_NAME, //
+ DATABASE_DRIVER_VERSION, //
+ CURRENT_MEASUREMENT_TABLE, //
+ NEXT_MEASUREMENT_TABLE_ROTATION;
+ }
+
+ private SystemDatabaseInformation() {
+ DataSource ds = null;
+ Connection conn = null;
+ try {
+ ds = LookupUtil.getDataSource();
+ conn = ds.getConnection();
+ DatabaseMetaData metadata = conn.getMetaData();
+
+ String url = metadata.getURL();
+ String productName = metadata.getDatabaseProductName();
+ String productVersion = metadata.getDatabaseProductVersion();
+ String driverName = metadata.getDriverName();
+ String driverVersion = metadata.getDriverVersion();
+
+ Map<Property, String> values = new HashMap<Property, String>();
+ values.put(Property.DATABASE_CONNECTION_URL, url);
+ values.put(Property.DATABASE_PRODUCT_NAME, productName);
+ values.put(Property.DATABASE_PRODUCT_VERSION, productVersion);
+ values.put(Property.DATABASE_DRIVER_NAME, driverName);
+ values.put(Property.DATABASE_DRIVER_VERSION, driverVersion);
+
+ values.put(Property.CURRENT_MEASUREMENT_TABLE, MeasurementDataManagerUtility.getCurrentRawTable());
+ values.put(Property.NEXT_MEASUREMENT_TABLE_ROTATION, MeasurementDataManagerUtility.getNextRotationTime());
+
+ properties = Collections.unmodifiableMap(values);
+
+ } catch (Exception e) {
+ log.error("Could not load properties for " + SystemDatabaseInformation.class.getSimpleName());
+ } finally {
+ if (properties == null) {
+ Map<Property, String> values = new HashMap<Property, String>();
+ for (Property prop : Property.values()) {
+ values.put(prop, "unknown");
+ }
+ properties = Collections.unmodifiableMap(values);
+ }
+ JDBCUtil.safeClose(conn);
+ }
+ }
+
+ public static SystemDatabaseInformation getInstance() {
+ return new SystemDatabaseInformation();
+ }
+
+ public Map<Property, String> getProperties(Property property) {
+ return properties;
+ }
+
+ public String getDatabaseConnectionURL() {
+ return properties.get(Property.DATABASE_CONNECTION_URL);
+ }
+
+ public String getDatabaseProductName() {
+ return properties.get(Property.DATABASE_PRODUCT_NAME);
+ }
+
+ public String getDatabaseProductVersion() {
+ return properties.get(Property.DATABASE_PRODUCT_VERSION);
+ }
+
+ public String getDatabaseDriverName() {
+ return properties.get(Property.DATABASE_DRIVER_NAME);
+ }
+
+ public String getDatabaseDriverVersion() {
+ return properties.get(Property.DATABASE_DRIVER_VERSION);
+ }
+
+ public String getCurrentMeasurementTable() {
+ return properties.get(Property.CURRENT_MEASUREMENT_TABLE);
+ }
+
+ public String getNextMeasurementTableRotation() {
+ return properties.get(Property.NEXT_MEASUREMENT_TABLE_ROTATION);
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemInformation.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemInformation.java
deleted file mode 100644
index 185e6b6..0000000
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/SystemInformation.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.util;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.util.jdbc.JDBCUtil;
-
-/**
- * @author Joseph Marques
- */
-public final class SystemInformation {
-
- private final Log log = LogFactory.getLog(SystemInformation.class);
-
- private Map<Property, String> properties;
-
- public enum Property {
- DATABASE_CONNECTION_URL, //
- DATABASE_PRODUCT_NAME, //
- DATABASE_PRODUCT_VERSION, //
- DATABASE_DRIVER_NAME, //
- DATABASE_DRIVER_VERSION;
- }
-
- private SystemInformation() {
- DataSource ds = null;
- Connection conn = null;
- try {
- ds = LookupUtil.getDataSource();
- conn = ds.getConnection();
- DatabaseMetaData metadata = conn.getMetaData();
-
- String url = metadata.getURL();
- String productName = metadata.getDatabaseProductName();
- String productVersion = metadata.getDatabaseProductVersion();
- String driverName = metadata.getDriverName();
- String driverVersion = metadata.getDriverVersion();
-
- Map<Property, String> values = new HashMap<Property, String>();
- values.put(Property.DATABASE_CONNECTION_URL, url);
- values.put(Property.DATABASE_PRODUCT_NAME, productName);
- values.put(Property.DATABASE_PRODUCT_VERSION, productVersion);
- values.put(Property.DATABASE_DRIVER_NAME, driverName);
- values.put(Property.DATABASE_DRIVER_VERSION, driverVersion);
- properties = Collections.unmodifiableMap(values);
-
- } catch (Exception e) {
- log.error("Could not load properties for " + SystemInformation.class.getSimpleName());
- } finally {
- if (properties == null) {
- Map<Property, String> values = new HashMap<Property, String>();
- for (Property prop : Property.values()) {
- values.put(prop, "Could not determine");
- }
- properties = Collections.unmodifiableMap(values);
- }
- JDBCUtil.safeClose(conn);
- }
- }
-
- public static SystemInformation getInstance() {
- return new SystemInformation();
- }
-
- public Map<Property, String> getProperties(Property property) {
- return properties;
- }
-
- public String getDatabaseConnectionURL() {
- return properties.get(Property.DATABASE_CONNECTION_URL);
- }
-
- public String getDatabaseProductName() {
- return properties.get(Property.DATABASE_PRODUCT_NAME);
- }
-
- public String getDatabaseProductVersion() {
- return properties.get(Property.DATABASE_PRODUCT_VERSION);
- }
-
- public String getDatabaseDriverName() {
- return properties.get(Property.DATABASE_DRIVER_NAME);
- }
-
- public String getDatabaseDriverVersion() {
- return properties.get(Property.DATABASE_DRIVER_VERSION);
- }
-}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 056582f..1169bd1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -27,10 +27,10 @@ import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import javax.ejb.Stateless;
-import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -49,7 +49,7 @@ import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.common.EntityContext;
-import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
@@ -1078,12 +1078,17 @@ public class WebservicesManagerBean implements WebservicesRemote {
//SUPPORTMANAGER: END ------------------------------------
//SYSTEMMANAGER: BEGIN ------------------------------------
- public ServerVersion getServerVersion(Subject subject) throws Exception {
- return systemManager.getServerVersion(subject);
+
+ public ServerDetails getServerDetails(Subject subject) {
+ return systemManager.getServerDetails(subject);
+ }
+
+ public Properties getSystemConfiguration(Subject subject) {
+ return systemManager.getSystemConfiguration(subject);
}
- public ProductInfo getProductInfo(@WebParam(name = "subject") Subject subject) {
- return systemManager.getProductInfo(subject);
+ public void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation) throws Exception {
+ systemManager.setSystemConfiguration(subject, properties, skipValidation);
}
//SYSTEMMANAGER: END ------------------------------------
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
index 9bf0d72..5ac3a66 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.system;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+
import org.rhq.core.db.DatabaseType;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
@@ -37,7 +38,7 @@ public class SystemManagerBeanTest extends AbstractEJB3Test {
}
public void testGetSystemConfiguration() {
- assert null != systemManager.getSystemConfiguration();
+ assert null != systemManager.getSystemConfiguration(overlord);
}
public void testAnalyze() {
13 years, 3 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 269 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 27 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 28 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java | 59 ++
6 files changed, 308 insertions(+), 104 deletions(-)
New commits:
commit 38d2349529af561837464fd60a3e2db905249786
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 9 17:18:57 2011 -0500
Add RecentlyViewed resources and groups to Favorites Button (bottom right).
The resources and groups are displayed in a single pop-up, as opposed to
separate menu items a la favorites. This seems more natural as it's just
a running list of visited entities. The entries are visit-ordered and
resources and groups are separated. Limits to 10 resources and 5 groups.
- Moved things around a but in FavoritesButton to minimize db round trips.
- Added protection to all menu items for missing resources or groups (they
may get deleted, uninventoried, etc)
- Added protection against allowing autogroups or autoclusters as favorites
or as recently viewed. (note - this could be done but would require more db
rts, didn't see necessary)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 4f80687..03f29e1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -18,9 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.footer;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Map;
+import java.util.List;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -28,6 +28,7 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -78,124 +79,212 @@ public class FavoritesButton extends LocatableIMenuButton {
favoritesMenu.setItems(favoriteResourcesMenuItem, favoriteGroupsMenuItem, recentlyViewedMenuItem);
addClickHandler(new ClickHandler() {
- private boolean contextMenuIsShown = false;
public void onClick(ClickEvent clickEvent) {
// Cancel the click event. We'll call show() on the menu ourselves only if we're able to load the
// favorite Resources successfully.
clickEvent.cancel();
- contextMenuIsShown = false; // so at least one of our two callbacks will show it
-
- Set<Integer> favoriteResources;
- Set<Integer> favoriteGroups;
- Set<Integer> recentlyViewed;
-
- favoriteResources = UserSessionManager.getUserPreferences().getFavoriteResources();
- favoriteGroups = UserSessionManager.getUserPreferences().getFavoriteResourceGroups();
- recentlyViewed = new HashSet<Integer>(0); // TODO: get the IDs of the recently visited resources
-
- if (!favoriteResources.isEmpty()) {
-
- Integer[] resourceIds = new Integer[favoriteResources.size()];
- final MenuItem[] items = new MenuItem[favoriteResources.size()];
- final Map<Integer, MenuItem> resIdToMenuItemMap = new HashMap<Integer, MenuItem>(favoriteResources
- .size());
- int i = 0;
- for (final Integer resourceId : favoriteResources) {
- resourceIds[i] = resourceId;
- MenuItem item = new MenuItem(String.valueOf(resourceId));
- item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- CoreGUI.goToView(LinkManager.getResourceLink(resourceId));
- }
- });
- items[i] = item;
- resIdToMenuItemMap.put(resourceId, item);
- i++;
+
+ final Set<Integer> favoriteResourceIds = UserSessionManager.getUserPreferences().getFavoriteResources();
+ final Set<Integer> favoriteGroupIds = UserSessionManager.getUserPreferences()
+ .getFavoriteResourceGroups();
+ final List<Integer> recentResourceIds = UserSessionManager.getUserPreferences().getRecentResources();
+ final List<Integer> recentGroupIds = UserSessionManager.getUserPreferences().getRecentResourceGroups();
+
+ // if we have no menu items at all, then show the empty menu now
+ if (favoriteGroupIds.isEmpty() && favoriteResourceIds.isEmpty() && recentResourceIds.isEmpty()
+ && recentGroupIds.isEmpty()) {
+ favoritesMenu.showContextMenu();
+ return;
+ }
+
+ // keep a list of all the ids we need to pull from the db. combine favs and recents to minimize
+ // db round trips.
+ Set<Integer> resourceIds = new HashSet<Integer>();
+ Set<Integer> groupIds = new HashSet<Integer>();
+
+ resourceIds.addAll(favoriteResourceIds);
+ resourceIds.addAll(recentResourceIds);
+ groupIds.addAll(favoriteGroupIds);
+ groupIds.addAll(recentGroupIds);
+
+ fetchFavorites(resourceIds, groupIds, new AsyncCallback<Favorites>() {
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dashboard_favorites_error1(), caught);
}
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterIds(resourceIds);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dashboard_favorites_error1(), caught);
+ public void onSuccess(Favorites favorites) {
+ // generate the menus
+ if (!favoriteResourceIds.isEmpty()) {
+ List<MenuItem> items = new ArrayList<MenuItem>(favoriteResourceIds.size());
+
+ for (final Integer resourceId : favoriteResourceIds) {
+ Resource resource = favorites.getResource(resourceId);
+ if (null == resource) {
+ // if the resource is gone just skip it
+ continue;
+ }
+
+ MenuItem item = new MenuItem(String.valueOf(resourceId));
+ // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
+ // disambiguated Resource names.
+ item.setTitle(resource.getName());
+ item.setIcon(ImageManager.getResourceIcon(resource));
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ CoreGUI.goToView(LinkManager.getResourceLink(resourceId));
+ }
+ });
+ items.add(item);
}
+ favoriteResourcesMenu.setItems(items.toArray(new MenuItem[items.size()]));
+ }
+
+ if (!favoriteGroupIds.isEmpty()) {
+ List<MenuItem> items = new ArrayList<MenuItem>(favoriteGroupIds.size());
- public void onSuccess(PageList<Resource> resources) {
- for (Resource resource : resources) {
- MenuItem item = resIdToMenuItemMap.get(resource.getId());
- // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
- // disambiguated Resource names.
- item.setTitle(resource.getName());
- item.setIcon(ImageManager.getResourceIcon(resource));
+ for (final Integer groupId : favoriteGroupIds) {
+ ResourceGroupComposite groupComposite = favorites.getGroupComposite(groupId);
+ if (null == groupComposite) {
+ // if the resource group is gone just skip it
+ continue;
}
- favoriteResourcesMenu.setItems(items);
- if (!contextMenuIsShown) {
- contextMenuIsShown = true;
- favoritesMenu.showContextMenu();
+ ResourceGroup group = groupComposite.getResourceGroup();
+
+ MenuItem item = new MenuItem(String.valueOf(groupId));
+ item.setTitle(group.getName());
+ item.setIcon(ImageManager.getGroupIcon(group.getGroupCategory(), groupComposite
+ .getImplicitAvail()));
+
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ CoreGUI.goToView(LinkManager.getResourceGroupLink(groupId));
+ }
+ });
+ items.add(item);
+ }
+ favoriteGroupsMenu.setItems(items.toArray(new MenuItem[items.size()]));
+ }
+
+ if (!(recentResourceIds.isEmpty() && recentGroupIds.isEmpty())) {
+ List<MenuItem> items = new ArrayList<MenuItem>(recentResourceIds.size()
+ + recentGroupIds.size());
+
+ for (final Integer resourceId : recentResourceIds) {
+ Resource resource = favorites.getResource(resourceId);
+ if (null == resource) {
+ // if the resource is gone just skip it
+ continue;
}
+
+ MenuItem item = new MenuItem(String.valueOf(resourceId));
+ // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
+ // disambiguated Resource names.
+ item.setTitle(resource.getName());
+ item.setIcon(ImageManager.getResourceIcon(resource));
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ CoreGUI.goToView(LinkManager.getResourceLink(resourceId));
+ }
+ });
+ items.add(item);
}
- });
- }
+ if (!recentResourceIds.isEmpty() && !recentGroupIds.isEmpty()) {
+ items.add(new MenuItemSeparator());
+ }
+ for (final Integer groupId : recentGroupIds) {
+ ResourceGroupComposite groupComposite = favorites.getGroupComposite(groupId);
+ if (null == groupComposite) {
+ // if the resource group is gone just skip it
+ continue;
+ }
+ ResourceGroup group = groupComposite.getResourceGroup();
- if (!favoriteGroups.isEmpty()) {
-
- Integer[] groupIds = new Integer[favoriteGroups.size()];
- final MenuItem[] items = new MenuItem[favoriteGroups.size()];
- final Map<Integer, MenuItem> grpIdToMenuItemMap = new HashMap<Integer, MenuItem>(favoriteGroups
- .size());
- int i = 0;
- for (final Integer groupId : favoriteGroups) {
- groupIds[i] = groupId;
- MenuItem item = new MenuItem(String.valueOf(groupId));
- item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- CoreGUI.goToView(LinkManager.getResourceGroupLink(groupId));
+ MenuItem item = new MenuItem(String.valueOf(groupId));
+ item.setTitle(group.getName());
+ item.setIcon(ImageManager.getGroupIcon(group.getGroupCategory(), groupComposite
+ .getImplicitAvail()));
+
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ CoreGUI.goToView(LinkManager.getResourceGroupLink(groupId));
+ }
+ });
+ items.add(item);
}
- });
- items[i] = item;
- grpIdToMenuItemMap.put(groupId, item);
- i++;
+
+ recentlyViewedMenu.setItems(items.toArray(new MenuItem[items.size()]));
+ }
+
+ favoritesMenu.showContextMenu();
+ }
+ });
+ }
+ });
+ }
+
+ private void fetchFavorites(Set<Integer> resourceIds, final Set<Integer> groupIds,
+ final AsyncCallback<Favorites> callback) {
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterIds(resourceIds.toArray(new Integer[resourceIds.size()]));
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ public void onSuccess(final PageList<Resource> resources) {
+
+ if (groupIds.isEmpty()) {
+ callback.onSuccess(new Favorites(resources, new PageList<ResourceGroupComposite>()));
+ return;
}
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.addFilterIds(groupIds);
+ criteria.addFilterIds(groupIds.toArray(new Integer[groupIds.size()]));
GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroupComposite>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dashboard_favorites_error1(), caught);
+ callback.onFailure(caught);
}
public void onSuccess(PageList<ResourceGroupComposite> groups) {
- for (ResourceGroupComposite groupInfo : groups) {
- ResourceGroup theGroup = groupInfo.getResourceGroup();
- MenuItem item = grpIdToMenuItemMap.get(theGroup.getId());
- item.setTitle(theGroup.getName());
- item.setIcon(ImageManager.getGroupIcon(theGroup.getGroupCategory(), groupInfo
- .getImplicitAvail()));
- }
- favoriteGroupsMenu.setItems(items);
- if (!contextMenuIsShown) {
- contextMenuIsShown = true;
- favoritesMenu.showContextMenu();
- }
-
+ callback.onSuccess(new Favorites(resources, groups));
}
});
+
}
+ });
+ }
- if (!recentlyViewed.isEmpty()) {
- // TODO populate the menu. this is different than the other two because there could be a mix
- // of both resources and groups in here. presumably, the user prefs will be able to tell
- // us which is which so we can call the proper server API and use the proper icons
+ private static class Favorites {
+ private PageList<Resource> resources;
+ private PageList<ResourceGroupComposite> groupComposites;
+
+ public Favorites(PageList<Resource> resources, PageList<ResourceGroupComposite> groupComposites) {
+ this.resources = resources;
+ this.groupComposites = groupComposites;
+ }
+
+ public Resource getResource(int resourceId) {
+ for (Resource resource : resources) {
+ if (resourceId == resource.getId()) {
+ return resource;
}
+ }
+ return null;
+ }
- // if we have no menu items at all, then show the menu now
- if (favoriteGroups.isEmpty() && favoriteResources.isEmpty() && recentlyViewed.isEmpty()) {
- favoritesMenu.showContextMenu();
+ public ResourceGroupComposite getGroupComposite(int groupId) {
+ for (ResourceGroupComposite groupComposite : groupComposites) {
+ if (groupId == groupComposite.getResourceGroup().getId()) {
+ return groupComposite;
}
}
- });
+ return null;
+ }
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 14f71e6..dba7e08 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -23,9 +23,11 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.DataType;
@@ -39,6 +41,7 @@ import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.GroupAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.GroupAlertDefinitionsView;
@@ -354,10 +357,12 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
criteria.addFilterId(groupId);
// for autoclusters and autogroups we need to add more criteria
- if (isAutoCluster()) {
+ final boolean isAutoCluster = isAutoCluster();
+ final boolean isAutoGroup = isAutoGroup();
+ if (isAutoCluster) {
criteria.addFilterVisible(false);
- } else if (isAutoGroup()) {
+ } else if (isAutoGroup) {
criteria.addFilterVisible(false);
criteria.addFilterPrivate(true);
}
@@ -376,6 +381,24 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
} else {
groupComposite = result.get(0);
loadResourceType(groupComposite, viewPath);
+
+ // to avoid multiple queries limit recently visited to standard (visible) groups
+ if (!(isAutoCluster || isAutoGroup)) {
+ UserSessionManager.getUserPreferences().addRecentResourceGroup(groupId,
+ new AsyncCallback<Subject>() {
+
+ public void onFailure(Throwable caught) {
+ Log.error("Unable to update recently viewed resource groups", caught);
+ }
+
+ public void onSuccess(Subject result) {
+ if (Log.isDebugEnabled()) {
+ Log.debug("Updated recently viewed resource groups for " + result
+ + " with resourceGroupId [" + groupId + "]");
+ }
+ }
+ });
+ }
}
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index 042311b..7136dba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -69,6 +69,7 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
private HTMLFlow title;
private Img availabilityImage;
private boolean favorite;
+ private boolean supportsFavorite;
private GeneralProperties generalProperties;
public ResourceGroupTitleBar(String locatorId, boolean isAutoGroup, boolean isAutoCluster) {
@@ -76,6 +77,7 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
this.isAutoGroup = isAutoGroup;
this.isAutoCluster = isAutoCluster;
+ this.supportsFavorite = (!(this.isAutoGroup || this.isAutoCluster));
setWidth100();
setHeight(30);
@@ -96,15 +98,17 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
this.availabilityImage = new Img(ImageManager.getAvailabilityLargeIcon(null), 24, 24);
- this.favoriteButton = new LocatableImg(this.extendLocatorId("Favorite"), NOT_FAV_ICON, 24, 24);
+ if (this.supportsFavorite) {
+ this.favoriteButton = new LocatableImg(this.extendLocatorId("Favorite"), NOT_FAV_ICON, 24, 24);
- this.favoriteButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- Set<Integer> favorites = toggleFavoriteLocally();
- UserSessionManager.getUserPreferences().setFavoriteResourceGroups(favorites,
- new UpdateFavoritesCallback());
- }
- });
+ this.favoriteButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ Set<Integer> favorites = toggleFavoriteLocally();
+ UserSessionManager.getUserPreferences().setFavoriteResourceGroups(favorites,
+ new UpdateFavoritesCallback());
+ }
+ });
+ }
expandCollapseArrow = new Img("[SKIN]/ListGrid/row_collapsed.png", 16, 16);
expandCollapseArrow.setTooltip(COLLAPSED_TOOLTIP);
@@ -193,7 +197,9 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
hlayout.addMember(badge);
hlayout.addMember(title);
hlayout.addMember(availabilityImage);
- hlayout.addMember(favoriteButton);
+ if (this.supportsFavorite) {
+ hlayout.addMember(favoriteButton);
+ }
addMember(tagEditorView);
}
@@ -246,6 +252,10 @@ public class ResourceGroupTitleBar extends LocatableVLayout {
}
private void updateFavoriteButton() {
+ if (!this.supportsFavorite) {
+ return;
+ }
+
this.favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
if (favorite) {
this.favoriteButton.setTooltip(MSG.view_titleBar_common_clickToRemoveFav());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 732f046..1e6d88f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -23,9 +23,11 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.DataType;
@@ -39,6 +41,7 @@ import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefinitionsView;
@@ -418,6 +421,22 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
} else {
final ResourceComposite resourceComposite = result.get(0);
loadResourceType(resourceComposite, viewPath);
+
+ // add this resouce to the user's recently visited list
+ UserSessionManager.getUserPreferences().addRecentResource(resourceId,
+ new AsyncCallback<Subject>() {
+
+ public void onFailure(Throwable caught) {
+ Log.error("Unable to update recently viewed resources", caught);
+ }
+
+ public void onSuccess(Subject result) {
+ if (Log.isDebugEnabled()) {
+ Log.debug("Updated recently viewed resources for " + result
+ + " with resourceId [" + resourceId + "]");
+ }
+ }
+ });
}
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
index cdf586e..248cec7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
@@ -226,12 +226,16 @@ public abstract class UserPreferenceNames {
public static final String LAST_URL = ".last.url";
/**
- * List of recently visited Resources and Groups. Entries are delimited by commas. The format of each entry is
- * id|type|name (e.g. 10001|platform|MyPlatform).
- */
+ * List of recently visited {@link org.rhq.core.domain.resource.Resource} id's, delimited by '|' characters. Default is "".
+ * */
public static final String RECENT_RESOURCES = ".recent.resources";
/**
+ * List of recently visited {@link org.rhq.core.domain.resource.group.ResourceGroup} id's, delimited by '|' characters. Default is "".
+ * */
+ public static final String RECENT_RESOURCE_GROUPS = ".recent.resourceGroups";
+
+ /**
* View mode for Browse Resource page - "CHART" or "LIST". This is most likely obsolete if we switch to GWT, since
* we probably won't provide a CHART mode.
*/
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index f5c936d..14194d2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -73,6 +73,48 @@ public class UserPreferences {
store(callback);
}
+ public List<Integer> getRecentResources() {
+ return this.getPreferenceAsIntegerList(UserPreferenceNames.RECENT_RESOURCES);
+ }
+
+ public void addRecentResource(Integer resourceId, AsyncCallback<Subject> callback) {
+ List<Integer> recentResources = getRecentResources();
+ if (!recentResources.isEmpty() && recentResources.get(0).equals(resourceId)) {
+ return;
+ }
+
+ recentResources.remove(resourceId);
+ recentResources.add(0, resourceId);
+ // limit to the 10 most recent resources
+ int size = recentResources.size();
+ if (size > 10) {
+ recentResources.remove(10);
+ }
+ setPreference(UserPreferenceNames.RECENT_RESOURCES, recentResources);
+ store(callback);
+ }
+
+ public List<Integer> getRecentResourceGroups() {
+ return getPreferenceAsIntegerList(UserPreferenceNames.RECENT_RESOURCE_GROUPS);
+ }
+
+ public void addRecentResourceGroup(Integer resourceGroupId, AsyncCallback<Subject> callback) {
+ List<Integer> recentResourceGroups = getRecentResourceGroups();
+ if (!recentResourceGroups.isEmpty() && recentResourceGroups.get(0).equals(resourceGroupId)) {
+ return;
+ }
+
+ recentResourceGroups.remove(resourceGroupId);
+ recentResourceGroups.add(0, resourceGroupId);
+ // limit to the 5 most recent resources
+ int size = recentResourceGroups.size();
+ if (size > 5) {
+ recentResourceGroups.remove(5);
+ }
+ setPreference(UserPreferenceNames.RECENT_RESOURCE_GROUPS, recentResourceGroups);
+ store(callback);
+ }
+
public int getPageRefreshInterval() {
if ((getPreference(UserPreferenceNames.PAGE_REFRESH_PERIOD) == null)
|| (Integer.valueOf(getPreference(UserPreferenceNames.PAGE_REFRESH_PERIOD)) == 60)) {//default to 60 seconds
@@ -158,6 +200,23 @@ public class UserPreferences {
}
}
+ public List<Integer> getPreferenceAsIntegerList(String key) {
+ try {
+ List<String> value = getPreferenceAsList(key);
+ List<Integer> result = new ArrayList<Integer>(value.size());
+ for (String aValue : value) {
+ String trimmed = aValue.trim();
+ if (trimmed.length() > 0) {
+ Integer intValue = Integer.valueOf(trimmed);
+ result.add(intValue);
+ }
+ }
+ return result;
+ } catch (Exception e) {
+ return new ArrayList<Integer>();
+ }
+ }
+
public Integer getPreferenceAsInteger(String key) {
String pref = null;
try {
13 years, 3 months