use of org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail in project tesb-rt-se by Talend.
the class LocatorSoapServiceImpl method updateTimetolive.
/**
* @see ServiceLocator
*/
@Override
public void updateTimetolive(QName serviceName, String endpointURL, int timetolive) throws ServiceLocatorFault, InterruptedExceptionFault {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Updating expiring time to happen in " + timetolive + " seconds on endpoint " + endpointURL + " for service " + serviceName + "...");
}
try {
initLocator();
locatorClient.updateTimetolive(serviceName, endpointURL, timetolive);
} 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);
}
}
use of org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail in project tesb-rt-se by Talend.
the class LocatorSoapServiceImpl method buildEndpoint.
/**
* Build Endpoint Reference for giving service name and address
*
* @param serviceName
* @param adress
* @return
*/
private W3CEndpointReference buildEndpoint(QName serviceName, String adress) throws ServiceLocatorFault, InterruptedExceptionFault {
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
// builder.serviceName(serviceName);
builder.address(adress);
SLEndpoint endpoint = null;
try {
endpoint = locatorClient.getEndpoint(serviceName, adress);
} 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);
}
if (endpoint != null) {
SLProperties properties = endpoint.getProperties();
if (properties != null && !properties.getPropertyNames().isEmpty()) {
EndpointTransformerImpl transformer = new EndpointTransformerImpl();
DOMResult result = new DOMResult();
transformer.writePropertiesTo(properties, result);
Document docResult = (Document) result.getNode();
builder.metadata(docResult.getDocumentElement());
}
}
return builder.build();
}
use of org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail in project tesb-rt-se by Talend.
the class LocatorSoapServiceImpl method lookupEndpoint.
/**
* For the given service return endpoint reference randomly selected from
* list of endpoints currently registered at the service locator server.
*
* @param serviceName
* the name of the service for which to get the endpoints, must
* not be <code>null</code>
* @return endpoint references or <code>null</code>
*/
W3CEndpointReference lookupEndpoint(QName serviceName, MatcherDataType matcherData) throws ServiceLocatorFault, InterruptedExceptionFault {
List<String> names = null;
String adress;
try {
initLocator();
SLPropertiesMatcher matcher = createMatcher(matcherData);
if (matcher == null) {
names = locatorClient.lookup(serviceName);
} else {
names = locatorClient.lookup(serviceName, matcher);
}
} 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);
}
if (names != null && !names.isEmpty()) {
names = getRotatedList(names);
adress = names.get(0);
} else {
if (LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "lookup Endpoint for " + serviceName + " failed, service is not known.");
}
ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
serviceFaultDetail.setLocatorFaultDetail("lookup Endpoint for " + serviceName + " failed, service is not known.");
throw new ServiceLocatorFault("Can not find Endpoint", serviceFaultDetail);
}
return buildEndpoint(serviceName, adress);
}
use of org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail 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);
}
}
use of org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail in project tesb-rt-se by Talend.
the class LocatorSoapServiceImpl method unregisterEndpoint.
/**
* Unregister the endpoint for given service.
*
* @param input
* UnregisterEndpointRequestType encapsulate name of service and
* endpointURL. Must not be <code>null</code>
*/
@Override
public void unregisterEndpoint(QName serviceName, String endpointURL) throws ServiceLocatorFault, InterruptedExceptionFault {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Unregistering endpoint " + endpointURL + " for service " + serviceName + "...");
}
try {
initLocator();
locatorClient.unregister(serviceName, endpointURL);
} 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