resource-registry-query-tem.../src/main/java/org/gcube/informationsystem/resourceregistry/queries/templates/ResourceRegistryQueryTempla...

38 lines
1.4 KiB
Java
Raw Permalink Normal View History

2022-02-01 16:29:36 +01:00
package org.gcube.informationsystem.resourceregistry.queries.templates;
import org.gcube.informationsystem.resourceregistry.api.Constants;
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
public static String getResourceRegistryURL() {
2022-07-25 11:16:03 +02:00
String address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME);
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();
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
2022-02-01 16:29:36 +01:00
return new ResourceRegistryQueryTemplateClientImpl(address);
}
public static ResourceRegistryQueryTemplateClient create(String context) {
String address = getResourceRegistryURL(context);
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
return new ResourceRegistryQueryTemplateClientImpl(address);
}
2022-02-01 16:29:36 +01:00
}