/** * {@inheritDoc */ @Override public byte[] fromEndpoint(Endpoint endpoint, long lastTimeStarted, long lastTimeStopped) throws ServiceLocatorException { return serialize(createEndpointData(endpoint, lastTimeStarted, lastTimeStopped)); }
/** * {@inheritDoc */ @Override public SLEndpointProvider toSLEndpoint(QName serviceName, byte[] content, boolean isLive) { EndpointDataType epd = toEndPointData(content); return new SLEndpointProvider(serviceName, epd, isLive); }
SLProperties properties = endpoint.getProperties(); if (properties != null && !properties.getPropertyNames().isEmpty()) { EndpointTransformerImpl transformer = new EndpointTransformerImpl(); transformer.writePropertiesTo(properties, result); Document docResult = (Document) result.getNode();
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(); }
SLProperties properties = endpoint.getProperties(); if (properties != null && !properties.getPropertyNames().isEmpty()) { EndpointTransformerImpl transformer = new EndpointTransformerImpl(); transformer.writePropertiesTo(properties, result); Document docResult = (Document) result.getNode();
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(); }
/** * {@inheritDoc */ @Override public byte[] fromEndpoint(Endpoint endpoint, long lastTimeStarted, long lastTimeStopped) throws ServiceLocatorException { return serialize(createEndpointData(endpoint, lastTimeStarted, lastTimeStopped)); }
/** * {@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); } } }
/** * {@inheritDoc */ @Override public SLEndpointProvider toSLEndpoint(QName serviceName, byte[] content, boolean isLive) { EndpointDataType epd = toEndPointData(content); return new SLEndpointProvider(serviceName, epd, isLive); }
/** * {@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); } } }