use of org.talend.esb.servicelocator.client.BindingType in project tesb-rt-se by Talend.
the class LocatorRestServiceImpl method registerEndpoint.
/**
* Register the endpoint for given service.
*
* @param input
* RegisterEndpointRequestType encapsulate name of service and
* endpointURL. Must not be <code>null</code>
*/
public void registerEndpoint(RegisterEndpointRequest arg0) {
String endpointURL = arg0.getEndpointURL();
QName serviceName = QName.valueOf(arg0.getServiceName());
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "...");
}
try {
initLocator();
BindingType bindingType = arg0.getBinding() == null ? BindingType.OTHER : BindingType.valueOf(arg0.getBinding().value());
TransportType transportType = arg0.getTransport() == null ? TransportType.OTHER : TransportType.valueOf(arg0.getTransport().value());
SLPropertiesImpl slProps = null;
if (!arg0.getEntryType().isEmpty()) {
slProps = new SLPropertiesImpl();
List<EntryType> entries = arg0.getEntryType();
for (EntryType entry : entries) {
slProps.addProperty(entry.getKey(), entry.getValue());
}
}
Endpoint simpleEndpoint = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps);
locatorClient.register(simpleEndpoint, true);
} catch (ServiceLocatorException e) {
// throw new ServiceLocatorFault(e.getMessage(), e);
throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
} catch (InterruptedException e) {
// throw new InterruptedExceptionFault(e.getMessage(), e);
throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
}
}
use of org.talend.esb.servicelocator.client.BindingType in project tesb-rt-se by Talend.
the class LocatorSoapServiceImpl method registerEndpoint.
/**
* Register the endpoint for given service.
*
* @param input
* RegisterEndpointRequestType encapsulate name of service and
* endpointURL. Must not be <code>null</code>
*/
@Override
public void registerEndpoint(QName serviceName, String endpointURL, org.talend.schemas.esb.locator._2011._11.BindingType binding, org.talend.schemas.esb.locator._2011._11.TransportType transport, SLPropertiesType properties) throws ServiceLocatorFault, InterruptedExceptionFault {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "...");
}
try {
initLocator();
BindingType bindingType = binding == null ? BindingType.SOAP11 : BindingType.valueOf(binding.value());
TransportType transportType = transport == null ? TransportType.HTTP : TransportType.valueOf(transport.value());
SLPropertiesImpl slProps = null;
if (properties != null) {
slProps = new SLPropertiesImpl();
List<EntryType> entries = properties.getEntry();
for (EntryType entry : entries) {
slProps.addProperty(entry.getKey(), entry.getValue());
}
}
SimpleEndpoint eprProvider = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps);
locatorClient.register(eprProvider, true);
} catch (ServiceLocatorException e) {
ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
serviceFaultDetail.setLocatorFaultDetail(serviceName.toString() + "throws ServiceLocatorFault");
throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);
} catch (InterruptedException e) {
InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();
interruptionFaultDetail.setInterruptionDetail(serviceName.toString() + "throws InterruptionFault");
throw new InterruptedExceptionFault(e.getMessage(), interruptionFaultDetail);
}
}
Aggregations