bug[ats_ATS21609]: Server showing Unavailable in OSEE Configuration
Change-Id: Id407c6731fc86a31fbd471f4d06e3b1ca8c0fd37
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ApplicationServer.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ApplicationServer.java
deleted file mode 100644
index e0177d1..0000000
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ApplicationServer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.client.internal;
-
-import org.eclipse.osee.framework.core.data.OseeServerInfo;
-
-public class ApplicationServer extends OseeServer {
- private OseeServerInfo serverInfo;
- private String serverAddress;
-
- public ApplicationServer() {
- super("Application Server");
- }
-
- public boolean isServerInfoValid() {
- return serverInfo != null;
- }
-
- public OseeServerInfo getServerInfo() {
- return serverInfo;
- }
-
- public void setServerInfo(OseeServerInfo serverInfo) {
- this.serverInfo = serverInfo;
- this.serverAddress = null;
- }
-
- public String getServerAddress() {
- if (serverAddress == null && serverInfo != null) {
- serverAddress = serverInfo.getUri().toString();
- }
- return serverAddress;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeApplicationServer.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeApplicationServer.java
deleted file mode 100644
index d0cc174..0000000
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeApplicationServer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.client.internal;
-
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
-import org.eclipse.osee.framework.core.data.OseeCodeVersion;
-import org.eclipse.osee.framework.core.data.OseeServerInfo;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Andrew M. Finkbeiner
- * @author Donald G. Dunne
- */
-public class OseeApplicationServer {
-
- private static final ApplicationServer applicationServer = new ApplicationServer();
-
- private OseeApplicationServer() {
- // private constructor
- }
-
- public static String getOseeApplicationServer() throws OseeCoreException {
- checkAndUpdateStatus();
- String serverAddress = applicationServer.getServerAddress();
- Conditions.checkNotNull(serverAddress, "resource server address");
- return serverAddress;
- }
-
- private synchronized static void checkAndUpdateStatus() {
- if (!applicationServer.isServerInfoValid()) {
- OseeServerInfo serverInfo = null;
- String appServerUri = OseeClientProperties.getOseeApplicationServer();
- if (Strings.isValid(appServerUri)) {
- try {
- serverInfo =
- new OseeServerInfo(applicationServer.getServerAddress(), appServerUri,
- new String[] {OseeCodeVersion.getVersion()}, new Timestamp(new Date().getTime()), true);
- } catch (Exception ex) {
- OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex);
- applicationServer.set(Level.SEVERE, ex, "Error parsing server property [%s]", appServerUri);
- }
- }
- applicationServer.setServerInfo(serverInfo);
- }
- applicationServer.report();
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeServer.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeServer.java
deleted file mode 100644
index bab951a..0000000
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeServer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.client.internal;
-
-import java.util.logging.Level;
-import org.eclipse.osee.framework.logging.BaseStatus;
-import org.eclipse.osee.framework.logging.IHealthStatus;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-public abstract class OseeServer {
-
- private final String name;
- private IHealthStatus status;
-
- public OseeServer(String serverName) {
- this.name = serverName;
- }
-
- public void set(Level level, Exception ex, String message, Object... args) {
- Level myLevel = level;
- if (myLevel == null) {
- myLevel = Level.INFO;
- }
- status = new BaseStatus(getName(), myLevel, ex, message, args);
- }
-
- public String getName() {
- return name;
- }
-
- public void report() {
- if (status == null) {
- status = new BaseStatus(name, Level.INFO, null, (Throwable) null);
- }
- OseeLog.reportStatus(new BaseStatus(name, status.getLevel(), status.getException(), "%s: %s %s",
- status.getLevel(), status.getMessage(),
- (status.getException() != null ? "[" + status.getException().getLocalizedMessage() + "]" : "")));
- OseeLog.log(OseeApplicationServer.class, status.getLevel(), status.getMessage(), status.getException());
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/server/HttpUrlBuilderClient.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/server/HttpUrlBuilderClient.java
index 6fe914a..7fc4462 100644
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/server/HttpUrlBuilderClient.java
+++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/server/HttpUrlBuilderClient.java
@@ -15,8 +15,8 @@
import java.util.Map;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.client.CoreClientConstants;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.client.internal.CoreClientActivator;
-import org.eclipse.osee.framework.core.client.internal.OseeApplicationServer;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.database.core.OseeInfo;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -62,7 +62,7 @@
}
public String getApplicationServerPrefix() throws OseeCoreException {
- String address = OseeApplicationServer.getOseeApplicationServer();
+ String address = OseeClientProperties.getOseeApplicationServer();
return normalize(address);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeServicesStatusContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeServicesStatusContributionItem.java
deleted file mode 100644
index 00e754a..0000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeServicesStatusContributionItem.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import org.eclipse.osee.framework.logging.IHealthStatus;
-import org.eclipse.osee.framework.logging.IStatusListener;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.OseeStatusContributionItem;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.OverlayImage;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeServicesStatusContributionItem extends OseeStatusContributionItem implements IStatusListener {
- private static final String ID = "osee.service.status";
- private static final Image DISABLED_IMAGE = new OverlayImage(
- ImageManager.getImage(FrameworkImage.APPLICATION_SERVER),
- ImageManager.getImageDescriptor(FrameworkImage.SLASH_RED_OVERLAY)).createImage();
-
- private static String errorMessage;
- private static String okMessage;
-
- public OseeServicesStatusContributionItem() {
- super(ID);
- errorMessage = null;
- okMessage = null;
- updateStatus(true);
- OseeLog.register(this);
- }
-
- @Override
- public void dispose() {
- OseeLog.deregister(this);
- super.dispose();
- }
-
- @Override
- protected Image getDisabledImage() {
- return DISABLED_IMAGE;
- }
-
- @Override
- protected String getDisabledToolTip() {
- return errorMessage;
- }
-
- @Override
- protected Image getEnabledImage() {
- return ImageManager.getImage(FrameworkImage.APPLICATION_SERVER);
- }
-
- @Override
- protected String getEnabledToolTip() {
- return okMessage;
- }
-
- @Override
- public void onStatus(final IHealthStatus status) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (status.isOk()) {
- okMessage = status.getMessage();
- } else {
- Throwable error = status.getException();
- errorMessage = error != null ? error.getLocalizedMessage() : "Undefined Error";
- }
- updateStatus(status.isOk());
- }
- });
-
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeStatusContributionItemFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeStatusContributionItemFactory.java
index 7025e52..8403a4f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeStatusContributionItemFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeStatusContributionItemFactory.java
@@ -33,7 +33,6 @@
createItem(manager, OseeBuildTypeContributionItem.class);
createItem(manager, ResServiceContributionItem.class);
createItem(manager, AdminContributionItem.class);
- createItem(manager, OseeServicesStatusContributionItem.class);
createItem(manager, SessionContributionItem.class);
}
@@ -54,8 +53,8 @@
object.dispose();
}
} catch (Exception ex) {
- OseeLog.logf(Activator.class, Level.SEVERE,
- ex, "Error creating status line contribution item [%s]", contribClazz);
+ OseeLog.logf(Activator.class, Level.SEVERE, ex, "Error creating status line contribution item [%s]",
+ contribClazz);
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
index 163fdef..3851de7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
@@ -14,11 +14,11 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.data.OseeCodeVersion;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
import org.eclipse.osee.framework.logging.IHealthStatus;
-import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
@@ -91,7 +91,7 @@
try {
generatePage();
} catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
}
}
});
@@ -128,6 +128,13 @@
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
+ try {
+ builder.append("<tr><td><b>OSEE Application Server</b></td><td colspan=2>" + OseeClientProperties.getOseeApplicationServer() + "</td></tr>");
+ } catch (NullPointerException ex) {
+ builder.append("<tr><td><b>OSEE Application Server</b></td><td colspan=2><font color=\"red\"><b>WARNING: " + ex.getLocalizedMessage() + "</b></font></td></tr>");
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+
builder.append(AHTML.addRowMultiColumnTable("<b>OSEE Client Build Type</b>", buildType,
wasSuccessful ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));