Search in sources :

Example 1 with ServiceLocatorPropertiesType

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

the class SLEndpointProvider method toServiceLocatorProperties.

@SuppressWarnings("unchecked")
private ServiceLocatorPropertiesType toServiceLocatorProperties(Element root) {
    try {
        JAXBContext jc = JaxbContextHandler.getEndpointContext();
        JAXBElement<ServiceLocatorPropertiesType> slp = (JAXBElement<ServiceLocatorPropertiesType>) jc.createUnmarshaller().unmarshal(root);
        return slp.getValue();
    } catch (JAXBException e) {
        if (LOG.isLoggable(Level.SEVERE)) {
            LOG.log(Level.SEVERE, "Failed to deserialize service locator properties", e);
        }
        return SL_OBJECT_FACTORY.createServiceLocatorPropertiesType();
    }
}
Also used : ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType) JAXBException(javax.xml.bind.JAXBException) JAXBContext(javax.xml.bind.JAXBContext) JAXBElement(javax.xml.bind.JAXBElement)

Example 2 with ServiceLocatorPropertiesType

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

the class SLPropertiesConverterTest method slProperties2JAXBSlPropertiesType.

@Test
public void slProperties2JAXBSlPropertiesType() throws Exception {
    SLPropertiesImpl props = new SLPropertiesImpl();
    props.addProperty(KEY_1, VALUE_1, VALUE_2);
    props.addProperty(KEY_2, VALUE_2, VALUE_3);
    ServiceLocatorPropertiesType jaxbProperties = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
    List<EntryType> entries = jaxbProperties.getEntry();
    List<String> values = entries.get(0).getValue();
    assertEquals(VALUE_1, values.get(0));
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType) ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType) SLPropertiesImpl(org.talend.esb.servicelocator.client.SLPropertiesImpl) Test(org.junit.Test)

Example 3 with ServiceLocatorPropertiesType

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

the class CXFEndpointProvider method addProperties.

/**
 * Adds service locator properties to an endpoint reference.
 * @param epr
 * @param props
 */
private static void addProperties(EndpointReferenceType epr, SLProperties props) {
    MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr);
    ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
    JAXBElement<ServiceLocatorPropertiesType> slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps);
    metadata.getAny().add(slp);
}
Also used : ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType) MetadataType(org.apache.cxf.ws.addressing.MetadataType)

Example 4 with ServiceLocatorPropertiesType

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

the class EndpointTransformerImpl method writePropertiesTo.

/**
 * {@inheritDoc
 */
@Override
public void writePropertiesTo(SLProperties props, Result result) {
    ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
    try {
        JAXBElement<ServiceLocatorPropertiesType> elementProps = ENDPOINT_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps);
        createMarshaller().marshal(elementProps, result);
    } catch (JAXBException e) {
        if (LOG.isLoggable(Level.SEVERE)) {
            LOG.log(Level.SEVERE, "Failed to deserialize endpoint data", e);
        }
    }
}
Also used : ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType) JAXBException(javax.xml.bind.JAXBException)

Example 5 with ServiceLocatorPropertiesType

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

the class SLPropertiesConverter method toServiceLocatorPropertiesType.

public static ServiceLocatorPropertiesType toServiceLocatorPropertiesType(SLProperties props) {
    ObjectFactory of = new ObjectFactory();
    ServiceLocatorPropertiesType slPropertiesType = of.createServiceLocatorPropertiesType();
    List<EntryType> entries = slPropertiesType.getEntry();
    for (String name : props.getPropertyNames()) {
        entries.add(createEntry(props, name));
    }
    return slPropertiesType;
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType) ObjectFactory(org.talend.esb.servicelocator.client.internal.endpoint.ObjectFactory) ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType)

Aggregations

ServiceLocatorPropertiesType (org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType)5 JAXBException (javax.xml.bind.JAXBException)2 EntryType (org.talend.esb.servicelocator.client.internal.endpoint.EntryType)2 JAXBContext (javax.xml.bind.JAXBContext)1 JAXBElement (javax.xml.bind.JAXBElement)1 MetadataType (org.apache.cxf.ws.addressing.MetadataType)1 Test (org.junit.Test)1 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)1 ObjectFactory (org.talend.esb.servicelocator.client.internal.endpoint.ObjectFactory)1