Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-11-14 21:55:04 +0000
committerGerrit Code Review @ Eclipse.org2013-12-04 18:05:11 +0000
commit591706db2db166a4d3cd6b4b2f7d2885d7265c62 (patch)
tree013fc47ccbc420434edb9ad41ee2f28c17c411f1
parentc1c1d3d3113031df4e9661e25e16ffab2c963134 (diff)
downloadorg.eclipse.osee-591706db2db166a4d3cd6b4b2f7d2885d7265c62.tar.gz
org.eclipse.osee-591706db2db166a4d3cd6b4b2f7d2885d7265c62.tar.xz
org.eclipse.osee-591706db2db166a4d3cd6b4b2f7d2885d7265c62.zip
feature[ats_SHB3P]: Remove arbitration code
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ArbitrationServer.java86
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/OseeApplicationServer.java21
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/server/HttpUrlBuilderClient.java15
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookup.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookupProvider.java21
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerDataStore.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerLookup.java69
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerManager.java11
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java1
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml1
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ServerLookupServlet.java101
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml9
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java143
15 files changed, 35 insertions, 528 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java
index d967a760ed6..6bc726108db 100644
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java
+++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java
@@ -33,7 +33,6 @@ public class OseeClientProperties extends OseeProperties {
private static final String HEADER_TAG = "OSEE-Client-Property-Init";
private static final String OSEE_APPLICATION_SERVER = "osee.application.server";
- private static final String OSEE_ARBITRATION_SERVER = "osee.arbitration.server";
private static final String OSEE_LOCAL_APPLICATION_SERVER = "osee.local.application.server";
private static final String OSEE_LOCAL_HTTP_WORKER_PORT = "osee.local.http.worker.port";
@@ -177,12 +176,12 @@ public class OseeClientProperties extends OseeProperties {
/**
* <pre>
* Sets the application server address and port to use. This system property sets the URL used to reference
- * the application server. Arbitration is bypassed.
+ * the application server.
* </pre>
*
* <b>Format: </b> <code>http://address:port</code>
*
- * @param application server URL to use instead going through the arbitration server
+ * @param application server URL to use
*/
public static void setOseeApplicationServer(String value) {
System.setProperty(OSEE_APPLICATION_SERVER, value);
@@ -191,32 +190,17 @@ public class OseeClientProperties extends OseeProperties {
/**
* <pre>
* Retrieves the application server address and port to use. When specified, this system property sets the URL used to reference
- * the application server. Arbitration is bypassed.
+ * the application server.
* </pre>
*
* <b>Format: </b> <code>http://address:port</code>
*
- * @return application server URL to use instead going through the arbitration server
+ * @return application server URL
*/
public static String getOseeApplicationServer() {
return getProperty(OSEE_APPLICATION_SERVER);
}
- /**
- * <pre>
- * Retrieves the arbitration server address and port to use. This system property must be specified for the system to
- * gain access to OSEE data. If the application server property is set then that address takes precedence and
- * arbitration is bypassed.
- * </pre>
- *
- * <b>Format: </b> <code>http://address:port</code>
- *
- * @return default arbitration server URL to set preferences.
- */
- public static String getOseeArbitrationServer() {
- return getProperty(OSEE_ARBITRATION_SERVER);
- }
-
private static String getProperty(String name) {
return getProperty(name, "");
}
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ArbitrationServer.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ArbitrationServer.java
deleted file mode 100644
index 7a683cd8567..00000000000
--- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ArbitrationServer.java
+++ /dev/null
@@ -1,86 +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.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
-import org.eclipse.osee.framework.core.data.OseeCodeVersion;
-import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.data.OseeServerInfo;
-import org.eclipse.osee.framework.core.util.HttpProcessor;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-public class ArbitrationServer extends OseeServer {
-
- private static final int TEN_SEC_TIMEOUT = 1000 * 10;
-
- public ArbitrationServer() {
- super("Arbitration Server");
- }
-
- public OseeServerInfo getViaArbitration() {
- OseeServerInfo serverInfo = null;
- resetStatus();
- ByteArrayOutputStream outputStream = null;
- AcquireResult result = null;
- try {
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("version", OseeCodeVersion.getVersion());
- String url =
- HttpUrlBuilderClient.getInstance().getOsgiArbitrationServiceUrl(OseeServerContext.LOOKUP_CONTEXT,
- parameters);
-
- outputStream = new ByteArrayOutputStream();
- result = HttpProcessor.acquire(new URL(url), outputStream, TEN_SEC_TIMEOUT);
- setAlive(true);
- set(Level.INFO, null, HttpUrlBuilderClient.getInstance().getArbitrationServerPrefix());
- if (result.getCode() == HttpURLConnection.HTTP_OK) {
- serverInfo = getServerInfo(outputStream, result);
- } else {
- String arbitrationServerMessage = result.getResult();
- if (Strings.isValid(arbitrationServerMessage)) {
- set(Level.SEVERE, null, arbitrationServerMessage);
- } else {
- set(Level.SEVERE, null, "Error requesting application server for version [%s]",
- OseeCodeVersion.getVersion());
- }
- }
- } catch (Exception ex) {
- OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex);
- set(Level.SEVERE, ex, "Error connecting to arbitration server - [%s]", ex.getLocalizedMessage());
- } finally {
- Lib.close(outputStream);
- }
- return serverInfo;
- }
-
- private OseeServerInfo getServerInfo(ByteArrayOutputStream outputStream, AcquireResult result) {
- OseeServerInfo serverInfo = null;
- try {
- ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
- serverInfo = OseeServerInfo.fromXml(inputStream);
- } catch (Exception ex) {
- OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex);
- set(Level.SEVERE, ex, "Error parsing arbitration server response - [%s]", ex.getLocalizedMessage());
- }
- return serverInfo;
- }
-
-}
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
index 435ee995eed..893e2cf142d 100644
--- 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
@@ -15,6 +15,7 @@ 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;
@@ -27,7 +28,6 @@ import org.eclipse.osee.framework.logging.OseeLog;
*/
public class OseeApplicationServer {
- private static final ArbitrationServer arbitrationServer = new ArbitrationServer();
private static final ApplicationServer applicationServer = new ApplicationServer();
private OseeApplicationServer() {
@@ -35,7 +35,6 @@ public class OseeApplicationServer {
}
public static void reset() {
- arbitrationServer.resetStatus();
applicationServer.resetStatus();
applicationServer.setServerInfo(null);
@@ -57,28 +56,20 @@ public class OseeApplicationServer {
if (!applicationServer.isServerInfoValid()) {
applicationServer.resetStatus();
OseeServerInfo serverInfo = null;
- String overrideValue = OseeClientProperties.getOseeApplicationServer();
- if (Strings.isValid(overrideValue)) {
- arbitrationServer.set(Level.INFO, null, "Arbitration Overridden");
+ String appServerUri = OseeClientProperties.getOseeApplicationServer();
+ if (Strings.isValid(appServerUri)) {
try {
serverInfo =
- new OseeServerInfo("OVERRIDE", overrideValue, new String[] {"OVERRIDE"}, new Timestamp(
- new Date().getTime()), true);
+ 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 arbitration server override [%s]", overrideValue);
- }
- } else {
- serverInfo = arbitrationServer.getViaArbitration();
- if (serverInfo == null) {
- applicationServer.set(Level.SEVERE, null, "Arbitration Server Error");
+ applicationServer.set(Level.SEVERE, ex, "Error parsing server property [%s]", appServerUri);
}
}
applicationServer.setServerInfo(serverInfo);
}
applicationServer.checkAlive();
-
- arbitrationServer.report();
applicationServer.report();
}
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 cef7e3ea216..6fe914ae27f 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,7 +15,6 @@ import java.io.UnsupportedEncodingException;
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;
@@ -67,11 +66,6 @@ public final class HttpUrlBuilderClient {
return normalize(address);
}
- public String getArbitrationServerPrefix() {
- String address = OseeClientProperties.getOseeArbitrationServer();
- return normalize(address);
- }
-
public String getPermanentBaseUrl() throws OseeCoreException {
String address = OseeInfo.getValue("osee.permanent.base.url");
return normalize(address);
@@ -113,15 +107,6 @@ public final class HttpUrlBuilderClient {
}
}
- public String getOsgiArbitrationServiceUrl(String context, Map<String, String> parameters) throws OseeCoreException {
- try {
- return HttpUrlBuilder.createURL(getArbitrationServerPrefix(), context, parameters);
- } catch (UnsupportedEncodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- return null; // unreachable since wrapAndThrow() always throws an exception
- }
- }
-
public String getPermanentLinkBaseUrl(String context, Map<String, String> parameters) throws OseeCoreException {
try {
return HttpUrlBuilder.createURL(getSelectedPermanenrLinkUrl(), context, parameters);
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookup.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookup.java
index f2ea180b63a..914c6ff23e7 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookup.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookup.java
@@ -21,6 +21,4 @@ public interface IApplicationServerLookup {
public Collection<OseeServerInfo> getAvailableServers() throws OseeCoreException;
- public OseeServerInfo getServerInfoBy(String version) throws OseeCoreException;
-
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookupProvider.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookupProvider.java
deleted file mode 100644
index ee48fdc79c0..00000000000
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/IApplicationServerLookupProvider.java
+++ /dev/null
@@ -1,21 +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.server;
-
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IApplicationServerLookupProvider {
-
- IApplicationServerLookup getApplicationServerLookupService() throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerDataStore.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerDataStore.java
index 0d5486bf82a..f0fb871d182 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerDataStore.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerDataStore.java
@@ -33,9 +33,6 @@ import org.eclipse.osee.logger.Log;
*/
public class ApplicationServerDataStore {
- private static final String GET_NUMBER_OF_SESSIONS =
- "SELECT count(1) FROM osee_session WHERE managed_by_server_id = ?";
-
private static final String SELECT_FROM_LOOKUP_TABLE =
"SELECT * FROM osee_server_lookup ORDER BY server_uri desc, version_id desc";
@@ -58,20 +55,20 @@ public class ApplicationServerDataStore {
return dbService;
}
- public void create(Iterable<? extends OseeServerInfo> infos) throws OseeCoreException {
- executeTx(TxType.CREATE, infos);
+ public void create(OseeServerInfo info) throws OseeCoreException {
+ executeTx(TxType.CREATE, info);
}
- public void update(Iterable<? extends OseeServerInfo> infos) throws OseeCoreException {
- executeTx(TxType.UPDATE, infos);
+ public void update(OseeServerInfo info) throws OseeCoreException {
+ executeTx(TxType.UPDATE, info);
}
- public void delete(Iterable<? extends OseeServerInfo> infos) throws OseeCoreException {
- executeTx(TxType.DELETE, infos);
+ public void delete(OseeServerInfo info) throws OseeCoreException {
+ executeTx(TxType.DELETE, info);
}
- private void executeTx(TxType op, Iterable<? extends OseeServerInfo> infos) throws OseeCoreException {
- IDbTransactionWork tx = new ServerLookupTx(getDbService(), op, infos);
+ private void executeTx(TxType op, OseeServerInfo info) throws OseeCoreException {
+ IDbTransactionWork tx = new ServerLookupTx(getDbService(), op, info);
DatabaseTransactions.execute(getDbService(), getDbService().getConnection(), tx);
}
@@ -131,10 +128,6 @@ public class ApplicationServerDataStore {
}
}
- public int getNumberOfSessions(String serverId) throws OseeCoreException {
- return getDbService().runPreparedQueryFetchObject(0, GET_NUMBER_OF_SESSIONS, serverId);
- }
-
private static enum TxType {
CREATE,
UPDATE,
@@ -149,13 +142,13 @@ public class ApplicationServerDataStore {
private static final String DELETE_FROM_LOOKUP_TABLE_BY_ID = "DELETE FROM osee_server_lookup WHERE server_id = ?";
private final TxType txType;
- private final Iterable<? extends OseeServerInfo> datas;
+ private final OseeServerInfo data;
private final IOseeDatabaseService dbService;
- public ServerLookupTx(IOseeDatabaseService dbService, TxType txType, Iterable<? extends OseeServerInfo> datas) {
+ public ServerLookupTx(IOseeDatabaseService dbService, TxType txType, OseeServerInfo data) {
this.dbService = dbService;
this.txType = txType;
- this.datas = datas;
+ this.data = data;
}
@Override
@@ -182,16 +175,14 @@ public class ApplicationServerDataStore {
private void create(OseeConnection connection) throws OseeCoreException {
List<Object[]> insertData = new ArrayList<Object[]>();
- for (OseeServerInfo data : datas) {
- String serverId = data.getServerId();
- URI serverUri = data.getUri();
- String uri = serverUri.toString();
- Timestamp dateStarted = data.getDateStarted();
- int acceptingRequests = data.isAcceptingRequests() ? 1 : 0;
-
- for (String version : data.getVersion()) {
- insertData.add(new Object[] {serverId, version, uri, dateStarted, acceptingRequests});
- }
+ String serverId = data.getServerId();
+ URI serverUri = data.getUri();
+ String uri = serverUri.toString();
+ Timestamp dateStarted = data.getDateStarted();
+ int acceptingRequests = data.isAcceptingRequests() ? 1 : 0;
+
+ for (String version : data.getVersion()) {
+ insertData.add(new Object[] {serverId, version, uri, dateStarted, acceptingRequests});
}
if (!insertData.isEmpty()) {
dbService.runBatchUpdate(connection, INSERT_LOOKUP_TABLE, insertData);
@@ -205,9 +196,7 @@ public class ApplicationServerDataStore {
private void delete(OseeConnection connection) throws OseeCoreException {
List<Object[]> deleteData = new ArrayList<Object[]>();
- for (OseeServerInfo data : datas) {
- deleteData.add(new Object[] {data.getServerId()});
- }
+ deleteData.add(new Object[] {data.getServerId()});
if (!deleteData.isEmpty()) {
dbService.runBatchUpdate(connection, DELETE_FROM_LOOKUP_TABLE_BY_ID, deleteData);
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerLookup.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerLookup.java
index c80ef0e1fdb..85ea7075938 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerLookup.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerLookup.java
@@ -12,16 +12,12 @@ package org.eclipse.osee.framework.core.server.internal;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.osee.framework.core.data.OseeServerInfo;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
import org.eclipse.osee.framework.core.util.HttpProcessor;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.logger.Log;
/**
@@ -80,71 +76,6 @@ public class ApplicationServerLookup implements IApplicationServerLookup {
return healthyServers;
}
- @Override
- public OseeServerInfo getServerInfoBy(String version) throws OseeCoreException {
- Collection<? extends OseeServerInfo> infos = getVersionCompatibleServers(version);
- Collection<OseeServerInfo> healthyServers = getHealthyServers(infos);
- return getBestAvailable(healthyServers);
- }
-
- public Collection<OseeServerInfo> getVersionCompatibleServers(String clientVersion) throws OseeCoreException {
- Set<OseeServerInfo> toReturn = new HashSet<OseeServerInfo>();
- if (Strings.isValid(clientVersion)) {
- Collection<? extends OseeServerInfo> infos = getDataStore().getAll();
- for (OseeServerInfo info : infos) {
- if (isServerCompatible(info, clientVersion)) {
- toReturn.add(info);
- }
- }
- }
- return toReturn;
- }
-
- private boolean isCompatibleVersion(String serverVersion, String clientVersion) {
- boolean result = false;
- if (serverVersion.equals(clientVersion)) {
- result = true;
- } else {
- result = clientVersion.matches(serverVersion);
- if (!result) {
- result = serverVersion.matches(clientVersion);
- }
- }
- return result;
- }
-
- private boolean isServerCompatible(OseeServerInfo info, String clientVersion) {
- boolean result = false;
- for (String version : info.getVersion()) {
- result = isCompatibleVersion(version, clientVersion);
- if (result) {
- break;
- }
- }
- return result;
- }
-
- private OseeServerInfo getBestAvailable(Collection<OseeServerInfo> infos) throws OseeCoreException {
- OseeServerInfo result = null;
- if (infos.size() == 1) {
- result = infos.iterator().next();
- } else {
- int minSessions = Integer.MAX_VALUE;
- for (OseeServerInfo info : infos) {
- try {
- int numberOfSessions = serverDataStore.getNumberOfSessions(info.getServerId());
- if (minSessions > numberOfSessions) {
- result = info;
- minSessions = numberOfSessions;
- }
- } catch (OseeDataStoreException ex) {
- logger.error(ex, "Error getting number of sessions");
- }
- }
- }
- return result;
- }
-
private boolean isServerAlive(OseeServerInfo info) {
return HttpProcessor.isAlive(info.getUri());
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerManager.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerManager.java
index c8fde546253..75122990b47 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerManager.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ApplicationServerManager.java
@@ -18,7 +18,6 @@ import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -236,7 +235,7 @@ public class ApplicationServerManager implements IApplicationServerManager {
OseeServerInfoMutable info = getApplicationServerInfo();
info.setAcceptingRequests(value);
if (PersistType.ALLOW_DB_PERSIST == persistType) {
- dataStore.update(Collections.singleton(info));
+ dataStore.update(info);
}
for (String contexts : oseeHttpServlets.keySet()) {
InternalOseeHttpServlet servlets = oseeHttpServlets.get(contexts);
@@ -341,7 +340,7 @@ public class ApplicationServerManager implements IApplicationServerManager {
OseeServerInfoMutable info = getApplicationServerInfo();
refreshData(info);
info.addVersion(version);
- dataStore.update(Collections.singleton(info));
+ dataStore.update(info);
}
@Override
@@ -356,7 +355,7 @@ public class ApplicationServerManager implements IApplicationServerManager {
boolean wasRemoved = versions.remove(version);
if (wasRemoved) {
info.setVersions(versions);
- dataStore.update(Collections.singleton(info));
+ dataStore.update(info);
} else {
throw new OseeStateException("Not part of the supported version [%s]", version);
}
@@ -365,7 +364,7 @@ public class ApplicationServerManager implements IApplicationServerManager {
private boolean deregisterWithDb(OseeServerInfo info) {
boolean status = false;
try {
- dataStore.delete(Collections.singleton(info));
+ dataStore.delete(info);
status = true;
} catch (OseeCoreException ex) {
getLogger().info("Server lookup table is not initialized");
@@ -376,7 +375,7 @@ public class ApplicationServerManager implements IApplicationServerManager {
private boolean registerWithDb(OseeServerInfo info) {
boolean status = false;
try {
- dataStore.create(Collections.singleton(info));
+ dataStore.create(info);
status = true;
} catch (OseeCoreException ex) {
getLogger().info("Server lookup table is not initialized");
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java
index 719dd2383fe..87b8141c800 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java
@@ -25,7 +25,6 @@ public class OseeServerContext {
public static final String SEARCH_TAGGING_CONTEXT = asAbsoluteContext("search/tagger");
public static final String RESOURCE_CONTEXT = asAbsoluteContext("resource");
public static final String SESSION_CONTEXT = asAbsoluteContext("session");
- public static final String LOOKUP_CONTEXT = asAbsoluteContext("server/lookup");
public static final String CLIENT_LOOPBACK_CONTEXT = asAbsoluteContext("client/loopback");
public static final String ARTIFACT_CONTEXT = asAbsoluteContext("artifact");
public static final String OSEE_MODEL_CONTEXT = asAbsoluteContext("model");
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
index 2b9f306d243..89a972f4a23 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
@@ -5,7 +5,6 @@
<reference bind="setHttpService" cardinality="1..1" interface="org.osgi.service.http.HttpService" name="HttpService" policy="static"/>
<reference bind="setSessionManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.ISessionManager" name="ISessionManager" policy="static"/>
- <reference bind="setServerLookup" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerLookup" name="IApplicationServerLookup" policy="static"/>
<reference bind="setAppServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/>
<reference bind="setTranslationService" cardinality="1..1" interface="org.eclipse.osee.framework.core.translation.IDataTranslationService" name="IDataTranslationService" policy="static"/>
<reference bind="setCaching" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="TempCachingService" policy="static"/>
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ServerLookupServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ServerLookupServlet.java
deleted file mode 100644
index 18a3964d452..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ServerLookupServlet.java
+++ /dev/null
@@ -1,101 +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.manager.servlet;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.eclipse.osee.framework.core.data.OseeServerInfo;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.logger.Log;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ServerLookupServlet extends UnsecuredOseeHttpServlet {
-
- private static final long serialVersionUID = -7055381632202456561L;
-
- private final IApplicationServerLookup lookupService;
- private final IApplicationServerManager applicationServerManager;
-
- public ServerLookupServlet(Log logger, IApplicationServerLookup lookupService, IApplicationServerManager applicationServerManager) {
- super(logger);
- this.lookupService = lookupService;
- this.applicationServerManager = applicationServerManager;
-
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- try {
- String version = request.getParameter("version");
- boolean wasBadRequest = false;
-
- OseeServerInfo info = null;
- if (Strings.isValid(version)) {
- version = version.trim();
- info = lookupService.getServerInfoBy(version);
- } else {
- wasBadRequest = true;
- }
-
- if (info == null) {
- response.setStatus(wasBadRequest ? HttpServletResponse.SC_BAD_REQUEST : HttpServletResponse.SC_NOT_FOUND);
- response.setContentType("text/plain");
- response.setCharacterEncoding("UTF-8");
- response.getWriter().write(
- String.format("Unable to locate application server matching version [%s]", version));
- response.getWriter().flush();
- response.getWriter().close();
- } else {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- info.write(stream);
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType("application/xml");
- response.setCharacterEncoding("UTF-8");
- response.setContentLength(stream.size());
- Lib.inputStreamToOutputStream(new ByteArrayInputStream(stream.toByteArray()), response.getOutputStream());
- response.getOutputStream().flush();
- }
- } catch (Exception ex) {
- getLogger().error(ex, "Failed to process application server lookup request [%s]", request.toString());
- response.getWriter().write(Lib.exceptionToString(ex));
- response.getWriter().flush();
- response.getWriter().close();
- }
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
- try {
- boolean isRegistrationToLookupTableRequested = Boolean.valueOf(request.getParameter("registerToLookup"));
- if (isRegistrationToLookupTableRequested) {
- boolean wasSuccessful = applicationServerManager.executeLookupRegistration();
- response.setStatus(wasSuccessful ? HttpServletResponse.SC_ACCEPTED : HttpServletResponse.SC_CONFLICT);
- response.setContentType("txt/plain");
- response.getWriter().write(
- String.format("Registration into server lookup was a [%s]", wasSuccessful ? "success" : "failure"));
- }
- } catch (Exception ex) {
- getLogger().error(ex, "Failed to process application server lookup request [%s]", request.toString());
- response.getWriter().write(Lib.exceptionToString(ex));
- }
- response.getWriter().flush();
- response.getWriter().close();
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
index fdbcc3b455e..9d6975cb8d1 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
@@ -14,7 +14,6 @@ import java.util.HashSet;
import java.util.Set;
import org.eclipse.osee.framework.core.data.OseeServerContext;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
import org.eclipse.osee.framework.core.server.IApplicationServerManager;
import org.eclipse.osee.framework.core.server.IAuthenticationManager;
import org.eclipse.osee.framework.core.server.ISessionManager;
@@ -34,7 +33,6 @@ import org.eclipse.osee.framework.manager.servlet.OseeModelServlet;
import org.eclipse.osee.framework.manager.servlet.ResourceManagerServlet;
import org.eclipse.osee.framework.manager.servlet.SearchEngineServlet;
import org.eclipse.osee.framework.manager.servlet.SearchEngineTaggerServlet;
-import org.eclipse.osee.framework.manager.servlet.ServerLookupServlet;
import org.eclipse.osee.framework.manager.servlet.SessionClientLoopbackServlet;
import org.eclipse.osee.framework.manager.servlet.SessionManagementServlet;
import org.eclipse.osee.framework.manager.servlet.SystemManagerServlet;
@@ -53,7 +51,6 @@ public class ServletRegistrationHandler {
private HttpService httpService;
private Log logger;
private ISessionManager sessionManager;
- private IApplicationServerLookup serverLookup;
private IApplicationServerManager appServerManager;
private IDataTranslationService translationService;
private TempCachingService caching;
@@ -68,10 +65,6 @@ public class ServletRegistrationHandler {
this.sessionManager = sessionManager;
}
- public void setServerLookup(IApplicationServerLookup serverLookup) {
- this.serverLookup = serverLookup;
- }
-
public void setAppServerManager(IApplicationServerManager appServerManager) {
this.appServerManager = appServerManager;
}
@@ -137,7 +130,6 @@ public class ServletRegistrationHandler {
register(new SearchEngineServlet(logger, sessionManager, translationService, orcsApi),
OseeServerContext.SEARCH_CONTEXT);
register(new SearchEngineTaggerServlet(logger, sessionManager, orcsApi), OseeServerContext.SEARCH_TAGGING_CONTEXT);
- register(new ServerLookupServlet(logger, serverLookup, appServerManager), OseeServerContext.LOOKUP_CONTEXT);
register(new SessionManagementServlet(logger, sessionManager, authenticationManager),
OseeServerContext.SESSION_CONTEXT);
register(new SessionClientLoopbackServlet(logger, sessionManager), OseeServerContext.CLIENT_LOOPBACK_CONTEXT);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 652f8c8b17c..124a7668c66 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -90,15 +90,6 @@
name="Editors">
</page>
</extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.osee.framework.ui.skynet.OseePreferencePage"
- class="org.eclipse.osee.framework.ui.skynet.preferences.ArbitrationServerPage"
- id="org.eclipse.osee.framework.ui.skynet.preferences.ArbitrationServerPreferences"
- name="Arbitration Server">
- </page>
- </extension>
<extension id="org.eclipse.osee.framework.ui.skynet" name="OSEE" point="org.eclipse.ui.views">
<view allowMultiple="true" category="osee.jdk.core.category" class="org.eclipse.osee.framework.ui.skynet.ArtifactExplorer" icon="images/artifact_explorer.gif" id="org.eclipse.osee.framework.ui.skynet.ArtifactExplorer" name="Artifact Explorer"/>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java
deleted file mode 100644
index 844842ca50d..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java
+++ /dev/null
@@ -1,143 +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.preferences;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
-import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
-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.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArbitrationServerPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- public ArbitrationServerPage() {
- super();
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite content = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- content.setLayout(layout);
- content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Group resourceGroup = new Group(content, SWT.NONE);
- resourceGroup.setLayout(new GridLayout());
- resourceGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- resourceGroup.setText("OSEE Arbitration");
-
- Composite resourceComposite = new Composite(resourceGroup, SWT.NONE);
- resourceComposite.setLayout(new GridLayout(2, false));
- resourceComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- boolean wasArbitrationOverriden = Strings.isValid(OseeClientProperties.getOseeApplicationServer());
- String defaultArbitrationServer = null;
- if (!wasArbitrationOverriden) {
- defaultArbitrationServer = HttpUrlBuilderClient.getInstance().getArbitrationServerPrefix();
- }
-
- String defaultApplicationServer = null;
- try {
- defaultApplicationServer = HttpUrlBuilderClient.getInstance().getApplicationServerPrefix();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
-
- List<Data> entries = new ArrayList<Data>();
-
- if (wasArbitrationOverriden) {
- entries.add(new Data("Arbitration", "Disabled", Displays.getSystemColor(SWT.COLOR_RED)));
- entries.add(new Data("Application Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
- } else {
- entries.add(new Data("Arbitration Server: ", defaultArbitrationServer != null ? defaultArbitrationServer : ""));
- entries.add(new Data("Version To Match: ", OseeCodeVersion.getVersion()));
- entries.add(new Data("Resolved To Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
- }
- for (Data entry : entries) {
- Label label1 = new Label(resourceComposite, SWT.NONE);
- label1.setForeground(entry.getLabelColor());
- label1.setText(entry.getLabelText());
-
- Label label2 = new Label(resourceComposite, SWT.NONE);
- label2.setForeground(entry.getDataColor());
- label2.setText(entry.getDataText());
- }
- return content;
- }
-
- @Override
- public void init(IWorkbench workbench) {
- setPreferenceStore(Activator.getInstance().getPreferenceStore());
- setDescription("See default Arbitration Server below.");
- }
-
- private final class Data {
- private final String label;
- private final Color labelColor;
- private final String value;
- private final Color valueColor;
-
- public Data(String label, Color labelColor, String value, Color valueColor) {
- super();
- this.label = label;
- this.labelColor = labelColor;
- this.value = value;
- this.valueColor = valueColor;
- }
-
- public Data(String label, String value, Color valueColor) {
- this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, valueColor);
- }
-
- public Data(String label, String value) {
- this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, Displays.getSystemColor(SWT.COLOR_BLACK));
- }
-
- public String getLabelText() {
- return label;
- }
-
- public Color getLabelColor() {
- return labelColor;
- }
-
- public String getDataText() {
- return value;
- }
-
- public Color getDataColor() {
- return valueColor;
- }
-
- }
-}

Back to the top