Added usage of common-utility
This commit is contained in:
parent
00c275d22f
commit
926812df1d
|
@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
## [v4.2.0-SNAPSHOT]
|
## [v4.2.0-SNAPSHOT]
|
||||||
|
|
||||||
- Enhanced gcube-bom version
|
- Enhanced gcube-bom version
|
||||||
|
- Added usage of common-utility to overcome issues with different Smartgears version (i.e. 3 and 4)
|
||||||
|
|
||||||
|
|
||||||
## [v4.1.0]
|
## [v4.1.0]
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -49,6 +49,10 @@
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>gxHTTP</artifactId>
|
<artifactId>gxHTTP</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>common-utility</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.common.gxhttp.reference.GXConnection;
|
import org.gcube.common.gxhttp.reference.GXConnection;
|
||||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||||
|
import org.gcube.common.http.GXHTTPUtility;
|
||||||
import org.gcube.informationsystem.base.reference.Element;
|
import org.gcube.informationsystem.base.reference.Element;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
|
@ -57,7 +58,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
logger.trace("Going to create: {}", typeDefinitition);
|
logger.trace("Going to create: {}", typeDefinitition);
|
||||||
Type typeDefinitionObj = TypeMapper.deserializeTypeDefinition(typeDefinitition);
|
Type typeDefinitionObj = TypeMapper.deserializeTypeDefinition(typeDefinitition);
|
||||||
|
|
||||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||||
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
||||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
|
@ -93,7 +94,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
public boolean exist(String typeName) throws ResourceRegistryException {
|
public boolean exist(String typeName) throws ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
logger.info("Going to get {} schema", typeName);
|
logger.info("Going to get {} schema", typeName);
|
||||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||||
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
||||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
gxHTTPStringRequest.path(TypePath.TYPES_PATH_PART);
|
gxHTTPStringRequest.path(TypePath.TYPES_PATH_PART);
|
||||||
|
@ -135,7 +136,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
public String read(String typeName, Boolean polymorphic) throws ContextNotFoundException, ResourceRegistryException {
|
public String read(String typeName, Boolean polymorphic) throws ContextNotFoundException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
logger.info("Going to get {} schema", typeName);
|
logger.info("Going to get {} schema", typeName);
|
||||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPUtility.getGXHTTPStringRequest(address);
|
||||||
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
||||||
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
gxHTTPStringRequest.path(TypePath.TYPES_PATH_PART);
|
gxHTTPStringRequest.path(TypePath.TYPES_PATH_PART);
|
||||||
|
|
Loading…
Reference in New Issue