2021-10-25 11:39:59 +02:00
|
|
|
package org.gcube.informationsystem.resourceregistry.contexts;
|
2017-11-23 11:42:05 +01:00
|
|
|
|
|
|
|
import org.gcube.informationsystem.resourceregistry.api.Constants;
|
2022-07-21 16:57:08 +02:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.rest.ServiceInstance;
|
2017-11-23 11:42:05 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class ResourceRegistryContextClientFactory {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ResourceRegistryContextClientFactory.class);
|
|
|
|
|
2023-03-02 14:51:31 +01:00
|
|
|
public static String getResourceRegistryURL() {
|
2022-07-25 11:08:03 +02:00
|
|
|
String address = String.format("%s/%s", ServiceInstance.getServiceURL(),Constants.SERVICE_NAME);
|
2023-03-02 14:51:31 +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 ResourceRegistryContextClient create() {
|
|
|
|
String address = getResourceRegistryURL();
|
2022-07-21 16:57:08 +02:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
2020-11-04 16:34:54 +01:00
|
|
|
return new ResourceRegistryContextClientImpl(address);
|
2017-11-23 11:42:05 +01:00
|
|
|
}
|
|
|
|
|
2023-02-27 18:53:49 +01:00
|
|
|
public static ResourceRegistryContextClient create(String context) {
|
2023-03-02 14:51:31 +01:00
|
|
|
String address = getResourceRegistryURL(context);
|
2023-02-27 18:53:49 +01:00
|
|
|
logger.trace("The {} will be contacted at {}", Constants.SERVICE_NAME, address);
|
|
|
|
return new ResourceRegistryContextClientImpl(address);
|
|
|
|
}
|
|
|
|
|
2017-11-23 11:42:05 +01:00
|
|
|
}
|