Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2020-01-06 22:59:19 +0000
committerRyan D. Brooks2020-12-15 21:40:43 +0000
commit5adce00bb1a5a47309ca33a23d1307c375c6e5ff (patch)
tree13199312665168519481d7022dd43571e5e61f0e
parent5dc0224fba95d9b8087564a11f5eb6d0b7a66a68 (diff)
downloadorg.eclipse.osee-5adce00bb1a5a47309ca33a23d1307c375c6e5ff.tar.gz
org.eclipse.osee-5adce00bb1a5a47309ca33a23d1307c375c6e5ff.tar.xz
org.eclipse.osee-5adce00bb1a5a47309ca33a23d1307c375c6e5ff.zip
refactor: Replace redundant code with OseeClient.getOseeApplicationServer
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java3
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java6
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurndownButton.java3
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurnupButton.java6
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintDataTableButton.java6
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintSummaryButton.java3
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java17
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/OseeClientProperties.java17
-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/OseeClient.java22
-rw-r--r--plugins/org.eclipse.osee.jdbc/src/org/eclipse/osee/jdbc/JdbcClientBuilder.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java6
13 files changed, 58 insertions, 55 deletions
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
index 1c616e2e45b..099e15998bd 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
@@ -45,6 +45,7 @@ import org.eclipse.osee.account.rest.model.AccountSessionDetailsData;
import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.account.rest.model.SubscriptionData;
import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.OseeClient;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
@@ -71,7 +72,7 @@ public class AccountClientImpl implements AccountClient {
client = JaxRsClient.newBuilder().properties(properties).build();
String address = properties != null ? (String) properties.get(OSEE_APPLICATION_SERVER) : null;
if (address == null) {
- address = System.getProperty(OSEE_APPLICATION_SERVER, "");
+ address = OseeClient.getOseeApplicationServer();
}
baseUri = UriBuilder.fromUri(address).build();
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java
index 4644b68ee1a..184f79b2f5d 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigEndpointApi.java
@@ -95,7 +95,11 @@ public interface AtsConfigEndpointApi {
@Produces(MediaType.APPLICATION_JSON)
public XResultData alive();
- @PUT
+ /**
+ * Create an new OSEE database instance with ATS configured for demo (additional demo data will be moved from client
+ * at a later date). This includes the ORCS calls to create the database schema and the system and demo branches.
+ */
+ @POST
@Path("init/demo")
@Produces(MediaType.APPLICATION_JSON)
public XResultData demoDbInit();
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurndownButton.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurndownButton.java
index 685d6b79bdb..555123ddc8e 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurndownButton.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurndownButton.java
@@ -28,8 +28,7 @@ public class XOpenSprintBurndownButton extends AbstractXOpenSprintBurnupButton {
@Override
public String getUrl() {
- return System.getProperty(
- OseeClient.OSEE_APPLICATION_SERVER) + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/burndown/chart/ui";
+ return OseeClient.getOseeApplicationServer() + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/burndown/chart/ui";
};
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurnupButton.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurnupButton.java
index 26f953665a5..022f0dbae32 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurnupButton.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintBurnupButton.java
@@ -28,8 +28,6 @@ public class XOpenSprintBurnupButton extends AbstractXOpenSprintBurnupButton {
@Override
public String getUrl() {
- return System.getProperty(
- OseeClient.OSEE_APPLICATION_SERVER) + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/burnup/chart/ui";
+ return OseeClient.getOseeApplicationServer() + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/burnup/chart/ui";
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintDataTableButton.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintDataTableButton.java
index 3f1d03b78b8..d34c82367f7 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintDataTableButton.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintDataTableButton.java
@@ -33,8 +33,6 @@ public class XOpenSprintDataTableButton extends AbstractXOpenSprintBurnupButton
@Override
public String getUrl() {
- return System.getProperty(
- OseeClient.OSEE_APPLICATION_SERVER) + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/data/table";
+ return OseeClient.getOseeApplicationServer() + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/data/table";
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintSummaryButton.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintSummaryButton.java
index 6eb907fef59..b03b1ff218a 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintSummaryButton.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/agile/XOpenSprintSummaryButton.java
@@ -33,8 +33,7 @@ public class XOpenSprintSummaryButton extends AbstractXOpenSprintBurnupButton {
@Override
public String getUrl() {
- return System.getProperty(
- OseeClient.OSEE_APPLICATION_SERVER) + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/summary";
+ return OseeClient.getOseeApplicationServer() + "/ats/agile/team/" + getAgileTeam().getIdString() + "/sprint/" + sprint.getIdString() + "/summary";
}
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
index 73422f7a56a..0c900ea66e3 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
@@ -44,6 +44,7 @@ import org.eclipse.osee.framework.jdk.core.result.XResultData;
import org.eclipse.osee.framework.jdk.core.result.table.ExampleTableData;
import org.eclipse.osee.framework.jdk.core.type.ViewModel;
import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.orcs.OrcsAdmin;
import org.eclipse.osee.orcs.OrcsApi;
/**
@@ -210,14 +211,24 @@ public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
@Override
public XResultData demoDbInit() {
- XResultData rd = new XResultData();
+ OrcsAdmin adminOps = orcsApi.getAdminOps();
+ String types = OseeInf.getResourceContents("orcsTypes/OseeTypes_ATS.osee", getClass());
+ types += OseeInf.getResourceContents("orcsTypes/OseeTypes_Demo.osee", getClass());
+
+ adminOps.createDatastoreAndSystemBranches(types);
+ adminOps.createDemoBranches();
+
+ XResultData atsResults = atsDbInit();
+
+ XResultData demoResults = new XResultData();
try {
AtsDbConfigDemoOp config = new AtsDbConfigDemoOp(atsApi);
config.run();
} catch (Exception ex) {
- rd.error(Lib.exceptionToString(ex));
+ demoResults.error(Lib.exceptionToString(ex));
}
- return rd;
+ atsResults.addRaw(demoResults.toString());
+ return atsResults;
}
@Override
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 9e54c6e9087..8f39fa3a768 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
@@ -14,7 +14,6 @@
package org.eclipse.osee.framework.core.client;
import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
-import org.eclipse.osee.orcs.rest.client.OseeClient;
/**
* @author Roberto E. Escobar
@@ -84,20 +83,6 @@ 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.
- * </pre>
- *
- * <b>Format: </b> <code>http://address:port</code>
- *
- * @param application server URL to use
- */
- public static void setOseeApplicationServer(String value) {
- System.setProperty(OseeClient.OSEE_APPLICATION_SERVER, value);
- }
-
- /**
- * <pre>
* Retrieves the application server address and port to use. When specified, this system property sets the URL used to reference
* the application server.
* </pre>
@@ -107,7 +92,7 @@ public class OseeClientProperties extends OseeProperties {
* @return application server URL
*/
public static String getOseeApplicationServer() {
- return getProperty(OseeClient.OSEE_APPLICATION_SERVER, "http://localhost:8089");
+ return org.eclipse.osee.framework.core.data.OseeClient.getOseeApplicationServer();
}
private static String getProperty(String name) {
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 2537c9a78d8..445d7e25440 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
@@ -14,13 +14,12 @@
package org.eclipse.osee.framework.core.server.internal;
import java.io.ByteArrayInputStream;
-import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
-import java.net.UnknownHostException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
+import org.eclipse.osee.framework.core.data.OseeClient;
import org.eclipse.osee.framework.core.data.OseeCodeVersion;
import org.eclipse.osee.framework.core.data.OseeServerInfo;
import org.eclipse.osee.framework.core.operation.Operations;
@@ -96,12 +95,8 @@ public class ApplicationServerManager implements IApplicationServerManager {
}
private static OseeServerInfo createOseeServerInfo(Log logger, ApplicationServerDataStore dataStore, String... defaultVersions) {
- String serverAddress = "127.0.0.1";
- try {
- serverAddress = InetAddress.getLocalHost().getCanonicalHostName();
- } catch (UnknownHostException ex) {
- //
- }
+ String serverAddress = OseeClient.getOseeApplicationServer();
+
int port = OseeServerProperties.getOseeApplicationServerPort();
String scheme = OseeServerProperties.getOseeApplicationServerScheme();
URI uri = null;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java
index 7c784dc78aa..041cca6e58b 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java
@@ -13,6 +13,9 @@
package org.eclipse.osee.framework.core.data;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
/**
* @author Donald G. Dunne
*/
@@ -22,14 +25,29 @@ public class OseeClient {
public static final String OSEE_APPLICATION_SERVER_DATA = "osee.application.server.data";
public static final int PORT = 8089;
public static final String DEFAULT_URL = "http://localhost:" + PORT;
+ private static String oseeServerUrl;
public static final String OSEE_ACCOUNT_ID = "osee.account.id";
private OseeClient() {
// utility class
}
- public static String getOseeApplicationServer() {
- return System.getProperty(OSEE_APPLICATION_SERVER, DEFAULT_URL);
+ public static synchronized String getOseeApplicationServer() {
+ if (oseeServerUrl == null) {
+ oseeServerUrl = System.getProperty(OSEE_APPLICATION_SERVER);
+ if (oseeServerUrl == null) {
+ try {
+ oseeServerUrl = InetAddress.getLocalHost().getCanonicalHostName();
+ } catch (UnknownHostException ex) {
+ oseeServerUrl = DEFAULT_URL;
+ }
+ }
+ }
+ return oseeServerUrl;
+ }
+
+ public static String getOseeApplicationServerData() {
+ return System.getProperty(OSEE_APPLICATION_SERVER_DATA);
}
public static int getPort() {
diff --git a/plugins/org.eclipse.osee.jdbc/src/org/eclipse/osee/jdbc/JdbcClientBuilder.java b/plugins/org.eclipse.osee.jdbc/src/org/eclipse/osee/jdbc/JdbcClientBuilder.java
index 625e0372468..034e15cec23 100644
--- a/plugins/org.eclipse.osee.jdbc/src/org/eclipse/osee/jdbc/JdbcClientBuilder.java
+++ b/plugins/org.eclipse.osee.jdbc/src/org/eclipse/osee/jdbc/JdbcClientBuilder.java
@@ -13,9 +13,9 @@
package org.eclipse.osee.jdbc;
-import static org.eclipse.osee.jdbc.JdbcConstants.JDBC_SERVER__LOCAL_CONNECTIONS;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.framework.core.data.OseeClient;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jdbc.JdbcConstants.JdbcDriverType;
import org.eclipse.osee.jdbc.JdbcConstants.PoolExhaustedAction;
@@ -33,7 +33,7 @@ import org.eclipse.osee.jdbc.internal.SimpleConnectionProvider;
/**
* Class used to configure and build JdbcClient instances. JdbcClients for a particular database only needs to be
* created once. Clients are thread-safe. Database connections are typically managed by a connection pool.
- *
+ *
* @author Roberto E. Escobar
*/
public final class JdbcClientBuilder extends JdbcClientConfig {
@@ -292,10 +292,8 @@ public final class JdbcClientBuilder extends JdbcClientConfig {
public JdbcClientBuilder fromType(JdbcDriverType type, String db, String host, int port) {
dbDriver(type.getDriver());
- String dbHost = host;
- if (JdbcDriverType.hsql == type && !Strings.isValid(dbHost)) {
- dbHost = JDBC_SERVER__LOCAL_CONNECTIONS;
- }
+ String dbHost = OseeClient.getOseeApplicationServer();
+
dbUri(type.getUriFormat(), type.getPrefix(), dbHost, port, db);
switch (type) {
@@ -318,5 +316,4 @@ public final class JdbcClientBuilder extends JdbcClientConfig {
}
return this;
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
index c0e6c2ac419..afe47d2840b 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
@@ -36,8 +36,6 @@ import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
*/
public interface OseeClient {
- String OSEE_APPLICATION_SERVER = org.eclipse.osee.framework.core.data.OseeClient.OSEE_APPLICATION_SERVER;
-
QueryBuilder createQueryBuilder(BranchId branch);
BranchEndpoint getBranchEndpoint();
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index 056cc605745..23d7382af9d 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -85,10 +85,10 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
public void update(Map<String, Object> properties) {
client = JaxRsClient.newBuilder().properties(properties).build();
- String address = properties != null ? (String) properties.get(OSEE_APPLICATION_SERVER) : null;
+ String address = properties != null ? (String) properties.get(
+ org.eclipse.osee.framework.core.data.OseeClient.OSEE_APPLICATION_SERVER) : null;
if (address == null) {
- address =
- System.getProperty(OSEE_APPLICATION_SERVER, org.eclipse.osee.framework.core.data.OseeClient.DEFAULT_URL);
+ address = org.eclipse.osee.framework.core.data.OseeClient.getOseeApplicationServer();
}
if (Strings.isValid(address)) {
orcsUri = UriBuilder.fromUri(address).path("orcs").build();

Back to the top