Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2021-01-22 05:43:53 +0000
committerRyan D. Brooks2021-01-27 23:00:55 +0000
commitd82a061e3c345b494db38ba5e8669f7f08c780b7 (patch)
treed7164a1c531603bb2e053b11217c86f1d3d27f04
parent41aa64c66a68d27b4ad6b4c2e6ebcfb2f9c6925c (diff)
downloadorg.eclipse.osee-d82a061e3c345b494db38ba5e8669f7f08c780b7.tar.gz
org.eclipse.osee-d82a061e3c345b494db38ba5e8669f7f08c780b7.tar.xz
org.eclipse.osee-d82a061e3c345b494db38ba5e8669f7f08c780b7.zip
refactor[TW18625]: Expose JaxRsApi from OseeClient
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java15
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java25
5 files changed, 17 insertions, 28 deletions
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 c1659a49e0a..878c3d55dfd 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
@@ -136,7 +136,6 @@ Import-Package: com.fasterxml.jackson.core.type,
org.eclipse.osee.framework.ui.swt,
org.eclipse.osee.framework.ui.swt.styledText,
org.eclipse.osee.framework.ui.ws,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.jdbc,
org.eclipse.osee.orcs.rest.client,
org.eclipse.osee.orcs.rest.model,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
index ba2be89646a..5817ab8b07f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
@@ -13,17 +13,15 @@
package org.eclipse.osee.framework.ui.skynet;
-import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import javax.ws.rs.NotFoundException;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.util.JsonUtil;
@@ -38,7 +36,6 @@ import org.eclipse.osee.framework.ui.skynet.util.DynamicImage;
import org.eclipse.osee.framework.ui.skynet.util.DynamicImages;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.ProgramImage;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.swt.graphics.Image;
/**
@@ -107,17 +104,14 @@ public class FrameworkArtifactImageProvider extends ArtifactImageProvider {
}
private void readDynamicImagesFromUrl() {
-
try {
- String appServer = OseeClientProperties.getOseeApplicationServer();
- URI uri = UriBuilder.fromUri(appServer).path("images.json").build();
-
// first, retrieve the images.json file to see if there are any images
+ WebTarget target = ServiceUtil.getOseeClient().jaxRsApi().newTarget("images.json");
String imagesJson = null;
try {
- imagesJson = JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
+ imagesJson = target.request(MediaType.TEXT_PLAIN).get(String.class);
} catch (Exception ex) {
- // do nothing if does't exist
+ return;
}
if (Strings.isValid(imagesJson)) {
@@ -164,7 +158,6 @@ public class FrameworkArtifactImageProvider extends ArtifactImageProvider {
"Error processing dynamic artifact images.");
}
}
-
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml b/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml
index 4553c021353..5641ddee335 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml
+++ b/plugins/org.eclipse.osee.orcs.rest.client/OSGI-INF/osee.client.xml
@@ -5,4 +5,5 @@
<provide interface="org.eclipse.osee.orcs.rest.client.OseeClient"/>
</service>
<reference bind="setJaxRsApi" cardinality="1..1" interface="org.eclipse.osee.framework.core.JaxRsApi" name="jaxRsApi" policy="static"/>
+ <reference bind="setOrcsTokenService" cardinality="1..1" interface="org.eclipse.osee.framework.core.OrcsTokenService" name="OrcsTokenService" policy="static"/>
</scr:component>
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 8f324da01cf..12904fcd0b3 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
@@ -17,6 +17,7 @@ import org.eclipse.osee.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.define.api.DataRightsEndpoint;
import org.eclipse.osee.define.api.DefineBranchEndpointApi;
import org.eclipse.osee.define.api.RenderEndpoint;
+import org.eclipse.osee.framework.core.OseeApi;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -36,7 +37,7 @@ import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
/**
* @author John Misinco
*/
-public interface OseeClient {
+public interface OseeClient extends OseeApi {
String OSEE_APPLICATION_SERVER = org.eclipse.osee.framework.core.data.OseeClient.OSEE_APPLICATION_SERVER;
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 e8d6f9ff5d0..392c75f289b 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
@@ -23,7 +23,7 @@ import org.eclipse.osee.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.define.api.DataRightsEndpoint;
import org.eclipse.osee.define.api.DefineBranchEndpointApi;
import org.eclipse.osee.define.api.RenderEndpoint;
-import org.eclipse.osee.framework.core.JaxRsApi;
+import org.eclipse.osee.framework.core.OseeApiBase;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -57,14 +57,9 @@ import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResult;
* @author John Misinco
* @author Roberto E. Escobar
*/
-public class OseeClientImpl implements OseeClient, QueryExecutor {
+public class OseeClientImpl extends OseeApiBase implements OseeClient, QueryExecutor {
private PredicateFactory predicateFactory;
- private JaxRsApi jaxRsApi;
-
- public void setJaxRsApi(JaxRsApi jaxRsApi) {
- this.jaxRsApi = jaxRsApi;
- }
public void start(Map<String, Object> properties) {
predicateFactory = new PredicateFactoryImpl();
@@ -106,7 +101,7 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
}
SearchRequest params = new SearchRequest(branch, predicates, requestType, fromTx, includeDeleted);
- WebTarget target = jaxRsApi.newTarget("orcs/branch/" + branch.getIdString() + "/artifact/search/v1");
+ WebTarget target = jaxRsApi().newTarget("orcs/branch/" + branch.getIdString() + "/artifact/search/v1");
return target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
}
@@ -133,7 +128,7 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
@Override
public ClientEndpoint getClientEndpoint() {
- return jaxRsApi.newProxy("ide", ClientEndpoint.class);
+ return jaxRsApi().newProxy("ide", ClientEndpoint.class);
}
@Override
@@ -178,7 +173,7 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
@Override
public ActivityLogEndpoint getActivityLogEndpoint() {
- return jaxRsApi.newProxy("", ActivityLogEndpoint.class);
+ return jaxRsApi().newProxy("", ActivityLogEndpoint.class);
}
@Override
@@ -187,27 +182,27 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
}
private <T> T getOrcsBranchEndpoint(Class<T> clazz, BranchId branch) {
- return jaxRsApi.newProxy("orcs/branch/" + branch.getIdString(), clazz);
+ return jaxRsApi().newProxy("orcs/branch/" + branch.getIdString(), clazz);
}
private <T> T getDefineEndpoint(Class<T> clazz) {
- return jaxRsApi.newProxy("define", clazz);
+ return jaxRsApi().newProxy("define", clazz);
}
private <T> T getOrcsEndpoint(Class<T> clazz) {
- return jaxRsApi.newProxy("orcs", clazz);
+ return jaxRsApi().newProxy("orcs", clazz);
}
@Override
public SessionEndpoint getSessionEndpoint() {
- return jaxRsApi.newProxy("ide", SessionEndpoint.class);
+ return jaxRsApi().newProxy("ide", SessionEndpoint.class);
}
@Override
public String loadAttributeValue(Integer attrId, TransactionId transactionId, ArtifactToken artifact) {
String url = String.format("orcs/branch/%s/artifact/%s/attribute/%s/version/%s/text",
artifact.getBranchIdString(), artifact.getIdString(), attrId, transactionId.getIdString());
- WebTarget target = jaxRsApi.newTarget(url);
+ WebTarget target = jaxRsApi().newTarget(url);
return target.request(MediaType.TEXT_PLAIN).get(String.class);
}
} \ No newline at end of file

Back to the top