diff options
author | donald.g.dunne | 2016-12-14 19:04:53 +0000 |
---|---|---|
committer | David W. Miller | 2016-12-14 19:04:53 +0000 |
commit | 5815f3d3a35dc00ec2fc3869be8a4aca73cc4812 (patch) | |
tree | ce48ddf9f6ec0744af91c21c28ff38dee34568b5 /plugins | |
parent | cd7a2bb74c0e68336c9361e0d33870317b6cef3d (diff) | |
download | org.eclipse.osee-5815f3d3a35dc00ec2fc3869be8a4aca73cc4812.tar.gz org.eclipse.osee-5815f3d3a35dc00ec2fc3869be8a4aca73cc4812.tar.xz org.eclipse.osee-5815f3d3a35dc00ec2fc3869be8a4aca73cc4812.zip |
feature[ats_ATS331028]: Replace SessionManagementServlet
Change-Id: I14d02f7392deb2a07953e97acd83eb3f7d02eda6
Diffstat (limited to 'plugins')
62 files changed, 832 insertions, 812 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF index 1b2a7d17e52..7eab362a6da 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF @@ -97,6 +97,9 @@ Import-Package: com.google.common.collect, org.eclipse.osee.framework.logging, org.eclipse.osee.framework.plugin.core, org.eclipse.osee.framework.plugin.core.util, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.framework.server.ide.api.client.model, + org.eclipse.osee.framework.server.ide.api.model, org.eclipse.osee.framework.skynet.core, org.eclipse.osee.framework.skynet.core.artifact, org.eclipse.osee.framework.skynet.core.artifact.search, diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/AtsClientIntegrationTestSuite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/AtsClientIntegrationTestSuite.java index 1c4b3bdbd79..2ac4f471a70 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/AtsClientIntegrationTestSuite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/AtsClientIntegrationTestSuite.java @@ -16,7 +16,7 @@ import org.eclipse.osee.ats.client.integration.tests.DirtyArtifactCacheTest; import org.eclipse.osee.ats.client.integration.tests.framework.skynet.core.artifact.SkyentCoreArtifact_Suite; import org.eclipse.osee.ats.client.integration.tests.framework.ui.skynet.FrameworkUiSkynetTest_Suite; import org.eclipse.osee.ats.client.integration.tests.framework.ui.skynet.dialog.FrameworkUiSkynetTest_Dialog_Suite; -import org.eclipse.osee.ats.client.integration.tests.orcs.rest.ClientResourceTest; +import org.eclipse.osee.ats.client.integration.tests.orcs.rest.ClientEndpointTest; import org.eclipse.osee.ats.client.integration.tests.util.DbInitTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -28,7 +28,7 @@ import org.junit.runners.Suite; @Suite.SuiteClasses({ DbInitTest.class, DemoDbPopulateSuite.class, - ClientResourceTest.class, + ClientEndpointTest.class, AtsTest_AllAts_Suite.class, SkyentCoreArtifact_Suite.class, FrameworkUiSkynetTest_Suite.class, diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsClientService.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsClientService.java index 4ab8e0f7821..67b46d48e1f 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsClientService.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsClientService.java @@ -24,6 +24,7 @@ import org.eclipse.osee.ats.core.client.IAtsClient; import org.eclipse.osee.ats.core.client.workflow.WorkItemJsonReader; import org.eclipse.osee.ats.core.client.workflow.WorkItemsJsonReader; import org.eclipse.osee.framework.core.client.OseeClientProperties; +import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint; import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.JaxRsWebTarget; import org.eclipse.osee.orcs.rest.model.OrcsWriterEndpoint; @@ -46,6 +47,7 @@ public class AtsClientService { private static AtsNotifyEndpointApi notifyEp; private static AtsConfigEndpointApi configEp; private static AtsWorkPackageEndpointApi workPackageEp; + private static ClientEndpoint clientEp; public void setAtsClient(IAtsClient atsClient) { AtsClientService.atsClient = atsClient; @@ -146,4 +148,14 @@ public class AtsClientService { return workPackageEp; } + public static ClientEndpoint getClientEndpoint() { + if (clientEp == null) { + String appServer = OseeClientProperties.getOseeApplicationServer(); + String orcsUri = String.format("%s/ide", appServer); + JaxRsClient jaxRsClient = JaxRsClient.newBuilder().build(); + clientEp = jaxRsClient.target(orcsUri).newProxy(ClientEndpoint.class); + } + return clientEp; + } + } diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientEndpointTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientEndpointTest.java new file mode 100644 index 00000000000..85e337aa4f2 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientEndpointTest.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2014 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.ats.client.integration.tests.orcs.rest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import java.util.Collection; +import javax.ws.rs.core.Response; +import org.eclipse.osee.ats.client.integration.tests.AtsClientService; +import org.eclipse.osee.ats.demo.api.DemoUsers; +import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint; +import org.eclipse.osee.framework.server.ide.api.client.model.Sessions; +import org.eclipse.osee.framework.server.ide.api.model.IdeVersion; +import org.junit.Assert; +import org.junit.Test; + +/** + * Test case for {@link ClientEndpointImpl} + * + * @author Donald G. Dunne + */ +public class ClientEndpointTest { + + @Test + public void testGetAll() { + ClientEndpoint clientEp = AtsClientService.getClientEndpoint(); + Response response = clientEp.getAll(); + Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + Sessions sessions = response.readEntity(Sessions.class); + Assert.assertTrue(sessions.sessions.size() >= 1); + } + + @Test + public void testGetAllDetails() { + ClientEndpoint clientEp = AtsClientService.getClientEndpoint(); + Response response = clientEp.getAll(); + Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + Sessions sessions = response.readEntity(Sessions.class); + Assert.assertTrue(sessions.sessions.size() >= 1); + } + + @Test + public void testGetClientsForUser() { + ClientEndpoint clientEp = AtsClientService.getClientEndpoint(); + Response response = clientEp.getClientsForUser(DemoUsers.Joe_Smith.getUserId()); + Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + Sessions sessions = response.readEntity(Sessions.class); + + Assert.assertTrue(sessions.sessions.iterator().next().getUserId().equals(DemoUsers.Joe_Smith.getUserId())); + + response = clientEp.getClientsForUser("Joe_Smith"); + Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + sessions = response.readEntity(Sessions.class); + + Assert.assertTrue(sessions.sessions.iterator().next().getUserId().equals(DemoUsers.Joe_Smith.getUserId())); + } + + @Test + public void supportedVersions() { + ClientEndpoint clientEp = AtsClientService.getClientEndpoint(); + IdeVersion versions = clientEp.getSupportedVersions(); + assertNotNull(versions); + Collection<String> supportedVersions = versions.getVersions(); + assertEquals(true, !supportedVersions.isEmpty()); + } + +} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientResourceTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientResourceTest.java deleted file mode 100644 index ceeb520cda2..00000000000 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/orcs/rest/ClientResourceTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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.ats.client.integration.tests.orcs.rest; - -import java.net.URI; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import org.eclipse.osee.ats.demo.api.DemoUsers; -import org.eclipse.osee.framework.core.client.OseeClientProperties; -import org.eclipse.osee.jaxrs.client.JaxRsClient; -import org.junit.Assert; -import org.junit.Test; - -/** - * Test case for {@link ClientResource} - * - * @author Donald G. Dunne - */ -public class ClientResourceTest { - - @Test - public void testGetAll() { - String appServer = OseeClientProperties.getOseeApplicationServer(); - URI uri = UriBuilder.fromUri(appServer).path("orcs").path("client").build(); - - String results = callAndGetResults(uri); - getExpected("sessions", results); - } - - @Test - public void testGetAllDetails() { - String appServer = OseeClientProperties.getOseeApplicationServer(); - URI uri = UriBuilder.fromUri(appServer).path("orcs").path("client").path("details").build(); - - String results = callAndGetResults(uri); - getExpected("sessions", results); - } - - @Test - public void testGetClientsForUser() { - String appServer = OseeClientProperties.getOseeApplicationServer(); - URI uri = UriBuilder.fromUri(appServer).path("orcs").path("client").path(DemoUsers.Joe_Smith.getUserId()).build(); - - String results = callAndGetResults(uri); - getExpected("\"userId\" : \"" + DemoUsers.Joe_Smith.getUserId() + "\"", results); - - uri = UriBuilder.fromUri(appServer + "/orcs/client/Joe_Smith").build(); - - results = callAndGetResults(uri); - getExpected("\"userId\" : \"" + DemoUsers.Joe_Smith.getUserId() + "\"", results); - - } - - private void getExpected(String expected, String results) { - Assert.assertTrue(String.format("Results should include \"%s\" but does not. Results [%s]", expected, results), - results.contains(expected)); - } - - private String callAndGetResults(URI uri) { - Response response = JaxRsClient.newClient().target(uri).request(MediaType.APPLICATION_JSON_TYPE).get(); - Assert.assertEquals("Unexpected error code: " + response.readEntity(String.class), - javax.ws.rs.core.Response.Status.OK.getStatusCode(), response.getStatus()); - String results = response.readEntity(String.class); - return results; - } - -} diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF index 42a01d23a17..f442b0f0ed1 100644 --- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Import-Package: com.google.common.base, org.codehaus.jackson, org.codehaus.jackson.annotate, org.codehaus.jackson.map, + org.eclipse.jdt.annotation, org.eclipse.nebula.widgets.xviewer.core.model, org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.core.enums, diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java index d681c629070..1424147ecc5 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java @@ -19,6 +19,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.logging.Level; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.IAtsServices; import org.eclipse.osee.ats.api.config.WorkType; @@ -293,6 +294,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery { } @Override + @Nullable public <T extends IAtsConfigObject> T getOneOrNull(Class<T> clazz) { Collection<T> items = getItems(clazz); if (!items.isEmpty()) { diff --git a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF index ced97781cdf..eb7e837edd2 100644 --- a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF @@ -18,9 +18,14 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.logging, org.eclipse.osee.framework.plugin.core, org.eclipse.osee.framework.plugin.core.util, + org.eclipse.osee.framework.server.ide.api, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.jaxrs.client, org.eclipse.osee.jdbc, org.eclipse.osee.orcs.rest.client, + org.eclipse.osee.orcs.rest.model, org.osgi.framework Export-Package: org.eclipse.osee.framework.core.client, org.eclipse.osee.framework.core.client.server Service-Component: OSGI-INF/*.xml +Require-Bundle: javax.ws.rs diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/BaseCredentialProvider.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/BaseCredentialProvider.java index bdd22766dd6..56c2937f2d9 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/BaseCredentialProvider.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/BaseCredentialProvider.java @@ -28,17 +28,16 @@ public abstract class BaseCredentialProvider implements ICredentialProvider { public OseeCredential getCredential() { OseeCredential credential = new OseeCredential(); credential.setUserName(""); - credential.setDomain(""); credential.setPassword(""); String localAddress = HttpServer.getServerAddressForExternalCommunication(); - credential.setClientAddress(Strings.isValid(localAddress) ? localAddress : "Unknown", - HttpServer.getDefaultServicePort()); + credential.setClientAddress(Strings.isValid(localAddress) ? localAddress : "Unknown"); + credential.setClientPort(String.valueOf(HttpServer.getDefaultServicePort())); credential.setClientVersion(OseeCodeVersion.getVersion()); try { - credential.setClientMachineName(InetAddress.getLocalHost().getHostName()); + credential.setClientAddress(InetAddress.getLocalHost().getHostName()); } catch (Exception ex) { - credential.setClientMachineName("Unknown"); + credential.setClientAddress("Unknown"); OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex); } return credential; diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java index 373b651d251..4051e2819db 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/ClientSessionManager.java @@ -65,15 +65,15 @@ public class ClientSessionManager { } public static String getDataStoreLoginName() throws OseeAuthenticationRequiredException { - return getSessionGrant().getDatabaseInfo().getDatabaseLoginName(); + return getSessionGrant().getDbLogin(); } public static String getDataStoreDriver() throws OseeAuthenticationRequiredException { - return getSessionGrant().getDatabaseInfo().getDriver(); + return getSessionGrant().getDbDriver(); } public static String getDataStoreName() throws OseeAuthenticationRequiredException { - return getSessionGrant().getDatabaseInfo().getDatabaseName(); + return getSessionGrant().getDbDatabaseName(); } public static String getDataStorePath() throws OseeAuthenticationRequiredException { @@ -81,7 +81,7 @@ public class ClientSessionManager { } public static boolean isProductionDataStore() throws OseeAuthenticationRequiredException { - return getSessionGrant().getDatabaseInfo().isProduction(); + return getSessionGrant().isDbIsProduction(); } public static Properties getSqlProperties() { @@ -105,7 +105,7 @@ public class ClientSessionManager { } public static String getDatabaseInfo() throws OseeAuthenticationRequiredException { - return getSessionGrant().getDatabaseInfo().toString(); + return getSessionGrant().toString(); } public static IdeClientSession getSafeSession() { diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientJdbcServiceImpl.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientJdbcServiceImpl.java index 415032773b3..93e5eff070a 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientJdbcServiceImpl.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/ClientJdbcServiceImpl.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; -import org.eclipse.osee.framework.core.data.IDatabaseInfo; import org.eclipse.osee.framework.core.data.OseeSessionGrant; import org.eclipse.osee.jdbc.JdbcClient; import org.eclipse.osee.jdbc.JdbcClientBuilder; @@ -28,7 +27,7 @@ import org.eclipse.osee.jdbc.JdbcService; /** * Temporary Service implementation until client is dynamically configured using ConfigAdmin - * + * * @author Roberto E. Escobar */ public class ClientJdbcServiceImpl implements JdbcService { @@ -107,8 +106,8 @@ public class ClientJdbcServiceImpl implements JdbcService { private volatile JdbcClient proxiedClient; public String getId() { - IDatabaseInfo dbInfo = getDbInfo(); - return dbInfo != null ? dbInfo.getId() : "N/A"; + OseeSessionGrant dbInfo = getDbInfo(); + return dbInfo != null ? dbInfo.getDbId() : "N/A"; } private boolean isGetId(Method method) { @@ -137,7 +136,7 @@ public class ClientJdbcServiceImpl implements JdbcService { private JdbcClient getProxiedClient() { if (proxiedClient == null) { - IDatabaseInfo dbInfo = getDbInfo(); + OseeSessionGrant dbInfo = getDbInfo(); if (dbInfo != null) { proxiedClient = newClient(dbInfo); } @@ -145,19 +144,19 @@ public class ClientJdbcServiceImpl implements JdbcService { return proxiedClient; } - private IDatabaseInfo getDbInfo() { + private OseeSessionGrant getDbInfo() { OseeSessionGrant sessionGrant = InternalClientSessionManager.getInstance().getOseeSessionGrant(); - return sessionGrant != null ? sessionGrant.getDatabaseInfo() : null; + return sessionGrant; } - private JdbcClient newClient(IDatabaseInfo dbInfo) { + private JdbcClient newClient(OseeSessionGrant sessionGrant) { JdbcClientBuilder builder = JdbcClientBuilder.newBuilder()// - .dbDriver(dbInfo.getDriver())// - .dbUri(dbInfo.getConnectionUrl())// - .dbUsername(dbInfo.getDatabaseLoginName())// - .production(dbInfo.isProduction()); + .dbDriver(sessionGrant.getDbDriver())// + .dbUri(sessionGrant.getDbUrl())// + .dbUsername(sessionGrant.getDbLogin())// + .production(sessionGrant.isCreationRequired()); - Properties properties = dbInfo.getConnectionProperties(); + Properties properties = sessionGrant.getDbConnectionProperties(); if (properties != null && !properties.isEmpty()) { for (Entry<Object, Object> entry : properties.entrySet()) { builder.dbParam((String) entry.getKey(), (String) entry.getValue()); diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java index d95ce17ad14..3e7f1851a43 100644 --- a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java +++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/internal/InternalClientSessionManager.java @@ -10,40 +10,31 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.client.internal; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.logging.Level; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import org.eclipse.osee.framework.core.client.BaseCredentialProvider; import org.eclipse.osee.framework.core.client.GuestCredentialProvider; import org.eclipse.osee.framework.core.client.ICredentialProvider; import org.eclipse.osee.framework.core.client.OseeClientProperties; import org.eclipse.osee.framework.core.client.server.HttpServer; -import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient; -import org.eclipse.osee.framework.core.data.IDatabaseInfo; import org.eclipse.osee.framework.core.data.IdeClientSession; import org.eclipse.osee.framework.core.data.OseeClientInfo; import org.eclipse.osee.framework.core.data.OseeCodeVersion; import org.eclipse.osee.framework.core.data.OseeCredential; -import org.eclipse.osee.framework.core.data.OseeServerContext; import org.eclipse.osee.framework.core.data.OseeSessionGrant; import org.eclipse.osee.framework.core.enums.SystemUser; import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException; -import org.eclipse.osee.framework.core.util.HttpProcessor; -import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.logging.BaseStatus; import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.server.ide.api.SessionEndpoint; +import org.eclipse.osee.jaxrs.client.JaxRsClient; /** * @author Roberto E. Escobar @@ -51,6 +42,7 @@ import org.eclipse.osee.framework.logging.OseeLog; public class InternalClientSessionManager { public static final String STATUS_ID = "Session Manager"; private static final InternalClientSessionManager instance = new InternalClientSessionManager(); + private static Object ideTarget; private final OseeClientInfo clientInfo; private OseeSessionGrant oseeSessionGrant; @@ -77,8 +69,8 @@ public class InternalClientSessionManager { return oseeSession != null; } - public IDatabaseInfo getDatabaseInfo() throws OseeAuthenticationRequiredException { - return getOseeSessionGrant().getDatabaseInfo(); + public OseeSessionGrant getDatabaseInfo() throws OseeAuthenticationRequiredException { + return getOseeSessionGrant(); } public OseeSessionGrant getOseeSessionGrant() throws OseeAuthenticationRequiredException { @@ -155,7 +147,6 @@ public class InternalClientSessionManager { } } credential.setUserName(userName); - credential.setDomain(""); credential.setPassword(""); return credential; } @@ -178,43 +169,26 @@ public class InternalClientSessionManager { } private void internalReleaseSession(String sessionId) throws OseeCoreException { - Map<String, String> parameters = new HashMap<>(); - parameters.put("operation", "release"); - parameters.put("sessionId", sessionId); try { - String url = - HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.SESSION_CONTEXT, parameters); - if (Strings.isValid(url)) { - String reponse = HttpProcessor.post(new URL(url)); - OseeLog.log(CoreClientActivator.class, Level.INFO, reponse); - clearData(); + SessionEndpoint sessionEp = getSessionEp(); + Response response = sessionEp.releaseIdeClientSession(sessionId); + if (response.getStatus() != Status.OK.getStatusCode()) { + throw new OseeCoreException("Unable to Release Session " + response.toString()); } + clearData(); } catch (Exception ex) { - OseeCoreException.wrapAndThrow(ex); + OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex); } } public List<String> getAuthenticationProtocols() { List<String> toReturn = new ArrayList<>(); try { - Map<String, String> parameters = new HashMap<>(); - String url = - HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.SESSION_CONTEXT, parameters); - if (Strings.isValid(url)) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - AcquireResult result = HttpProcessor.acquire(new URL(url), outputStream); - if (result.getCode() == HttpURLConnection.HTTP_OK) { - String protocols = outputStream.toString("UTF-8"); - if (Strings.isValid(protocols)) { - String[] results = protocols.split("[\\[\\]\\s,]+"); - for (String entry : results) { - if (Strings.isValid(entry)) { - toReturn.add(entry); - } - } - } - } - } + SessionEndpoint sessionEp = getSessionEp(); + Response response = sessionEp.getIdeClientProtocols(); + @SuppressWarnings("unchecked") + List<String> protocols = response.readEntity(LinkedList.class); + toReturn.addAll(protocols); } catch (Exception ex) { OseeLog.log(CoreClientActivator.class, Level.SEVERE, ex); } @@ -226,53 +200,18 @@ public class InternalClientSessionManager { this.oseeSessionGrant = null; } - private OseeSessionGrant internalAcquireSession(OseeCredential credential) throws OseeCoreException, MalformedURLException { - OseeSessionGrant session = null; - Map<String, String> parameters = new HashMap<>(); - parameters.put("operation", "create"); - String url = - HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.SESSION_CONTEXT, parameters); - - if (Strings.isValid(url)) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - AcquireResult result = - HttpProcessor.post(new URL(url), asInputStream(credential), "text/xml", "UTF-8", outputStream); - if (result.getCode() == HttpURLConnection.HTTP_ACCEPTED) { - session = fromEncryptedBytes(outputStream.toByteArray()); - } else { - throw new OseeCoreException("Error during create session request - code [%s]\n%s", result.getCode(), - outputStream.toString()); - } - } - return session; + private OseeSessionGrant internalAcquireSession(OseeCredential credential) throws OseeCoreException { + SessionEndpoint sessionEp = getSessionEp(); + Response response = sessionEp.createIdeClientSession(credential); + OseeSessionGrant sessionGrant = response.readEntity(OseeSessionGrant.class); + return sessionGrant; } - private static ByteArrayInputStream asInputStream(OseeCredential credential) throws OseeCoreException { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - credential.write(outputStream); - - //TODO ENCRYPT DATA - - return new ByteArrayInputStream(outputStream.toByteArray()); - } - - private static OseeSessionGrant fromEncryptedBytes(byte[] rawData) throws OseeCoreException { - OseeSessionGrant session = null; - InputStream inputStream = null; - try { - //TODO DECRYPT DATA - inputStream = new ByteArrayInputStream(rawData); - session = OseeSessionGrant.fromXml(inputStream); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (IOException ex) { - OseeCoreException.wrapAndThrow(ex); - } - } - } - return session; + private static SessionEndpoint getSessionEp() { + String appServer = OseeClientProperties.getOseeApplicationServer(); + String atsUri = String.format("%s/ide", appServer); + JaxRsClient jaxRsClient = JaxRsClient.newBuilder().createThreadSafeProxyClients(true).build(); + return jaxRsClient.target(atsUri).newProxy(SessionEndpoint.class); } } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java index ae91d046f4b..aefd91ede7c 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java @@ -12,7 +12,6 @@ package org.eclipse.osee.framework.core.server.internal.session; import java.util.Date; import java.util.Properties; -import org.eclipse.osee.framework.core.data.IDatabaseInfo; import org.eclipse.osee.framework.core.data.IUserToken; import org.eclipse.osee.framework.core.data.OseeSessionGrant; import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory; @@ -52,11 +51,24 @@ public final class SessionFactory implements IOseeTypeFactory { Conditions.checkNotNull(session, "Session"); Conditions.checkNotNull(userToken, "IUserToken"); + final JdbcClientConfig config = jdbcService.getClient().getConfig(); + OseeSessionGrant sessionGrant = new OseeSessionGrant(session.getGuid()); sessionGrant.setAuthenticationProtocol(authenticationType); sessionGrant.setCreationRequired(userToken.isCreationRequired()); - sessionGrant.setUserToken(userToken); - sessionGrant.setDatabaseInfo(getDatabaseInfo()); + sessionGrant.setOseeUserName(userToken.getName()); + sessionGrant.setOseeUserEmail(userToken.getEmail()); + sessionGrant.setOseeUserActive(userToken.isActive()); + sessionGrant.setOseeUserId(userToken.getUserId()); + sessionGrant.setDbIsProduction(config.isProduction()); + sessionGrant.setDbLogin(config.getDbUsername()); + sessionGrant.setDbId(jdbcService.getId()); + sessionGrant.setDbDriver(config.getDbDriver()); + sessionGrant.setDbLogin(config.getDbUsername()); + sessionGrant.setDbUrl(config.getDbUri()); + sessionGrant.setDbConnectionProperties(config.getDbProps()); + sessionGrant.setDbDatabaseName(jdbcService.hasServer() ? jdbcService.getServerConfig().getDbName() : ""); + sessionGrant.setDbDatabasePath(jdbcService.hasServer() ? jdbcService.getServerConfig().getDbPath() : ""); Properties properties = OseeSql.getSqlProperties(jdbcService.getClient().getDbType().areHintsSupported()); sessionGrant.setSqlProperties(properties); @@ -65,53 +77,4 @@ public final class SessionFactory implements IOseeTypeFactory { return sessionGrant; } - private IDatabaseInfo getDatabaseInfo() { - final String infoId = jdbcService.getId(); - final JdbcClientConfig config = jdbcService.getClient().getConfig(); - return new IDatabaseInfo() { - - private static final long serialVersionUID = 192942011732757789L; - - @Override - public boolean isProduction() { - return config.isProduction(); - } - - @Override - public String getId() { - return infoId; - } - - @Override - public String getDriver() { - return config.getDbDriver(); - } - - @Override - public String getDatabaseLoginName() { - return config.getDbUsername(); - } - - @Override - public String getConnectionUrl() { - return config.getDbUri(); - } - - @Override - public Properties getConnectionProperties() { - return config.getDbProps(); - } - - @Override - public String getDatabaseName() { - return jdbcService.hasServer() ? jdbcService.getServerConfig().getDbName() : ""; - } - - @Override - public String getDatabaseHome() { - return jdbcService.hasServer() ? jdbcService.getServerConfig().getDbPath() : ""; - } - - }; - } } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java index 99a393f1354..1277498f450 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java @@ -63,8 +63,8 @@ public final class SessionManagerImpl implements ISessionManager { Date creationDate = GlobalTime.GreenwichMeanTimestamp(); Session session = sessionFactory.createNewSession(newSessionId, userToken.getUserId(), creationDate, - credential.getVersion(), credential.getClientMachineName(), credential.getClientAddress(), - credential.getPort()); + credential.getClientVersion(), credential.getClientAddress(), credential.getClientAddress(), + Integer.valueOf(credential.getClientPort())); // if the user is BootStrap we do not want to insert into database since tables may not exist if (!SystemUser.BootStrap.equals(userToken)) { diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java deleted file mode 100644 index bdf03f9281d..00000000000 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java +++ /dev/null @@ -1,37 +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.data; - -import java.io.Serializable; -import java.util.Properties; - -/** - * @author Roberto E. Escobar - */ -public interface IDatabaseInfo extends Serializable { - - String getId(); - - String getDatabaseName(); - - String getDatabaseLoginName(); - - String getDriver(); - - String getConnectionUrl(); - - Properties getConnectionProperties(); - - boolean isProduction(); - - String getDatabaseHome(); - -} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IdeClientSession.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IdeClientSession.java index 735750ae24d..68b4cd179b8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IdeClientSession.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IdeClientSession.java @@ -119,4 +119,9 @@ public class IdeClientSession { this.clientName = clientName; } + @Override + public String toString() { + return "IdeClientSession [id=" + id + ", clientAddress=" + clientAddress + ", clientPort=" + clientPort + ", userId=" + userId + ", clientVersion=" + clientVersion + ", sessionId=" + sessionId + ", createdOn=" + createdOn + ", sessionLog=" + sessionLog + ", authenticationProtocol=" + authenticationProtocol + ", clientName=" + clientName + "]"; + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java index 2ca872f737e..e3ecf225510 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java @@ -10,54 +10,41 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.data; -import java.io.InputStream; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; - /** * @author Roberto E. Escobar + * @author Donald G. Dunne */ -public class OseeCredential extends OseeClientInfo { - private static final long serialVersionUID = 4583587251351958961L; - private static final String USERNAME = "userName"; - private static final String PASSWORD = "password"; - private static final String DOMAIN = "domain"; +public class OseeCredential extends IdeClientSession { + private String userName = "userName"; + private String password = "password"; public OseeCredential() { super(); } public void setUserName(String userName) { - this.backingData.put(USERNAME, userName); + this.userName = userName; } public void setPassword(String password) { - this.backingData.put(PASSWORD, password); - } - - public void setDomain(String domain) { - this.backingData.put(DOMAIN, domain); + this.password = password; } public String getUserName() { - return getString(USERNAME); + return userName; } public String getPassword() { - return getString(PASSWORD); + return password; } - public String getDomain() { - return getString(DOMAIN); + @Override + public String toString() { + return "OseeCredential [userName=" + userName + ", password=" + password + ", getUserName()=" + getUserName() + ", getPassword()=" + // + getPassword() + ", getClientAddress()=" + getClientAddress() + ", getClientPort()=" + getClientPort() + ", getUserId()=" + getUserId() + // + ", getClientVersion()=" + getClientVersion() + ", getSessionId()=" + getSessionId() + ", getCreatedOn()=" + getCreatedOn() + // + ", getSessionLog()=" + getSessionLog() + ", getAuthenticationProtocol()=" + getAuthenticationProtocol() + ", getId()=" + getId() + // + ", getClientName()=" + getClientName() + "]"; } - /** - * Create new instance from XML input - * - * @param OseeCredential the new instance - */ - public static OseeCredential fromXml(InputStream inputStream) throws OseeCoreException { - OseeCredential session = new OseeCredential(); - session.loadfromXml(inputStream); - return session; - } } 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 6e824bfd241..373d1a34b60 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 @@ -18,7 +18,6 @@ public class OseeServerContext { private static final String BASE_CONTEXT = "osee"; public static final String MANAGER_CONTEXT = asAbsoluteContext("manager"); - public static final String SESSION_CONTEXT = asAbsoluteContext("session"); public static final String CLIENT_LOOPBACK_CONTEXT = asAbsoluteContext("client/loopback"); public static final String ARTIFACT_CONTEXT = asAbsoluteContext("artifact"); diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java index b05bd235f3d..9af1c1c10fe 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java @@ -10,98 +10,71 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.data; -import java.io.InputStream; import java.util.Properties; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.jdk.core.util.Lib; /** * @author Roberto E. Escobar + * @author Donald G. Dunne */ -public class OseeSessionGrant extends BaseExchangeData { - - private static final long serialVersionUID = -7236201704435470272L; - private static final String SESSION_ID = "sessionId"; - private static final String SQL_PROPERTIES = "slqProperty"; - - private static final String DB_DRIVER = "dbDriver"; - private static final String DB_CONNECTION_URL = "dbUrl"; - private static final String DB_CONNECT_PROPERTIES = "dbConnectionProperties"; - private static final String DB_LOGIN_NAME = "dbLogin"; - private static final String DB_DATABASE_NAME = "dbDatabaseName"; - private static final String DB_IS_PRODUCTION = "dbIsProduction"; - private static final String DB_PATH = "dbDatabasePath"; - private static final String DB_ID = "dbId"; - - private static final String OSEE_USER_IS_CREATION_REQUIRED = "oseeUserNeedsCreation"; - private static final String OSEE_USER_EMAIL = "oseeUserEmail"; - private static final String OSEE_USER_NAME = "oseeUserName"; - private static final String OSEE_USER_ID = "oseeUserId"; - private static final String OSEE_IS_USER_ACTIVE = "isOseeUserActive"; - private static final String OSEE_APPLICATION_SERVER_DATA_PATH = "oseeApplicationServerDataPath"; - private static final String AUTHENTICATION_PROTOCOL = "oseeAuthenticationProtocol"; - - private IDatabaseInfo grantedDatabaseInfo; - - protected OseeSessionGrant() { +public class OseeSessionGrant { + + private String sessionId; + private String dbDriver; + private String dbUrl; + private String dbLogin; + private String dbDatabaseName; + private boolean dbIsProduction; + private String dbDatabasePath; + private String dbId; + + private boolean oseeUserNeedsCreation; + private String oseeUserEmail; + private String oseeUserName; + private String oseeUserId; + private boolean isOseeUserActive; + private String oseeApplicationServerDataPath; + private String oseeAuthenticationProtocol; + + private Properties sqlProperties; + private Properties dbConnectionProperties; + + public OseeSessionGrant() { super(); - this.grantedDatabaseInfo = new GrantedDatabaseInfo(); } public OseeSessionGrant(String sessionId) { super(); - this.backingData.put(SESSION_ID, sessionId); + this.sessionId = sessionId; } public String getSessionId() { - return getString(SESSION_ID); - } - - public IDatabaseInfo getDatabaseInfo() { - return grantedDatabaseInfo; - } - - public void setDatabaseInfo(IDatabaseInfo dbInfo) { - this.backingData.put(DB_DRIVER, dbInfo.getDriver()); - this.backingData.put(DB_CONNECTION_URL, dbInfo.getConnectionUrl()); - this.backingData.put(DB_LOGIN_NAME, dbInfo.getDatabaseLoginName()); - this.backingData.put(DB_DATABASE_NAME, dbInfo.getDatabaseName()); - this.backingData.put(DB_IS_PRODUCTION, dbInfo.isProduction()); - this.backingData.put(DB_ID, dbInfo.getId()); - this.backingData.put(DB_PATH, dbInfo.getDatabaseHome()); - putProperties(DB_CONNECT_PROPERTIES, dbInfo.getConnectionProperties()); + return sessionId; } public void setSqlProperties(Properties sqlProperties) { - putProperties(SQL_PROPERTIES, sqlProperties); + this.sqlProperties = sqlProperties; } public Properties getSqlProperties() { - return getPropertyString(SQL_PROPERTIES); - } - - public void setUserToken(IUserToken userInfo) throws OseeCoreException { - this.backingData.put(OSEE_USER_EMAIL, userInfo.getEmail()); - this.backingData.put(OSEE_USER_NAME, userInfo.getName()); - this.backingData.put(OSEE_USER_ID, userInfo.getUserId()); - this.backingData.put(OSEE_IS_USER_ACTIVE, userInfo.isActive()); + return this.sqlProperties; } public boolean isCreationRequired() { - return backingData.getBoolean(OSEE_USER_IS_CREATION_REQUIRED); + return oseeUserNeedsCreation; } public void setCreationRequired(boolean value) { - this.backingData.put(OSEE_USER_IS_CREATION_REQUIRED, value); + this.oseeUserNeedsCreation = value; } public void setDataStorePath(String oseeApplicationServerData) { - this.backingData.put(OSEE_APPLICATION_SERVER_DATA_PATH, oseeApplicationServerData); + this.oseeApplicationServerDataPath = oseeApplicationServerData; } public String getDataStorePath() { - return getString(OSEE_APPLICATION_SERVER_DATA_PATH); + return oseeApplicationServerDataPath; } public IUserToken getUserToken() { @@ -109,74 +82,132 @@ public class OseeSessionGrant extends BaseExchangeData { } public String getAuthenticationProtocol() { - return getString(AUTHENTICATION_PROTOCOL); + return oseeAuthenticationProtocol; } public void setAuthenticationProtocol(String protocol) { - this.backingData.put(AUTHENTICATION_PROTOCOL, protocol); + this.oseeAuthenticationProtocol = protocol; } - public static OseeSessionGrant fromXml(InputStream inputStream) throws OseeCoreException { - OseeSessionGrant session = new OseeSessionGrant(); - session.loadfromXml(inputStream); - return session; + private IUserToken getGrantedUserToken() { + return TokenFactory.createUserToken(Lib.generateArtifactIdAsInt(), GUID.create(), oseeUserName, oseeUserEmail, + oseeUserId, isOseeUserActive, false, false); } - private IUserToken getGrantedUserToken() { - return TokenFactory.createUserToken(Lib.generateArtifactIdAsInt(), GUID.create(), getString(OSEE_USER_NAME), - getString(OSEE_USER_EMAIL), getString(OSEE_USER_ID), backingData.getBoolean(OSEE_IS_USER_ACTIVE), false, - false); + public String getDbDriver() { + return dbDriver; + } + + public void setDbDriver(String dbDriver) { + this.dbDriver = dbDriver; + } + + public String getDbLogin() { + return dbLogin; + } + + public void setDbLogin(String dbLogin) { + this.dbLogin = dbLogin; } - private final class GrantedDatabaseInfo implements IDatabaseInfo { + public String getDbDatabaseName() { + return dbDatabaseName; + } - private static final long serialVersionUID = -7314120611445752014L; + public void setDbDatabaseName(String dbDatabaseName) { + this.dbDatabaseName = dbDatabaseName; + } - @Override - public Properties getConnectionProperties() { - return getPropertyString(DB_CONNECT_PROPERTIES); - } + public String getDbDatabasePath() { + return dbDatabasePath; + } - @Override - public String getConnectionUrl() { - return getString(DB_CONNECTION_URL); - } + public void setDbDatabasePath(String dbDatabasePath) { + this.dbDatabasePath = dbDatabasePath; + } - @Override - public String getDatabaseLoginName() { - return getString(DB_LOGIN_NAME); - } + public String getDbId() { + return dbId; + } - @Override - public String getDatabaseName() { - return getString(DB_DATABASE_NAME); - } + public void setDbId(String dbId) { + this.dbId = dbId; + } - @Override - public String getDriver() { - return getString(DB_DRIVER); - } + public String getOseeUserEmail() { + return oseeUserEmail; + } + + public void setOseeUserEmail(String oseeUserEmail) { + this.oseeUserEmail = oseeUserEmail; + } - @Override - public String getId() { - return getString(DB_ID); - } + public String getOseeUserName() { + return oseeUserName; + } - @Override - public boolean isProduction() { - return Boolean.valueOf(getString(DB_IS_PRODUCTION)); - } + public void setOseeUserName(String oseeUserName) { + this.oseeUserName = oseeUserName; + } - @Override - public String toString() { - return getId() + ": " + getConnectionUrl(); - } + public String getOseeUserId() { + return oseeUserId; + } - @Override - public String getDatabaseHome() { - return getString(DB_PATH); - } + public void setOseeUserId(String oseeUserId) { + this.oseeUserId = oseeUserId; + } + + public String getOseeApplicationServerDataPath() { + return oseeApplicationServerDataPath; + } + + public void setOseeApplicationServerDataPath(String oseeApplicationServerDataPath) { + this.oseeApplicationServerDataPath = oseeApplicationServerDataPath; + } + + public String getOseeAuthenticationProtocol() { + return oseeAuthenticationProtocol; + } + + public void setOseeAuthenticationProtocol(String oseeAuthenticationProtocol) { + this.oseeAuthenticationProtocol = oseeAuthenticationProtocol; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public boolean isDbIsProduction() { + return dbIsProduction; + } + + public void setDbIsProduction(boolean dbIsProduction) { + this.dbIsProduction = dbIsProduction; + } + + public boolean isOseeUserActive() { + return isOseeUserActive; + } + + public void setOseeUserActive(boolean isOseeUserActive) { + this.isOseeUserActive = isOseeUserActive; + } + + public void setDbUrl(String dbUrl) { + this.dbUrl = dbUrl; + } + + public Properties getDbConnectionProperties() { + return dbConnectionProperties; + } + + public void setDbConnectionProperties(Properties dbConnectionProperties) { + this.dbConnectionProperties = dbConnectionProperties; + } + public String getDbUrl() { + return dbUrl; } } diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/.project b/plugins/org.eclipse.osee.framework.manager.servlet/.project deleted file mode 100644 index 8a1f6b54b3e..00000000000 --- a/plugins/org.eclipse.osee.framework.manager.servlet/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.osee.framework.manager.servlet</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SessionManagementServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SessionManagementServlet.java deleted file mode 100644 index a4361f34b65..00000000000 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SessionManagementServlet.java +++ /dev/null @@ -1,194 +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 java.util.Arrays; -import java.util.Date; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.eclipse.osee.activity.api.Activity; -import org.eclipse.osee.activity.api.ActivityLog; -import org.eclipse.osee.framework.core.data.OseeCredential; -import org.eclipse.osee.framework.core.data.OseeSessionGrant; -import org.eclipse.osee.framework.core.server.IAuthenticationManager; -import org.eclipse.osee.framework.core.server.ISession; -import org.eclipse.osee.framework.core.server.ISessionManager; -import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.logger.Log; - -/** - * @author Roberto E. Escobar - */ -public class SessionManagementServlet extends UnsecuredOseeHttpServlet { - - private static final long serialVersionUID = 3334123351267606890L; - - private static enum OperationType { - CREATE, - RELEASE, - INVALID; - - public static OperationType fromString(String value) { - OperationType toReturn = OperationType.INVALID; - for (OperationType operType : OperationType.values()) { - if (operType.name().equalsIgnoreCase(value)) { - toReturn = operType; - break; - } - } - return toReturn; - } - } - - private final IAuthenticationManager authenticationManager; - private final ISessionManager sessionManager; - private final ActivityLog activityLog; - - public SessionManagementServlet(Log logger, ISessionManager sessionManager, IAuthenticationManager authenticationManager, ActivityLog activityLog) { - super(logger); - this.sessionManager = sessionManager; - this.authenticationManager = authenticationManager; - this.activityLog = activityLog; - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - try { - String[] protocols = authenticationManager.getProtocols(); - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("text/plain"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(Arrays.deepToString(protocols)); - } catch (Exception ex) { - getLogger().error(ex, "Error processing request for protocols [%s]", request.toString()); - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - response.setContentType("text/plain"); - response.getWriter().write(Lib.exceptionToString(ex)); - } finally { - response.getWriter().flush(); - response.getWriter().close(); - } - } - - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { - String operation = request.getParameter("operation"); - try { - OperationType operationType = OperationType.fromString(operation); - switch (operationType) { - case CREATE: - createSession(request, response); - break; - case RELEASE: - releaseSession(request, response); - break; - default: - break; - } - } catch (Exception ex) { - getLogger().error(ex, "Error processing session request [%s]", request.toString()); - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - response.getWriter().write(Lib.exceptionToString(ex)); - response.getWriter().flush(); - response.getWriter().close(); - } - } - - private void createSession(HttpServletRequest request, HttpServletResponse response) throws Exception { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - Lib.inputStreamToOutputStream(request.getInputStream(), outputStream); - byte[] bytes = outputStream.toByteArray(); - - // TODO Decrypt credential info - OseeCredential credential = OseeCredential.fromXml(new ByteArrayInputStream(bytes)); - OseeSessionGrant oseeSessionGrant = sessionManager.createSession(credential); - - if (oseeSessionGrant != null) { - logSessionCreation(credential, oseeSessionGrant); - response.setStatus(HttpServletResponse.SC_ACCEPTED); - ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); - oseeSessionGrant.write(byteOutputStream); - - // TODO after encrypted these will need to change - response.setContentType("application/xml"); - response.setCharacterEncoding("UTF-8"); - response.setContentLength(byteOutputStream.size()); - Lib.inputStreamToOutputStream(new ByteArrayInputStream(byteOutputStream.toByteArray()), - response.getOutputStream()); - } else { - // session could not be created due to version or invalid user - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unable to create session"); - } - } - - private void logSessionCreation(OseeCredential credential, OseeSessionGrant oseeSessionGrant) { - try { - activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS, - String.format("IDE Client Session Created " // - + "{" // - + "\"version\":\"%s\", " // - + "\"clientAddress\":\"%s\", " // - + "\"clientMachineName\":\"%s\", " // - + "\"port\":\"%s\", " // - + "\"userName\":\"%s\", " // - + "\"userId\":\"%s\", " // - + "\"sessionId\":\"%s\"" // - + "}", // - credential.getVersion(), credential.getClientAddress(), credential.getClientMachineName(), - credential.getPort(), credential.getUserName(), oseeSessionGrant.getUserToken().getUserId(), - oseeSessionGrant.getSessionId())); - } catch (Exception ex) { - // do nothing - } - } - - private void logSessionReleased(String sessionId) { - try { - ISession session = sessionManager.getSessionById(sessionId); - String duration = getDuration(session); - String userId = session != null ? session.getUserId() : "unknown"; - activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS, - String.format("IDE Client Session Released " // - + "{" // - + "\"sessionId\":\"%s\", " // - + "\"duration\":\"%s\", " // - + "\"userId\":\"%s\"" // - + "}", // - sessionId, duration, userId)); - } catch (Exception ex) { - // do nothing - } - } - - /** - * @return duration in H:M:S - */ - private String getDuration(ISession session) { - String duration = "0"; - if (session != null) { - duration = String.valueOf(new Date().getTime() - session.getCreationDate().getTime()); - } - return duration; - } - - private void releaseSession(HttpServletRequest request, HttpServletResponse response) throws Exception { - String sessionId = request.getParameter("sessionId"); - logSessionReleased(sessionId); - sessionManager.releaseSession(sessionId); - response.setStatus(HttpServletResponse.SC_ACCEPTED); - response.setContentType("text/plain"); - response.getWriter().write(String.format("Session [%s] released.", sessionId)); - } -} diff --git a/plugins/org.eclipse.osee.framework.server.ide.api/.classpath b/plugins/org.eclipse.osee.framework.server.ide.api/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide.api/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.osee.framework.server.ide.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.server.ide.api/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..87c098dcf80 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide.api/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: OSEE Server Ide Api Plug-in +Bundle-SymbolicName: org.eclipse.osee.framework.server.ide.api +Bundle-Version: 0.25.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Import-Package: javax.ws.rs, + javax.ws.rs.core, + org.eclipse.osee.framework.core.data, + org.eclipse.osee.framework.jdk.core.util, + org.eclipse.osee.orcs.rest.model +Export-Package: org.eclipse.osee.framework.server.ide.api, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.framework.server.ide.api.client.model, + org.eclipse.osee.framework.server.ide.api.model diff --git a/plugins/org.eclipse.osee.framework.server.ide.api/build.properties b/plugins/org.eclipse.osee.framework.server.ide.api/build.properties new file mode 100644 index 00000000000..34d2e4d2dad --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide.api/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/pom.xml b/plugins/org.eclipse.osee.framework.server.ide.api/pom.xml index 1de0567a18d..1a57690bccf 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/pom.xml +++ b/plugins/org.eclipse.osee.framework.server.ide.api/pom.xml @@ -10,8 +10,8 @@ <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> </parent> - <artifactId>org.eclipse.osee.framework.manager.servlet</artifactId> + <artifactId>org.eclipse.osee.framework.server.ide.api</artifactId> <packaging>eclipse-plugin</packaging> - <name>OSEE Legacy Servlet Manager - (Incubation)</name> + <name>OSEE Server Ide Api - (Incubation)</name> </project> diff --git a/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/SessionEndpoint.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/SessionEndpoint.java new file mode 100644 index 00000000000..f78d9b42928 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/SessionEndpoint.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2016 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.server.ide.api; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.eclipse.osee.framework.core.data.OseeCredential; + +/** + * @author Donald G. Dunne + */ +public interface SessionEndpoint { + + /** + * Register an IDE client with an application server. + */ + @PUT + @Path("session") + @Consumes({MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_JSON}) + public Response createIdeClientSession(OseeCredential clientSession); + + /** + * @return protocols associated with the specified application server + */ + @GET + @Path("session/protocols") + @Produces({MediaType.APPLICATION_JSON}) + Response getIdeClientProtocols(); + + /** + * DeRegister an IDE client with an application server. + */ + @DELETE + @Path("session/{sessionId}") + @Produces({MediaType.APPLICATION_JSON}) + public Response releaseIdeClientSession(@PathParam("sessionId") String sessionId); + +} diff --git a/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/ClientEndpoint.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/ClientEndpoint.java new file mode 100644 index 00000000000..7f795f2bae6 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/ClientEndpoint.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2016 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.server.ide.api.client; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.eclipse.osee.framework.server.ide.api.model.IdeVersion; + +/** + * @author Donald G. Dunne + */ +public interface ClientEndpoint { + + @GET + @Path("client") + @Produces({MediaType.APPLICATION_JSON}) + public Response getAll(); + + @GET + @Path("client/details") + @Produces({MediaType.APPLICATION_JSON}) + public Response getAllDetails(); + + /** + * @param idOrName as userId or name; underscores can be used instead of spaces if calling from browser; + * @return all client sessions matching idOrName; multiple users sessions can be returned depending + */ + @GET + @Path("client/{idOrName}") + @Produces({MediaType.APPLICATION_JSON}) + public Response getClientsForUser(@PathParam("idOrName") String idOrName); + + @GET + @Path("client/{userId}/session/{sessionId}") + @Produces({MediaType.TEXT_PLAIN}) + public Response getClientInfo(@PathParam("userId") String userId, @PathParam("sessionId") String sessionId); + + @GET + @Path("versions") + @Produces({MediaType.APPLICATION_JSON}) + IdeVersion getSupportedVersions(); + +} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/ClientDetails.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/ClientDetails.java index 4df828ead3c..6eefb197d61 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/ClientDetails.java +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/ClientDetails.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.orcs.rest.internal.client.model; +package org.eclipse.osee.framework.server.ide.api.client.model; import java.util.Collection; import java.util.HashMap; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/ClientInfo.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/ClientInfo.java index 6bb40a31849..1452afe565a 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/ClientInfo.java +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/ClientInfo.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.orcs.rest.internal.client.model; +package org.eclipse.osee.framework.server.ide.api.client.model; import java.util.Date; import java.util.regex.Matcher; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/Sessions.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/Sessions.java index 3a27645411f..6db4bb10f2c 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/model/Sessions.java +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/client/model/Sessions.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.orcs.rest.internal.client.model; +package org.eclipse.osee.framework.server.ide.api.client.model; import java.util.LinkedList; import java.util.List; diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/IdeVersion.java b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/model/IdeVersion.java index 30510415fcd..4a335fcbf2f 100644 --- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/IdeVersion.java +++ b/plugins/org.eclipse.osee.framework.server.ide.api/src/org/eclipse/osee/framework/server/ide/api/model/IdeVersion.java @@ -8,17 +8,14 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.orcs.rest.model; +package org.eclipse.osee.framework.server.ide.api.model; import java.util.ArrayList; import java.util.List; -import javax.xml.bind.annotation.XmlRootElement; /** * @author Donald G. Dunne */ - -@XmlRootElement public class IdeVersion { private List<String> versions; @@ -39,4 +36,9 @@ public class IdeVersion { public void setVersions(List<String> versions) { this.versions = versions; } + + @Override + public String toString() { + return "IdeVersion [versions=" + versions + "]"; + } } diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/.classpath b/plugins/org.eclipse.osee.framework.server.ide/.classpath index 1fa3e6803d3..1fa3e6803d3 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/.classpath +++ b/plugins/org.eclipse.osee.framework.server.ide/.classpath diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/.pmd b/plugins/org.eclipse.osee.framework.server.ide/.pmd index c7b0a9fb3f5..c7b0a9fb3f5 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/.pmd +++ b/plugins/org.eclipse.osee.framework.server.ide/.pmd diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.server.ide/META-INF/MANIFEST.MF index 6749c014ebf..0bd6f78a748 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.server.ide/META-INF/MANIFEST.MF @@ -1,14 +1,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Servlet Plug-in -Bundle-SymbolicName: org.eclipse.osee.framework.manager.servlet +Bundle-Name: OSEE Server Ide Plug-in +Bundle-SymbolicName: org.eclipse.osee.framework.server.ide Bundle-Version: 0.25.0.qualifier Bundle-ActivationPolicy: lazy Import-Package: com.google.common.collect;version="15.0.0", javax.servlet, javax.servlet.http, - javax.ws.rs;version="2.0.0", - javax.ws.rs.core;version="2.0.0", + javax.ws.rs, + javax.ws.rs.core, org.eclipse.core.runtime, org.eclipse.core.runtime.jobs, org.eclipse.osee.activity.api, @@ -23,6 +23,10 @@ Import-Package: com.google.common.collect;version="15.0.0", org.eclipse.osee.framework.resource.management, org.eclipse.osee.framework.resource.management.exception, org.eclipse.osee.framework.resource.management.util, + org.eclipse.osee.framework.server.ide.api, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.framework.server.ide.api.client.model, + org.eclipse.osee.framework.server.ide.api.model, org.eclipse.osee.jdbc, org.eclipse.osee.logger, org.eclipse.osee.orcs, diff --git a/plugins/org.eclipse.osee.framework.server.ide/OSGI-INF/ide.application.xml b/plugins/org.eclipse.osee.framework.server.ide/OSGI-INF/ide.application.xml new file mode 100644 index 00000000000..1933f699eec --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide/OSGI-INF/ide.application.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop"> + <implementation class="org.eclipse.osee.framework.server.ide.internal.IdeApplication"/> + <service> + <provide interface="javax.ws.rs.core.Application"/> + </service> + <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/> + <reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/> + <reference bind="setActivityLog" cardinality="1..1" interface="org.eclipse.osee.activity.api.ActivityLog" name="ActivityLog" policy="static"/> + <reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static"/> + <reference bind="setAuthenticationManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IAuthenticationManager" name="IAuthenticationManager" policy="static"/> + <reference bind="setSessionManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.ISessionManager" name="ISessionManager" policy="static"/> +</scr:component> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml b/plugins/org.eclipse.osee.framework.server.ide/OSGI-INF/legacy.servlets.xml index 13351340c29..9fc68ee21c4 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml +++ b/plugins/org.eclipse.osee.framework.server.ide/OSGI-INF/legacy.servlets.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop"> - <implementation class="org.eclipse.osee.framework.manager.servlet.internal.ServletRegistrationHandler"/> + <implementation class="org.eclipse.osee.framework.server.ide.internal.ServletRegistrationHandler"/> <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/> <reference bind="setHttpService" cardinality="1..1" interface="org.osgi.service.http.HttpService" name="HttpService" policy="static"/> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties b/plugins/org.eclipse.osee.framework.server.ide/build.properties index 6210e849b59..6210e849b59 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties +++ b/plugins/org.eclipse.osee.framework.server.ide/build.properties diff --git a/plugins/org.eclipse.osee.framework.server.ide/pom.xml b/plugins/org.eclipse.osee.framework.server.ide/pom.xml new file mode 100644 index 00000000000..31da9c8dcaa --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide/pom.xml @@ -0,0 +1,17 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.25.0-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.framework.server.ide</artifactId> + <packaging>eclipse-plugin</packaging> + <name>OSEE Server Ide - (Incubation)</name> + +</project> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AdminServlet.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/AdminServlet.java index aa942c09e17..6fda65f9c1d 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AdminServlet.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/AdminServlet.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet; +package org.eclipse.osee.framework.server.ide; import java.io.IOException; import java.io.PrintWriter; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SessionClientLoopbackServlet.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/SessionClientLoopbackServlet.java index fccd7fae794..7062c7ff408 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/SessionClientLoopbackServlet.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/SessionClientLoopbackServlet.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet; +package org.eclipse.osee.framework.server.ide; import java.io.IOException; import java.io.UnsupportedEncodingException; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java index 52c17a5f31c..6e3f7c1a2b5 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ArtifactUtil.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet.data; +package org.eclipse.osee.framework.server.ide.data; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/HttpSystemManagerCreationInfo.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/HttpSystemManagerCreationInfo.java index a11f961d667..d2d1f7b4109 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/HttpSystemManagerCreationInfo.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/HttpSystemManagerCreationInfo.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet.data; +package org.eclipse.osee.framework.server.ide.data; import javax.servlet.http.HttpServletRequest; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ServletResourceBridge.java index 9c583ec1cc4..781bce0b041 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/data/ServletResourceBridge.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet.data; +package org.eclipse.osee.framework.server.ide.data; import java.io.IOException; import java.io.InputStream; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/ClientResource.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java index 27547a170d9..a4ca9584371 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/client/ClientResource.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.orcs.rest.internal.client; +package org.eclipse.osee.framework.server.ide.internal; import java.io.ByteArrayOutputStream; import java.net.URI; @@ -23,7 +23,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.function.Consumer; import javax.ws.rs.GET; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -33,6 +32,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import org.eclipse.osee.framework.core.data.IdeClientSession; +import org.eclipse.osee.framework.core.data.OseeCodeVersion; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; @@ -44,18 +44,20 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.DateUtil; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint; +import org.eclipse.osee.framework.server.ide.api.client.model.ClientDetails; +import org.eclipse.osee.framework.server.ide.api.client.model.ClientInfo; +import org.eclipse.osee.framework.server.ide.api.client.model.Sessions; +import org.eclipse.osee.framework.server.ide.api.model.IdeVersion; import org.eclipse.osee.jdbc.JdbcService; import org.eclipse.osee.jdbc.JdbcStatement; import org.eclipse.osee.orcs.OrcsApi; import org.eclipse.osee.orcs.data.ArtifactReadable; -import org.eclipse.osee.orcs.rest.internal.client.model.ClientDetails; -import org.eclipse.osee.orcs.rest.internal.client.model.ClientInfo; -import org.eclipse.osee.orcs.rest.internal.client.model.Sessions; /** * @author Donald G. Dunne */ -public class ClientResource { +public class ClientEndpointImpl implements ClientEndpoint { @Context private UriInfo uriInfo; @@ -65,11 +67,12 @@ public class ClientResource { private static final String NEWEST_SESSIONS_BY_USER = "select client_address, user_id, created_on, client_port, client_version, session_id from osee_session where user_id = ? order by created_on desc"; - public ClientResource(JdbcService jdbcService, OrcsApi orcsApi) { + public ClientEndpointImpl(JdbcService jdbcService, OrcsApi orcsApi) { this.jdbcService = jdbcService; this.orcsApi = orcsApi; } + @Override @GET @Path("client") @Produces({MediaType.APPLICATION_JSON}) @@ -79,14 +82,7 @@ public class ClientResource { return Response.ok(activeSessions).build(); } - @PUT - @Path("ideclient") - @Produces({MediaType.APPLICATION_JSON}) - public Response connectIdeClient(IdeClientSession clientSession) { - System.err.println("connect ide client"); - return Response.ok().build(); - } - + @Override @GET @Path("client/details") @Produces({MediaType.APPLICATION_JSON}) @@ -110,6 +106,7 @@ public class ClientResource { * @param idOrName as userId or name; underscores can be used instead of spaces if calling from browser; * @return all client sessions matching idOrName; multiple users sessions can be returned depending */ + @Override @GET @Path("client/{idOrName}") @Produces({MediaType.APPLICATION_JSON}) @@ -140,6 +137,29 @@ public class ClientResource { return Response.ok(sessions).build(); } + @Override + @GET + @Path("client/{userId}/session/{sessionId}") + @Produces({MediaType.TEXT_PLAIN}) + public Response getClientInfo(@PathParam("userId") String userId, @PathParam("sessionId") String sessionId) { + if (!GUID.isValid(sessionId)) { + return Response.ok(String.format("Session [%s] is invalid", sessionId)).build(); + } + IdeClientSession session = getClientSession(sessionId); + String infoStr = getInfoStr(session, true); + return Response.ok(infoStr).build(); + } + + @Override + @GET + @Path("versions") + @Produces({MediaType.APPLICATION_JSON}) + public IdeVersion getSupportedVersions() { + IdeVersion versions = new IdeVersion(); + versions.addVersion(OseeCodeVersion.getVersion()); + return versions; + } + private List<String> getUserIds(String userIdOrName) { List<String> results = new LinkedList<>(); if (Strings.isNumeric(userIdOrName)) { @@ -154,18 +174,6 @@ public class ClientResource { return results; } - @GET - @Path("client/{userId}/session/{sessionId}") - @Produces({MediaType.TEXT_PLAIN}) - public Response getClientInfo(@PathParam("userId") String userId, @PathParam("sessionId") String sessionId) { - if (!GUID.isValid(sessionId)) { - return Response.ok(String.format("Session [%s] is invalid", sessionId)).build(); - } - IdeClientSession session = getClientSession(sessionId); - String infoStr = getInfoStr(session, true); - return Response.ok(infoStr).build(); - } - private static IdeClientSession createSession(JdbcStatement stmt, UriInfo uriInfo) { IdeClientSession session = new IdeClientSession(stmt.getString("CLIENT_ADDRESS"), stmt.getString("CLIENT_PORT"), stmt.getString("USER_ID"), stmt.getString("CLIENT_VERSION"), stmt.getString("SESSION_ID"), @@ -288,4 +296,5 @@ public class ClientResource { } return ""; } + } diff --git a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/IdeApplication.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/IdeApplication.java new file mode 100644 index 00000000000..2633f6e1a9f --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/IdeApplication.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * 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.server.ide.internal; + +import java.util.HashSet; +import java.util.Set; +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import org.eclipse.osee.activity.api.ActivityLog; +import org.eclipse.osee.framework.core.server.IAuthenticationManager; +import org.eclipse.osee.framework.core.server.ISessionManager; +import org.eclipse.osee.framework.resource.management.IResourceManager; +import org.eclipse.osee.jdbc.JdbcService; +import org.eclipse.osee.orcs.OrcsApi; + +/** + * Get application.wadl at this context to get rest documentation + * + * @author Roberto E. Escobar + */ +@ApplicationPath("ide") +public class IdeApplication extends Application { + + private final Set<Object> resources = new HashSet<>(); + private final Set<Class<?>> classes = new HashSet<>(); + private static OrcsApi orcsApi; + + private IResourceManager resourceManager; + private ActivityLog activityLog; + private JdbcService jdbcService; + private IAuthenticationManager authenticationManager; + private ISessionManager sessionManager; + + public void setOrcsApi(OrcsApi orcsApi) { + IdeApplication.orcsApi = orcsApi; + } + + public void setJdbcService(JdbcService jdbcService) { + this.jdbcService = jdbcService; + } + + public void setActivityLog(ActivityLog activityLog) { + this.activityLog = activityLog; + } + + public void setResourceManager(IResourceManager resourceManager) { + this.resourceManager = resourceManager; + } + + public void setAuthenticationManager(IAuthenticationManager authenticationManager) { + this.authenticationManager = authenticationManager; + } + + public void setSessionManager(ISessionManager sessionManager) { + this.sessionManager = sessionManager; + } + + public static OrcsApi getOrcsApi() { + return orcsApi; + } + + public void start() { + resources.add(new ClientEndpointImpl(jdbcService, orcsApi)); + resources.add(new SessionEndpointImpl(jdbcService, orcsApi, authenticationManager, sessionManager, activityLog)); + } + + public void stop() { + resources.clear(); + classes.clear(); + } + + @Override + public Set<Class<?>> getClasses() { + return classes; + } + + @Override + public Set<Object> getSingletons() { + return resources; + } + +} 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.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ServletRegistrationHandler.java index 78ec25ed733..b1c936017d8 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.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ServletRegistrationHandler.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet.internal; +package org.eclipse.osee.framework.server.ide.internal; import java.util.HashSet; import java.util.Set; @@ -18,9 +18,8 @@ import org.eclipse.osee.framework.core.server.IApplicationServerManager; import org.eclipse.osee.framework.core.server.IAuthenticationManager; import org.eclipse.osee.framework.core.server.ISessionManager; import org.eclipse.osee.framework.core.server.OseeHttpServlet; -import org.eclipse.osee.framework.manager.servlet.AdminServlet; -import org.eclipse.osee.framework.manager.servlet.SessionClientLoopbackServlet; -import org.eclipse.osee.framework.manager.servlet.SessionManagementServlet; +import org.eclipse.osee.framework.server.ide.AdminServlet; +import org.eclipse.osee.framework.server.ide.SessionClientLoopbackServlet; import org.eclipse.osee.logger.Log; import org.osgi.framework.BundleContext; import org.osgi.service.http.HttpService; @@ -75,8 +74,6 @@ public class ServletRegistrationHandler { private void registerServices(BundleContext context) { contexts.clear(); - register(new SessionManagementServlet(logger, sessionManager, authenticationManager, activityLog), - OseeServerContext.SESSION_CONTEXT); register(new SessionClientLoopbackServlet(logger, sessionManager), OseeServerContext.CLIENT_LOOPBACK_CONTEXT); register(new AdminServlet(logger, context), "osee/console"); diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletUtil.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ServletUtil.java index 53fbf55b17b..ae7096b8e9c 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletUtil.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ServletUtil.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.manager.servlet.internal; +package org.eclipse.osee.framework.server.ide.internal; import java.util.Collection; import org.eclipse.osee.framework.core.server.IApplicationServerManager; diff --git a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java new file mode 100644 index 00000000000..408b0ea249c --- /dev/null +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2015 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.server.ide.internal; + +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import org.eclipse.osee.activity.api.Activity; +import org.eclipse.osee.activity.api.ActivityLog; +import org.eclipse.osee.framework.core.data.OseeCredential; +import org.eclipse.osee.framework.core.data.OseeSessionGrant; +import org.eclipse.osee.framework.core.server.IAuthenticationManager; +import org.eclipse.osee.framework.core.server.ISession; +import org.eclipse.osee.framework.core.server.ISessionManager; +import org.eclipse.osee.framework.server.ide.api.SessionEndpoint; +import org.eclipse.osee.jdbc.JdbcService; +import org.eclipse.osee.orcs.OrcsApi; + +/** + * @author Donald G. Dunne + */ +public class SessionEndpointImpl implements SessionEndpoint { + + @Context + private UriInfo uriInfo; + + private final JdbcService jdbcService; + private final OrcsApi orcsApi; + private final IAuthenticationManager authenticationManager; + private final ISessionManager sessionManager; + + private final ActivityLog activityLog; + + public SessionEndpointImpl(JdbcService jdbcService, OrcsApi orcsApi, IAuthenticationManager authenticationManager, ISessionManager sessionManager, ActivityLog activityLog) { + this.jdbcService = jdbcService; + this.orcsApi = orcsApi; + this.authenticationManager = authenticationManager; + this.sessionManager = sessionManager; + this.activityLog = activityLog; + } + + @Override + @PUT + @Path("session") + @Consumes({MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_JSON}) + public Response createIdeClientSession(OseeCredential credential) { + OseeSessionGrant sessionGrant = sessionManager.createSession(credential); + if (sessionGrant != null) { + logSessionCreation(credential, sessionGrant); + } else { + // session could not be created due to version or invalid user + Response.serverError().status(Status.FORBIDDEN).entity("Unable to create session"); + } + return Response.ok().entity(sessionGrant).build(); + } + + @Override + @DELETE + @Path("session/{sessionId}") + @Produces({MediaType.APPLICATION_JSON}) + public Response releaseIdeClientSession(@PathParam("sessionId") String sessionId) { + logSessionReleased(sessionId); + sessionManager.releaseSession(sessionId); + return Response.ok().build(); + } + + @Override + @GET + @Path("session/protocols") + @Produces({MediaType.APPLICATION_JSON}) + public Response getIdeClientProtocols() { + List<String> protocols = new LinkedList<String>(); + for (String protocol : authenticationManager.getProtocols()) { + protocols.add(protocol); + } + return Response.ok(protocols).build(); + } + + private void logSessionCreation(OseeCredential credential, OseeSessionGrant oseeSessionGrant) { + try { + activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS, + String.format( + "IDE Client Session Created " // + + "{" // + + "\"version\":\"%s\", " // + + "\"clientAddress\":\"%s\", " // + + "\"clientMachineName\":\"%s\", " // + + "\"port\":\"%s\", " // + + "\"userName\":\"%s\", " // + + "\"userId\":\"%s\", " // + + "\"sessionId\":\"%s\"" // + + "}", // + credential.getClientVersion(), credential.getClientAddress(), credential.getClientAddress(), + credential.getClientPort(), credential.getUserName(), oseeSessionGrant.getUserToken().getUserId(), + oseeSessionGrant.getSessionId())); + } catch (Exception ex) { + // do nothing + } + } + + private void logSessionReleased(String sessionId) { + try { + ISession session = sessionManager.getSessionById(sessionId); + String duration = getDuration(session); + String userId = session != null ? session.getUserId() : "unknown"; + activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS, + String.format( + "IDE Client Session Released " // + + "{" // + + "\"sessionId\":\"%s\", " // + + "\"duration\":\"%s\", " // + + "\"userId\":\"%s\"" // + + "}", // + sessionId, duration, userId)); + } catch (Exception ex) { + // do nothing + } + } + + /** + * @return duration in H:M:S + */ + private String getDuration(ISession session) { + String duration = "0"; + if (session != null) { + duration = String.valueOf(new Date().getTime() - session.getCreationDate().getTime()); + } + return duration; + } + +} diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF index 691267d3513..87135458d92 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF @@ -92,6 +92,8 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.osee.framework.logging, org.eclipse.osee.framework.plugin.core, org.eclipse.osee.framework.plugin.core.util, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.framework.server.ide.api.model, org.eclipse.osee.framework.skynet.core, org.eclipse.osee.framework.skynet.core.artifact, org.eclipse.osee.framework.skynet.core.artifact.factory, diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/AuthenticationDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/AuthenticationDialog.java index 8e152b34aba..a920014ec23 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/AuthenticationDialog.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/AuthenticationDialog.java @@ -96,10 +96,6 @@ public class AuthenticationDialog extends OseeMessageDialog { authenticationComposite.setPassword(password); } - private void setDomain(String domain) { - authenticationComposite.setDomain(domain); - } - private void setStorageAllowed(boolean isStorageAllowed) { authenticationComposite.setStorageAllowed(isStorageAllowed); } @@ -112,10 +108,6 @@ public class AuthenticationDialog extends OseeMessageDialog { return authenticationComposite.getUserName(); } - private String getDomain() { - return authenticationComposite.getDomain(); - } - private boolean isStorageAllowed() { return authenticationComposite.isStorageAllowed(); } @@ -155,7 +147,6 @@ public class AuthenticationDialog extends OseeMessageDialog { String dialogTitle = "Authentication Failed"; String endMsg = "Shutting down the workbench."; String user = ""; - String domain = ""; String message = ""; boolean isStorageAllowed = false; boolean isGuestLogin = false; @@ -167,14 +158,12 @@ public class AuthenticationDialog extends OseeMessageDialog { if (numberOfTries != 0) { dialog.setUserName(user); dialog.setPassword(""); - dialog.setDomain(domain); dialog.setStorageAllowed(isStorageAllowed); dialog.setGuestLogin(isGuestLogin); } int result = dialog.open(); user = dialog.getUserName(); - domain = dialog.getDomain(); isStorageAllowed = dialog.isStorageAllowed(); isGuestLogin = dialog.isGuestLogin(); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AuthenticationComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AuthenticationComposite.java index 830a530c387..67714f7d3cc 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AuthenticationComposite.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AuthenticationComposite.java @@ -54,7 +54,6 @@ public class AuthenticationComposite extends Composite { private enum LabelEnum { UserId("Enter user name"), Password(true, "Enter a valid password"), - Domain("Enter a valid domain [sw, nw, etc...]"), Remember_My_Password(WARNING_MESSAGE); boolean isHidden; @@ -264,7 +263,6 @@ public class AuthenticationComposite extends Composite { OseeCredential credential = super.getCredential(); credential.setUserName(dataMap.get(LabelEnum.UserId)); credential.setPassword(dataMap.get(LabelEnum.Password)); - credential.setDomain(dataMap.get(LabelEnum.Domain)); return credential; } }); @@ -316,10 +314,6 @@ public class AuthenticationComposite extends Composite { setAndStoreField(LabelEnum.Password, password); } - public void setDomain(String domain) { - setAndStoreField(LabelEnum.Domain, domain); - } - public void setStorageAllowed(boolean isStorageAllowed) { setAndStoreField(LabelEnum.Remember_My_Password, Boolean.toString(isStorageAllowed)); } @@ -359,10 +353,6 @@ public class AuthenticationComposite extends Composite { return dataMap.get(LabelEnum.Password); } - public String getDomain() { - return dataMap.get(LabelEnum.Domain); - } - public boolean isGuestLogin() { return isGuestLogin; } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java index ed0562e33e3..642a399ca1c 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java @@ -16,12 +16,11 @@ import org.eclipse.osee.framework.core.client.OseeClientProperties; import org.eclipse.osee.framework.core.data.OseeCodeVersion; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint; +import org.eclipse.osee.framework.server.ide.api.model.IdeVersion; import org.eclipse.osee.framework.ui.plugin.OseeUiActivator; -import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil; +import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.JaxRsExceptions; -import org.eclipse.osee.orcs.rest.client.OseeClient; -import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint; -import org.eclipse.osee.orcs.rest.model.IdeVersion; /** * @author Donald G Dunne @@ -30,6 +29,7 @@ public class DbConnectionUtility { private static Boolean supported; private static Boolean applicationServerAlive; + private static ClientEndpoint clientEp; public static Result areOSEEServicesAvailable() { Result toReturn = Result.FalseResult; @@ -88,12 +88,10 @@ public class DbConnectionUtility { private static Collection<String> getIdeClientSupportedVersions() { IdeVersion clientResult = null; - - OseeClient client = ServiceUtil.getOseeClient(); + ClientEndpoint client = getClientEndpoint(); if (client != null) { - IdeClientEndpoint endpoint = client.getIdeClientEndpoint(); try { - clientResult = endpoint.getSupportedVersions(); + clientResult = client.getSupportedVersions(); } catch (Exception ex) { throw JaxRsExceptions.asOseeException(ex); } @@ -101,4 +99,14 @@ public class DbConnectionUtility { return clientResult != null ? clientResult.getVersions() : Collections.<String> emptySet(); } + private static ClientEndpoint getClientEndpoint() { + if (clientEp == null) { + String appServer = OseeClientProperties.getOseeApplicationServer(); + String orcsUri = String.format("%s/ide", appServer); + JaxRsClient jaxRsClient = JaxRsClient.newBuilder().build(); + clientEp = jaxRsClient.target(orcsUri).newProxy(ClientEndpoint.class); + } + return clientEp; + } + } diff --git a/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF index 7c99845817c..332a5f2f321 100644 --- a/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF @@ -14,6 +14,7 @@ Import-Package: javax.ws.rs;version="2.0.0", org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, + org.eclipse.osee.framework.server.ide.api.client, org.eclipse.osee.jaxrs.client, org.eclipse.osee.orcs.rest.model, org.eclipse.osee.orcs.rest.model.search.artifact 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 2f6e2c655aa..4a261d34b69 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 @@ -15,10 +15,10 @@ import java.util.Properties; import javax.ws.rs.core.MediaType; import org.eclipse.osee.define.report.api.WordUpdateEndpoint; import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint; import org.eclipse.osee.orcs.rest.model.ApplicabilityEndpoint; import org.eclipse.osee.orcs.rest.model.BranchEndpoint; import org.eclipse.osee.orcs.rest.model.DatastoreEndpoint; -import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint; import org.eclipse.osee.orcs.rest.model.IndexerEndpoint; import org.eclipse.osee.orcs.rest.model.OrcsWriterEndpoint; import org.eclipse.osee.orcs.rest.model.ResourcesEndpoint; @@ -44,7 +44,7 @@ public interface OseeClient { IndexerEndpoint getIndexerEndpoint(); - IdeClientEndpoint getIdeClientEndpoint(); + ClientEndpoint getClientEndpoint(); ResourcesEndpoint getResourcesEndpoint(); 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 e082b299ecc..8a2fb3bdfe0 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 @@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.data.BranchId; 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.server.ide.api.client.ClientEndpoint; import org.eclipse.osee.jaxrs.client.JaxRsClient; import org.eclipse.osee.jaxrs.client.JaxRsExceptions; import org.eclipse.osee.jaxrs.client.JaxRsWebTarget; @@ -39,7 +40,6 @@ import org.eclipse.osee.orcs.rest.client.internal.search.QueryOptions; import org.eclipse.osee.orcs.rest.model.ApplicabilityEndpoint; import org.eclipse.osee.orcs.rest.model.BranchEndpoint; import org.eclipse.osee.orcs.rest.model.DatastoreEndpoint; -import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint; import org.eclipse.osee.orcs.rest.model.IndexerEndpoint; import org.eclipse.osee.orcs.rest.model.OrcsWriterEndpoint; import org.eclipse.osee.orcs.rest.model.ResourcesEndpoint; @@ -177,8 +177,8 @@ public class OseeClientImpl implements OseeClient, QueryExecutor { } @Override - public IdeClientEndpoint getIdeClientEndpoint() { - return client.targetProxy(baseUri, IdeClientEndpoint.class); + public ClientEndpoint getClientEndpoint() { + return client.targetProxy(baseUri, ClientEndpoint.class); } @Override diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/IdeClientEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/IdeClientEndpoint.java deleted file mode 100644 index 788356dbad6..00000000000 --- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/IdeClientEndpoint.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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.orcs.rest.model; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -/** - * @author Roberto E. Escobar - */ -@Path("ide") -public interface IdeClientEndpoint { - - @GET - @Path("versions") - @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - IdeVersion getSupportedVersions(); - -} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/IdeClientEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/IdeClientEndpointImpl.java deleted file mode 100644 index 0347f4a9cf3..00000000000 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/IdeClientEndpointImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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.orcs.rest.internal; - -import org.eclipse.osee.framework.core.data.OseeCodeVersion; -import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint; -import org.eclipse.osee.orcs.rest.model.IdeVersion; - -/** - * @author Roberto E. Escobar - */ -public class IdeClientEndpointImpl implements IdeClientEndpoint { - - @Override - public IdeVersion getSupportedVersions() { - IdeVersion versions = new IdeVersion(); - versions.addVersion(OseeCodeVersion.getVersion()); - return versions; - } - -} diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java index f48fecb1d9d..908ac49f350 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java @@ -20,7 +20,6 @@ import org.eclipse.osee.framework.resource.management.IResourceManager; import org.eclipse.osee.jdbc.JdbcService; import org.eclipse.osee.orcs.OrcsApi; import org.eclipse.osee.orcs.rest.admin.LinkUpdateResource; -import org.eclipse.osee.orcs.rest.internal.client.ClientResource; import org.eclipse.osee.orcs.rest.internal.writer.OrcsWriterEndpointImpl; import org.osgi.service.event.EventAdmin; @@ -70,7 +69,6 @@ public class OrcsApplication extends Application { resources.add(new OrcsScriptResource(engine)); classes.add(BranchesResource.class); - resources.add(new IdeClientEndpointImpl()); resources.add(new BranchEndpointImpl(orcsApi, resourceManager, activityLog)); resources.add(new OrcsWriterEndpointImpl(orcsApi)); @@ -81,7 +79,6 @@ public class OrcsApplication extends Application { resources.add(new ResourcesEndpointImpl(resourceManager)); resources.add(new DatastoreEndpointImpl(orcsApi, activityLog)); resources.add(new KeyValueResource(orcsApi)); - resources.add(new ClientResource(jdbcService, orcsApi)); resources.add(new LinkUpdateResource(orcsApi)); } diff --git a/plugins/org.eclipse.osee.support.config/projectSets/OseeAppServerProjectSet.psf b/plugins/org.eclipse.osee.support.config/projectSets/OseeAppServerProjectSet.psf index f2653942b1c..0b85f202bf2 100644 --- a/plugins/org.eclipse.osee.support.config/projectSets/OseeAppServerProjectSet.psf +++ b/plugins/org.eclipse.osee.support.config/projectSets/OseeAppServerProjectSet.psf @@ -12,8 +12,8 @@ <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.jdk.core,org.eclipse.osee.framework.jdk.core,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.jdk.core.test,org.eclipse.osee.framework.jdk.core.test,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.logging,org.eclipse.osee.framework.logging,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> -<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.manager.servlet,org.eclipse.osee.framework.manager.servlet,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> -<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.manager.servlet.test,org.eclipse.osee.framework.manager.servlet.test,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> +<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.server.ide,org.eclipse.osee.framework.server.ide,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> +<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.server.ide.test,org.eclipse.osee.framework.server.ide.test,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.oracle,org.eclipse.osee.framework.oracle,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.postgresql,org.eclipse.osee.framework.postgresql,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> <project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/plugins/org.eclipse.osee.framework.resource.locator.attribute,org.eclipse.osee.framework.resource.locator.attribute,a084f48b7e5f001f18d0b45ce6486f0a;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;https://dev.eclipse.org/svnroot/technology/org.eclipse.osee;;false;;;22"/> @@ -37,7 +37,7 @@ <item elementID="=org.eclipse.osee.framework.database" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.server.tests" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.search.engine.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> -<item elementID="=org.eclipse.osee.framework.manager.servlet.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> +<item elementID="=org.eclipse.osee.framework.server.ide.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.core" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.core.server" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.types.tests" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> @@ -49,7 +49,7 @@ <item elementID="=org.eclipse.osee.framework.postgresql" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.resource.management.servlet.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.resource.locator.attribute" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> -<item elementID="=org.eclipse.osee.framework.manager.servlet" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> +<item elementID="=org.eclipse.osee.framework.server.ide" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.osee.framework.server.feature" type="4"/> <item elementID="=org.eclipse.osee.framework.branch.management.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> <item elementID="=org.eclipse.osee.framework.resource.locator.attribute.test" factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory"/> diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF index da2f62326c4..dd588e7399a 100644 --- a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF @@ -14,6 +14,9 @@ Import-Package: javax.ws.rs.core;version="2.0.0", org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, + org.eclipse.osee.framework.server.ide.api, + org.eclipse.osee.framework.server.ide.api.client, + org.eclipse.osee.framework.server.ide.api.model, org.eclipse.osee.jaxrs, org.eclipse.osee.jaxrs.client, org.eclipse.osee.orcs.rest.client, diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java index 1458006275c..a3976a74750 100644 --- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java +++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java @@ -20,10 +20,8 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Active; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.StringWriter; -import java.util.Collection; import java.util.Properties; import javax.ws.rs.core.MediaType; import org.eclipse.osee.framework.core.enums.CoreArtifactTokens; @@ -33,8 +31,6 @@ import org.eclipse.osee.framework.core.enums.SystemUser; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.orcs.rest.client.OseeClient; -import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint; -import org.eclipse.osee.orcs.rest.model.IdeVersion; import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType; import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResult; import org.eclipse.osee.x.server.integration.tests.util.IntegrationUtil; @@ -165,15 +161,6 @@ public class OseeClientQueryTest { assertEquals(EXPECTED_RESULTS, results.getTotal()); } - @Test - public void supportedVersions() { - IdeClientEndpoint endpoint = createClient.getIdeClientEndpoint(); - IdeVersion versions = endpoint.getSupportedVersions(); - assertNotNull(versions); - Collection<String> supportedVersions = versions.getVersions(); - assertEquals(true, !supportedVersions.isEmpty()); - } - /** * This test simply ensures that the client endpoint to run Orcs Script works. OrcsScriptTest is the more exhaustive * test of Orcs Script. diff --git a/plugins/org.eclipse.osee.x.server.parent/pom.xml b/plugins/org.eclipse.osee.x.server.parent/pom.xml index 5cf4621d580..24bcc9c980e 100644 --- a/plugins/org.eclipse.osee.x.server.parent/pom.xml +++ b/plugins/org.eclipse.osee.x.server.parent/pom.xml @@ -36,7 +36,8 @@ <module>../../plugins/org.eclipse.osee.framework.authentication.ldap.core</module> <module>../../plugins/org.eclipse.osee.framework.core.server</module> <module>../../plugins/org.eclipse.osee.framework.core.server.test</module> - <module>../../plugins/org.eclipse.osee.framework.manager.servlet</module> + <module>../../plugins/org.eclipse.osee.framework.server.ide.api</module> + <module>../../plugins/org.eclipse.osee.framework.server.ide</module> <module>../../plugins/org.eclipse.osee.web.ui</module> <!-- <module>../../plugins/org.eclipse.osee.web.ui.test</module> --> @@ -69,7 +70,8 @@ <module>../../plugins/org.eclipse.osee.framework.authentication.ldap.core</module> <module>../../plugins/org.eclipse.osee.framework.core.server</module> <module>../../plugins/org.eclipse.osee.framework.core.server.test</module> - <module>../../plugins/org.eclipse.osee.framework.manager.servlet</module> + <module>../../plugins/org.eclipse.osee.framework.server.ide.api</module> + <module>../../plugins/org.eclipse.osee.framework.server.ide</module> <module>../../plugins/org.eclipse.osee.web.ui</module> <!-- <module>../../plugins/org.eclipse.osee.web.ui.test</module> --> |