@Override public Collection<String> call() throws Exception { Collection<String> allTags = new HashSet<String>(); ObjectMapper mapper = new ObjectMapper(); List<XmlTag> xmltags = new ArrayList<XmlTag>(); try {xmltags = mapper.readValue( service.path(resourceTags) .accept(MediaType.APPLICATION_JSON) .get(String.class) ,new TypeReference<List<XmlTag>>(){}); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (XmlTag xmltag : xmltags) { allTags.add(xmltag.getName()); } return allTags; } });
@Override public Collection<String> call() throws Exception { Collection<String> allProperties = new HashSet<String>(); ObjectMapper mapper = new ObjectMapper(); List<XmlProperty> xmlproperties = new ArrayList<XmlProperty>(); try {xmlproperties = mapper.readValue( service.path(resourceProperties) .accept(MediaType.APPLICATION_JSON) .get(String.class) ,new TypeReference<List<XmlProperty>>(){}); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (XmlProperty xmlproperty : xmlproperties) { allProperties.add(xmlproperty.getName()); } return allProperties; } });
public Collection<Channel> getAllChannels() { ObjectMapper mapper = new ObjectMapper(); List<XmlChannel> xmlchannels = new ArrayList<XmlChannel>(); try {xmlchannels = mapper.readValue( service.path(resourceChannels) .accept(MediaType.APPLICATION_JSON) .get(String.class) ,new TypeReference<List<XmlChannel>>(){}); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Collection<Channel> set = new HashSet<Channel>(); for (XmlChannel channel : xmlchannels) { set.add(new Channel(channel)); } return set; } }
@Override public Collection<Channel> call() throws Exception { Collection<Channel> channels = new HashSet<Channel>(); List<XmlChannel> xmlchannels = new ArrayList<XmlChannel>(); ObjectMapper mapper = new ObjectMapper(); try {xmlchannels = mapper.readValue( service.path(resourceChannels) .queryParams(this.map) .accept(MediaType.APPLICATION_JSON) .get(String.class) ,new TypeReference<List<XmlChannel>>(){}); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (XmlChannel xmlchannel : xmlchannels) { channels.add(new Channel(xmlchannel)); } return Collections.unmodifiableCollection(channels); } }
@Override public Channel call() throws UniformInterfaceException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); try { return new Channel(mapper.readValue(service.path(resourceChannels).path(channelName) .get(ClientResponse.class) .getEntityInputStream(), XmlChannel.class)); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
@Override public void run() { ObjectMapper mapper = new ObjectMapper(); try { service.path(resourceChannels).path(this.channel.getName()) .type(MediaType.APPLICATION_JSON) .post(mapper.writeValueAsString(this.channel)); } catch (UniformInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void run() { ObjectMapper mapper = new ObjectMapper(); try { service.path(resourceTags).path(this.pxmlTag.getName()) .type(MediaType.APPLICATION_JSON) .put(mapper.writeValueAsString(this.pxmlTag)); } catch (UniformInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@Override public void run() { ObjectMapper mapper = new ObjectMapper(); try { service.path(resourceProperties).path(this.pxmlProperty.getName()) .type(MediaType.APPLICATION_JSON) .put(mapper.writeValueAsString(this.pxmlProperty)); } catch (UniformInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@Override public void run() { ObjectMapper mapper = new ObjectMapper(); try { service.path(resourceProperties).path(this.pxmlProperty.getName()) .type(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .post(mapper.writeValueAsString(this.pxmlProperty)); } catch (UniformInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }