2022-02-01 16:29:36 +01:00
|
|
|
package org.gcube.informationsystem.resourceregistry.queries.templates;
|
|
|
|
|
|
|
|
import org.gcube.informationsystem.resourceregistry.api.Constants;
|
2022-07-21 18:17:30 +02:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.rest.ServiceInstance;
|
2022-02-01 16:29:36 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class ResourceRegistryQueryTemplateClientFactory {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ResourceRegistryQueryTemplateClientFactory.class);
|
2023-02-10 15:33:17 +01:00
|
|
|
|
2023-03-02 14:52:37 +01:00
|
|
|
public static String getResourceRegistryURL() {
|
2022-07-25 11:16:03 +02:00
|
|
|
String address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME);
|
2023-03-02 14:52:37 +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 ResourceRegistryQueryTemplateClient create() {
|
|
|
|
String address = getResourceRegistryURL();
|
2022-07-21 18:17:30 +02:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
2022-02-01 16:29:36 +01:00
|
|
|
return new ResourceRegistryQueryTemplateClientImpl(address);
|
|
|
|
}
|
2023-02-27 18:55:03 +01:00
|
|
|
|
|
|
|
public static ResourceRegistryQueryTemplateClient create(String context) {
|
2023-03-02 14:52:37 +01:00
|
|
|
String address = getResourceRegistryURL(context);
|
2023-02-27 18:55:03 +01:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
|
|
|
return new ResourceRegistryQueryTemplateClientImpl(address);
|
|
|
|
}
|
2022-02-01 16:29:36 +01:00
|
|
|
|
|
|
|
}
|