Added usage of common-utility
This commit is contained in:
parent
9b84168926
commit
ee9344cee1
|
@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
## [v4.3.0-SNAPSHOT]
|
||||
|
||||
- Enhanced gcube-bom version
|
||||
- Added usage of common-utility to overcome issues with different Smartgears version (i.e. 3 and 4)
|
||||
|
||||
|
||||
## [v4.2.0]
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -49,6 +49,10 @@
|
|||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>gxHTTP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-utility</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.common.gxhttp.reference.GXConnection;
|
||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||
import org.gcube.common.http.GXHTTPUtility;
|
||||
import org.gcube.informationsystem.base.reference.Direction;
|
||||
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.ERElement;
|
||||
|
@ -37,7 +38,6 @@ import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
|||
import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.QueryTemplatePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.ServiceInstance;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.api.utils.Utility;
|
||||
|
@ -108,7 +108,6 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
return gxHTTPStringRequest.queryParams(queryParams);
|
||||
}
|
||||
|
||||
|
||||
protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() {
|
||||
|
||||
@Override
|
||||
|
@ -129,7 +128,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
public List<Context> getAllContextFromServer() throws ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to read all {}s", Context.NAME);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -165,7 +164,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
// TODO use cache
|
||||
|
||||
logger.info("Going to get current {} ", Context.NAME);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -230,7 +229,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
|
||||
@Override
|
||||
public Context getCurrentContext() throws ContextNotFoundException, ResourceRegistryException {
|
||||
String contextFullName = ServiceInstance.getCurrentContextFullName();
|
||||
String contextFullName = org.gcube.common.context.ContextUtility.getCurrentContextFullName();
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
UUID uuid = contextCache.getUUIDByFullName(contextFullName);
|
||||
Context context = null;
|
||||
|
@ -259,7 +258,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
public boolean existType(String typeName) throws ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to get {} schema", typeName);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -306,7 +305,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws SchemaNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to get {} schema", typeName);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -351,7 +350,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
public String getInstances(String type, Boolean polymorphic) throws ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to get all instances of {} ", type);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -389,7 +388,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws AvailableInAnotherContextException, ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to check if {} with UUID {} exists", type, uuid);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -433,7 +432,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to get {} with UUID {}", type, uuid);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -469,7 +468,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
|
||||
try {
|
||||
logger.info("Going to query. {}", query);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -501,7 +500,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws ResourceRegistryException {
|
||||
|
||||
try {
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -732,7 +731,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to get contexts of {} with UUID {}", type, uuid);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -761,7 +760,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
public List<QueryTemplate> getAllQueryTemplates() throws ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to list {}s", QueryTemplate.NAME);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -795,7 +794,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to read {} with name {}", QueryTemplate.NAME, queryTemplateName);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -839,7 +838,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to read {} with name {}", QueryTemplate.NAME, queryTemplateName);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.path(AccessPath.ACCESS_PATH_PART);
|
||||
|
@ -897,7 +896,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
logger.trace("Going to run {} with the following parameters {}", QueryTemplate.NAME, params);
|
||||
}
|
||||
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
|
@ -943,7 +942,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
try {
|
||||
logger.trace("Going to run the following JSON Query {}", query);
|
||||
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistryClient.class.getSimpleName());
|
||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
|
|
Loading…
Reference in New Issue