package fi.csc.microarray.messaging.message;

import java.net.MalformedURLException;
import java.net.URL;

import javax.jms.JMSException;
import javax.jms.MapMessage;


public class UrlMessage extends ChipsterMessage {
	
	private final static String KEY_URL = "url";
	
	private URL url;
	
	public UrlMessage() {
		super();
	}
	
	public UrlMessage(URL url) {
		super();
		this.url = url;
	}
	
	public URL getUrl() {
		return url;
	}
	
	public void unmarshal(MapMessage from) throws JMSException {
		super.unmarshal(from);
		try {
			this.url = new URL(from.getString(KEY_URL));
		} catch (MalformedURLException e) {
			handleException(e);
		}
	}

	public void marshal(MapMessage mapMessage) throws JMSException {
		super.marshal(mapMessage);
		String urlString = null;
		if (this.url != null) {
			urlString = this.url.toString();
		}
		mapMessage.setString(KEY_URL, urlString);
	}
}

@@ -518,16 +518,121 @@
 m);%0A
+%09%09String urlString = from.getString(KEY_URL);%0A%09%09if (urlString == null) %7B%0A%09%09%09this.url = null;%0A%09%09%7D else %7B%0A%09
 %09%09try %7B%0A
 %09%09%09t
@@ -627,16 +627,17 @@
 %09%09try %7B%0A
+%09
 %09%09%09this.
@@ -678,16 +678,17 @@
 RL));%0A%09%09
+%09
 %7D catch 
@@ -718,16 +718,17 @@
 e) %7B%0A%09%09%09
+%09
 handleEx
@@ -739,16 +739,21 @@
 ion(e);%0A
+%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%0A

Fix filebroker response when the file wasn't found