form.setWidth100();
form.setExtraSpace(15);
form.setIsGroup(true);
form.setGroupTitle(MSG.view_admin_systemSettings_serverDetails());
final StaticTextItem productName = new StaticTextItem("productname",
MSG.view_admin_systemSettings_serverDetails_productName());
final StaticTextItem productVersion = new StaticTextItem("productversion", MSG.common_title_version());
final StaticTextItem productBuildNumber = new StaticTextItem("productbuild",
MSG.view_admin_systemSettings_serverDetails_buildNumber());
final StaticTextItem serverName = new StaticTextItem("servername",
MSG.view_admin_systemSettings_serverDetails_serverName());
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 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());
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());
productName.setWrapTitle(false);
productVersion.setWrapTitle(false);
productBuildNumber.setWrapTitle(false);
serverName.setWrapTitle(false);
serverTimezone.setWrapTitle(false);
serverTime.setWrapTitle(false);
serverInstallDir.setWrapTitle(false);
dbUrl.setWrapTitle(false);
dbProductName.setWrapTitle(false);
dbProductVersion.setWrapTitle(false);
dbDriverName.setWrapTitle(false);
dbDriverVersion.setWrapTitle(false);
form.setItems(productName, productVersion, productBuildNumber, serverName, serverTimezone, serverTime,
serverInstallDir, dbUrl, dbProductName, dbProductVersion, dbDriverName, dbDriverVersion);
GWTServiceLookup.getSystemService().getServerDetails(new AsyncCallback<ServerDetails>() {
@Override
public void onSuccess(ServerDetails result) {
ProductInfo productInfo = result.getProductInfo();
form.setValue(productName.getName(), productInfo.getName());
form.setValue(productVersion.getName(), productInfo.getVersion());
form.setValue(productBuildNumber.getName(), productInfo.getBuildNumber()
+ (CoreGUI.isRHQ() ? " (<a target='_blank' href='https://github.com/rhq-project/rhq/commit/"
+ productInfo.getBuildNumber() + "'>GitHub</a>)" : ""));
Map<Detail, String> details = result.getDetails();
form.setValue(serverName.getName(), details.get(ServerDetails.Detail.SERVER_IDENTITY));
form.setValue(serverTimezone.getName(), details.get(ServerDetails.Detail.SERVER_TIMEZONE));
form.setValue(serverTime.getName(), details.get(ServerDetails.Detail.SERVER_LOCAL_TIME));
form.setValue(serverInstallDir.getName(), details.get(ServerDetails.Detail.SERVER_INSTALL_DIR));
form.setValue(dbUrl.getName(), details.get(ServerDetails.Detail.DATABASE_CONNECTION_URL));
form.setValue(dbProductName.getName(), details.get(ServerDetails.Detail.DATABASE_PRODUCT_NAME));
form.setValue(dbProductVersion.getName(), details.get(ServerDetails.Detail.DATABASE_PRODUCT_VERSION));
form.setValue(dbDriverName.getName(), details.get(ServerDetails.Detail.DATABASE_DRIVER_NAME));
form.setValue(dbDriverVersion.getName(), details.get(ServerDetails.Detail.DATABASE_DRIVER_VERSION));
}
@Override
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_admin_systemSettings_cannotLoadServerDetails(), caught);