2017-12-18 15:37:22 +01:00
|
|
|
package org.gcube.informationsystem.resourceregistry.schema;
|
2017-12-18 15:34:25 +01:00
|
|
|
|
|
|
|
import org.gcube.informationsystem.resourceregistry.api.Constants;
|
2022-07-21 18:18:54 +02:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.rest.ServiceInstance;
|
2017-12-18 15:34:25 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class ResourceRegistrySchemaClientFactory {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ResourceRegistrySchemaClientFactory.class);
|
2023-02-10 15:36:58 +01:00
|
|
|
|
2023-03-02 14:52:43 +01:00
|
|
|
public static String getResourceRegistryURL() {
|
2022-07-25 11:18:52 +02:00
|
|
|
String address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME);
|
2023-03-02 14:52:43 +01:00
|
|
|
return address;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getResourceRegistryURL(String context) {
|
|
|
|
String address = String.format("%s/%s", ServiceInstance.getServiceURL(context),Constants.SERVICE_NAME);
|
|
|
|
return address;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ResourceRegistrySchemaClient create() {
|
|
|
|
String address = getResourceRegistryURL();
|
2022-07-21 18:18:54 +02:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
2020-11-04 16:33:33 +01:00
|
|
|
return new ResourceRegistrySchemaClientImpl(address);
|
2017-12-18 15:34:25 +01:00
|
|
|
}
|
2023-02-27 18:55:32 +01:00
|
|
|
|
|
|
|
public static ResourceRegistrySchemaClient create(String context) {
|
2023-03-02 14:52:43 +01:00
|
|
|
String address = getResourceRegistryURL(context);
|
2023-02-27 18:55:32 +01:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
|
|
|
return new ResourceRegistrySchemaClientImpl(address);
|
|
|
|
}
|
2017-12-18 15:34:25 +01:00
|
|
|
|
|
|
|
}
|