List of usage examples for javax.xml.bind JAXBException getMessage
public String getMessage()
From source file:org.excalibur.discovery.ws.client.DiscoveryUtils.java
public static ResourceDetails buildResourceDetailsFor(String name, NodeDetails node) { ResourceDetails resource = null;//from ww w . java2 s . c om try { resource = new ResourceDetails().setName(name).setType(node.getClass()) .setPayload(FACTORY.marshal(node)); } catch (JAXBException exception) { LOG.error(exception.getMessage(), exception); } return resource; }
From source file:org.excalibur.discovery.ws.client.DiscoveryUtils.java
public static void registerResource(String name, Peer leader, NodeDetails resource) throws OverlayException { WebTarget target = buildWebTarget(leader); try {//from ww w . j a va 2 s .c o m ResourceDetails resourceInstance = new ResourceDetails(); resourceInstance.setName(name).setType(resource.getClass()).setPayload(FACTORY.marshal(resource)); target.path("cluster/members").request(APPLICATION_JSON_TYPE) .put(Entity.entity(resourceInstance, APPLICATION_JSON_TYPE)); } catch (JAXBException e) { throw new OverlayException(e.getMessage(), e); } }
From source file:org.excalibur.discovery.ws.client.DiscoveryUtils.java
public static void registerProvider(Peer peer, ProviderDetails providerInfo) throws OverlayException { WebTarget target = buildWebTarget(peer); ResourceDetails resource = new ResourceDetails(); try {/*w w w. j a va 2 s. c om*/ resource.setName("/providers").setPayload(FACTORY.marshal(providerInfo)) .setType(providerInfo.getClass()); target.path("providers/add").request(APPLICATION_JSON_TYPE) .put(Entity.entity(resource, APPLICATION_JSON_TYPE)); } catch (JAXBException e) { throw new OverlayException(e.getMessage(), e); } }
From source file:org.excalibur.discovery.ws.client.DiscoveryUtils.java
public static void removeResource(Peer master, NodeDetails resource) throws OverlayException { WebTarget target = buildWebTarget(master); try {//from w w w . j a v a 2 s .c o m ResourceDetails details = new ResourceDetails() .setName(String.format(DiscoveryService.CLUSTER_MEMBERS_NAME_PATH, resource.getProvider().getName(), resource.getParent().getId())) .setType(resource.getClass()).setPayload(FACTORY.marshal(resource)); target.path("cluster/members/remove").request().post(Entity.entity(details, APPLICATION_JSON_TYPE)); } catch (JAXBException e) { throw new OverlayException(e.getMessage(), e); } }
From source file:org.excalibur.discovery.ws.client.DiscoveryUtils.java
public static NavigableSet<NodeDetails> getMembers(List<ResourceDetails> resources) throws OverlayException { NavigableSet<NodeDetails> members = newTreeSet(); for (ResourceDetails resource : resources) { try {/*from w w w . j av a2 s. c o m*/ members.add(FACTORY.unmarshal(resource.getPayload())); } catch (JAXBException e) { throw new OverlayException(e.getMessage(), e); } } return members; }
From source file:com.lakala.demo.util.JaxbMapper.java
protected static JAXBContext getJaxbContext(Class clazz) { Assert.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = jaxbContexts.get(clazz); if (jaxbContext == null) { try {/*from ww w. j a v a 2s. c o m*/ jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); jaxbContexts.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new RuntimeException( "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex); } } return jaxbContext; }
From source file:cn.cdwx.jpa.utils.mapper.JaxbMapper.java
protected static JAXBContext getJaxbContext(Class clazz) { Validate.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = jaxbContexts.get(clazz); if (jaxbContext == null) { try {//from w w w . j a v a2s .c o m jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); jaxbContexts.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new RuntimeException( "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex); } } return jaxbContext; }
From source file:net.cloudkit.enterprises.infrastructure.utilities.JaxbMapperHelper.java
protected static JAXBContext getJaxbContext(Class<?> clazz) { Validate.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = jaxbContexts.get(clazz); if (jaxbContext == null) { try {// ww w.j a v a 2 s. c o m jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); jaxbContexts.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new RuntimeException( "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex); } } return jaxbContext; }
From source file:com.sportpm.mapper.JaxbMapper.java
@SuppressWarnings("rawtypes") protected static JAXBContext getJaxbContext(Class clazz) { Validate.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = jaxbContexts.get(clazz); if (jaxbContext == null) { try {/*from w ww.j av a 2 s . co m*/ jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); jaxbContexts.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new RuntimeException( "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex); } } return jaxbContext; }
From source file:com.androidwhy.modules.mapper.JaxbMapper.java
protected static JAXBContext getJaxbContext(Class clazz) { Assert.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = jaxbContexts.get(clazz); if (jaxbContext == null) { try {//w w w. j a v a 2s .c o m jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class); jaxbContexts.putIfAbsent(clazz, jaxbContext); } catch (JAXBException ex) { throw new HttpMessageConversionException( "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex); } } return jaxbContext; }