Search in sources :

Example 31 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class ZKBackend method connect.

@Override
public RootNode connect() throws InterruptedException, ServiceLocatorException {
    if (!isConnected()) {
        disconnect();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.log(Level.FINE, "Start connect session");
        }
        CountDownLatch connectionLatch = new CountDownLatch(1);
        zk = createZooKeeper(connectionLatch);
        if (authentication) {
            authenticate();
        }
        boolean connected = connectionLatch.await(settings.getConnectionTimeout(), TimeUnit.MILLISECONDS);
        if (!connected) {
            throw new ServiceLocatorException("Connection to Service Locator failed.");
        }
        for (PostConnectAction postConnectAction : postConnectActions) {
            postConnectAction.process(null);
        }
        if (LOG.isLoggable(Level.FINER)) {
            LOG.log(Level.FINER, "End connect session");
        }
    }
    return rootNode;
}
Also used : PostConnectAction(org.talend.esb.servicelocator.client.ServiceLocator.PostConnectAction) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 32 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class CXFEndpointProvider method serializeEPR.

/**
 * Inserts a marshalled endpoint reference to a given DOM tree rooted by parent.
 * @param wsAddr
 * @param parent
 * @throws ServiceLocatorException
 */
private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException {
    try {
        JAXBElement<EndpointReferenceType> ep = WSA_OBJECT_FACTORY.createEndpointReference(wsAddr);
        createMarshaller().marshal(ep, parent);
    } catch (JAXBException e) {
        if (LOG.isLoggable(Level.SEVERE)) {
            LOG.log(Level.SEVERE, "Failed to serialize endpoint data", e);
        }
        throw new ServiceLocatorException("Failed to serialize endpoint data", e);
    }
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) JAXBException(javax.xml.bind.JAXBException)

Example 33 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class EndpointTransformerImpl method serialize.

private byte[] serialize(EndpointDataType endpointData) throws ServiceLocatorException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream(50000);
    try {
        JAXBElement<EndpointDataType> epd = ENDPOINT_OBJECT_FACTORY.createEndpointData(endpointData);
        createMarshaller().marshal(epd, outputStream);
    } catch (JAXBException e) {
        if (LOG.isLoggable(Level.SEVERE)) {
            LOG.log(Level.SEVERE, "Failed to serialize endpoint data", e);
        }
        throw new ServiceLocatorException("Failed to serialize endpoint data", e);
    }
    return outputStream.toByteArray();
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) JAXBException(javax.xml.bind.JAXBException) EndpointDataType(org.talend.esb.servicelocator.client.internal.endpoint.EndpointDataType) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 34 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class RemoveOperation method execute.

@Override
public Object execute() throws Exception {
    ServiceLocatorTracker slt = ServiceLocatorTracker.getInstance(sl);
    System.out.println();
    try {
        QName serviceName = slt.getServiceName(service);
        sl.removeEndpoint(serviceName, endpoint);
        System.out.println("Endpoint has been removed from Service Locator");
        slt.updateServiceList();
    } catch (ServiceLocatorException e) {
        System.err.println(e.getMessage());
    }
    System.out.println();
    return null;
}
Also used : QName(javax.xml.namespace.QName) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) ServiceLocatorTracker(org.talend.esb.locator.tracker.ServiceLocatorTracker)

Example 35 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class UnregisterOperation method execute.

@Override
public Object execute() throws Exception {
    ServiceLocatorTracker slt = ServiceLocatorTracker.getInstance(sl);
    System.out.println();
    try {
        QName serviceName = slt.getServiceName(service);
        sl.unregister(serviceName, endpoint);
        System.out.println("Endpoint has been unregistered at Service Locator");
    } catch (ServiceLocatorException e) {
        System.err.println(e.getMessage());
    }
    System.out.println();
    return null;
}
Also used : QName(javax.xml.namespace.QName) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) ServiceLocatorTracker(org.talend.esb.locator.tracker.ServiceLocatorTracker)

Aggregations

ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)35 Test (org.junit.Test)13 QName (javax.xml.namespace.QName)11 SLEndpoint (org.talend.esb.servicelocator.client.SLEndpoint)8 WebApplicationException (javax.ws.rs.WebApplicationException)6 InterruptionFaultDetail (org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail)6 ServiceLocatorFaultDetail (org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail)6 InterruptedExceptionFault (org.talend.services.esb.locator.v1.InterruptedExceptionFault)6 ServiceLocatorFault (org.talend.services.esb.locator.v1.ServiceLocatorFault)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 ServiceLocatorTracker (org.talend.esb.locator.tracker.ServiceLocatorTracker)4 SLPropertiesMatcher (org.talend.esb.servicelocator.client.SLPropertiesMatcher)4 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)4 JAXBException (javax.xml.bind.JAXBException)3 Endpoint (org.talend.esb.servicelocator.client.Endpoint)3 DOMResult (javax.xml.transform.dom.DOMResult)2 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 BindingType (org.talend.esb.servicelocator.client.BindingType)2 SLProperties (org.talend.esb.servicelocator.client.SLProperties)2