// Path: wren/src/main/java/uk/bl/wa/wren/model/CrawlURL.java
// public class CrawlURL implements Serializable {
// 
//     private static final long serialVersionUID = 7452432417457114150L;
// 
//     public String url = "";
// 
//     public String method;
// 
//     public String httpVersion;
// 
//     public List<String> cookies = new ArrayList<String>();
// 
//     public Map<String, String> headers = new HashMap<String, String>();
// 
//     public String parentUrl = "";
// 
//     public String pathFromSeed = "S";
// 
//     public boolean forceFetch = false;
// 
//     public boolean isSeed = false;
// 
//     @JsonProperty
//     public ParentUrlMetadata parentUrlMetadata = new ParentUrlMetadata();
// 
//     public CrawlURL toParent() {
//         CrawlURL nurl = new CrawlURL();
//         nurl.parentUrl = this.url;
//         nurl.parentUrlMetadata.pathFromSeed = this.pathFromSeed;
//         return nurl;
//     }
// 
//     public String toJson() throws JsonProcessingException {
//         ObjectMapper mapper = new ObjectMapper();
//         mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
//         return mapper.writeValueAsString(this);
//     }
// 
//     public static CrawlURL fromJson(String json) throws JsonParseException, JsonMappingException, IOException {
//         ObjectMapper mapper = new ObjectMapper();
//         return mapper.readValue(json, CrawlURL.class);
//     }
// 
//     public static CrawlURL fromCrawlURI(CrawlURI curi) {
//         CrawlURL nurl = new CrawlURL();
//         nurl.url = curi.getURI();
//         nurl.method = "GET";
//         nurl.httpVersion = "1.0";
//         nurl.pathFromSeed = curi.getPathFromSeed();
//         nurl.forceFetch = curi.forceFetch();
//         nurl.isSeed = curi.isSeed();
//         return nurl;
//     }
// 
//     public static CrawlURI toCrawlURI(CrawlURL curi) throws URIException {
//         UURI uuri = UURIFactory.getInstance(curi.url);
//         CrawlURI nuri = new CrawlURI(uuri, curi.pathFromSeed, null,
//                 LinkContext.NAVLINK_MISC);
//         nuri.setSeed(curi.isSeed);
//         nuri.setForceFetch(curi.forceFetch);
//         return nuri;
//     }
// }


import java.io.UnsupportedEncodingException;
import org.apache.storm.tuple.Tuple;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.latent.storm.rabbitmq.TupleToMessage;
import uk.bl.wa.wren.model.CrawlURL;
/**
 * 
 */
package uk.bl.wa.wren.queues;





/**
 * @author Andrew Jackson <Andrew.Jackson@bl.uk>
 *
 */
public class UrlTupleToMessage extends TupleToMessage {

    private static final long serialVersionUID = -949046746396956815L;

    @Override
    protected byte[] extractBody(Tuple input) {
// Path: wren/src/main/java/uk/bl/wa/wren/model/CrawlURL.java
// public class CrawlURL implements Serializable {
// 
//     private static final long serialVersionUID = 7452432417457114150L;
// 
//     public String url = "";
// 
//     public String method;
// 
//     public String httpVersion;
// 
//     public List<String> cookies = new ArrayList<String>();
// 
//     public Map<String, String> headers = new HashMap<String, String>();
// 
//     public String parentUrl = "";
// 
//     public String pathFromSeed = "S";
// 
//     public boolean forceFetch = false;
// 
//     public boolean isSeed = false;
// 
//     @JsonProperty
//     public ParentUrlMetadata parentUrlMetadata = new ParentUrlMetadata();
// 
//     public CrawlURL toParent() {
//         CrawlURL nurl = new CrawlURL();
//         nurl.parentUrl = this.url;
//         nurl.parentUrlMetadata.pathFromSeed = this.pathFromSeed;
//         return nurl;
//     }
// 
//     public String toJson() throws JsonProcessingException {
//         ObjectMapper mapper = new ObjectMapper();
//         mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
//         return mapper.writeValueAsString(this);
//     }
// 
//     public static CrawlURL fromJson(String json) throws JsonParseException, JsonMappingException, IOException {
//         ObjectMapper mapper = new ObjectMapper();
//         return mapper.readValue(json, CrawlURL.class);
//     }
// 
//     public static CrawlURL fromCrawlURI(CrawlURI curi) {
//         CrawlURL nurl = new CrawlURL();
//         nurl.url = curi.getURI();
//         nurl.method = "GET";
//         nurl.httpVersion = "1.0";
//         nurl.pathFromSeed = curi.getPathFromSeed();
//         nurl.forceFetch = curi.forceFetch();
//         nurl.isSeed = curi.isSeed();
//         return nurl;
//     }
// 
//     public static CrawlURI toCrawlURI(CrawlURL curi) throws URIException {
//         UURI uuri = UURIFactory.getInstance(curi.url);
//         CrawlURI nuri = new CrawlURI(uuri, curi.pathFromSeed, null,
//                 LinkContext.NAVLINK_MISC);
//         nuri.setSeed(curi.isSeed);
//         nuri.setForceFetch(curi.forceFetch);
//         return nuri;
//     }
// }


// Path: wren/src/main/java/uk/bl/wa/wren/queues/UrlTupleToMessage.java
import java.io.UnsupportedEncodingException;
import org.apache.storm.tuple.Tuple;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.latent.storm.rabbitmq.TupleToMessage;
import uk.bl.wa.wren.model.CrawlURL;

/**
 * 
 */
package uk.bl.wa.wren.queues;





/**
 * @author Andrew Jackson <Andrew.Jackson@bl.uk>
 *
 */
public class UrlTupleToMessage extends TupleToMessage {

    private static final long serialVersionUID = -949046746396956815L;

    @Override
    protected byte[] extractBody(Tuple input) {
        CrawlURL curl = (CrawlURL) input.getValueByField("url");