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();
}
}
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));
}
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);
}
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);
}
}
}
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;
}
Aggregations