// Path: stun/upnp/src/main/java/org/cybergarage/xml/Parser.java
// public abstract class Parser 
// {
// 	////////////////////////////////////////////////
// 	//	Constructor
// 	////////////////////////////////////////////////
// 
// 	public Parser()
// 	{
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse
// 	////////////////////////////////////////////////
// 
// 	public abstract Node parse(InputStream inStream) throws ParserException;
// 
// 	////////////////////////////////////////////////
// 	//	parse (URL)
// 	////////////////////////////////////////////////
// 
// 	public Node parse(URL locationURL) throws ParserException
// 	{
// 		String host = locationURL.getHost();
// 		int port = locationURL.getPort();
// 		String uri = locationURL.getPath();
// 		
// 		try {
// 	 		HttpURLConnection urlCon = (HttpURLConnection)locationURL.openConnection();
// 			urlCon.setRequestMethod("GET");
// 			urlCon.setRequestProperty(HTTP.CONTENT_LENGTH,"0");
// 			if (host != null)
// 				urlCon.setRequestProperty(HTTP.HOST, host);
// 
// 			InputStream urlIn = urlCon.getInputStream();
// 
// 			Node rootElem = parse(urlIn);
// 			
// 			urlIn.close();
// 			urlCon.disconnect();
// 
// 			return rootElem;
// 			
// 		} catch (Exception e) {
// 			//throw new ParserException(e);
// 		}
// 
// 		HTTPRequest httpReq = new HTTPRequest();
// 		httpReq.setMethod(HTTP.GET);
// 		httpReq.setURI(uri);
// 		HTTPResponse httpRes = httpReq.post(host, port);
// 		if (httpRes.isSuccessful() == false)
// 			throw new ParserException("HTTP comunication failed: no answer from peer." +
// 					"Unable to retrive resoure -> "+locationURL.toString());
// 		String content = new String(httpRes.getContent());
// 		ByteArrayInputStream strBuf = new ByteArrayInputStream(content.getBytes());
// 		return parse(strBuf);
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse (File)
// 	////////////////////////////////////////////////
// 
// 	public Node parse(File descriptionFile) throws ParserException
// 	{
// 		try {
// 			InputStream fileIn = new FileInputStream(descriptionFile);
// 			Node root = parse(fileIn);
// 			fileIn.close();
// 			return root;
// 			
// 		} catch (Exception e) {
// 			throw new ParserException(e);
// 		}
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse (Memory)
// 	////////////////////////////////////////////////
// 	
// 	public Node parse(String descr) throws ParserException
// 	{
// 		try {
// 			InputStream decrIn = new ByteArrayInputStream(descr.getBytes());
// 			Node root = parse(decrIn);
// 			return root;
// 		} catch (Exception e) {
// 			throw new ParserException(e);
// 		}
// 	}
// 
// }


import org.cybergarage.upnp.event.SubscriptionResponse;
import org.cybergarage.upnp.ssdp.SSDPNotifyRequest;
import org.cybergarage.upnp.ssdp.SSDPNotifySocket;
import org.cybergarage.upnp.ssdp.SSDPPacket;
import org.cybergarage.upnp.ssdp.SSDPSearchResponse;
import org.cybergarage.upnp.ssdp.SSDPSearchResponseSocket;
import org.cybergarage.upnp.ssdp.SSDPSearchSocketList;
import org.cybergarage.upnp.xml.DeviceData;
import org.cybergarage.upnp.xml.ServiceData;
import org.cybergarage.util.Debug;
import org.cybergarage.util.FileUtil;
import org.cybergarage.util.Mutex;
import org.cybergarage.util.TimerUtil;
import org.cybergarage.xml.Node;
import org.cybergarage.xml.Parser;
import org.cybergarage.xml.ParserException;
import org.cybergarage.xml.XML;
import org.cybergarage.http.HTTP;
import java.io.File;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URL;
import java.util.Calendar;
import org.cybergarage.http.HTTP;
import org.cybergarage.http.HTTPRequest;
import org.cybergarage.http.HTTPResponse;
import org.cybergarage.http.HTTPServerList;
import org.cybergarage.http.HTTPStatus;
import org.cybergarage.net.HostInterface;
import org.cybergarage.soap.SOAPResponse;
import org.cybergarage.upnp.control.ActionListener;
import org.cybergarage.upnp.control.ActionRequest;
import org.cybergarage.upnp.control.ActionResponse;
import org.cybergarage.upnp.control.ControlRequest;
import org.cybergarage.upnp.control.ControlResponse;
import org.cybergarage.upnp.control.QueryListener;
import org.cybergarage.upnp.control.QueryRequest;
import org.cybergarage.upnp.device.Advertiser;
import org.cybergarage.upnp.device.Description;
import org.cybergarage.upnp.device.InvalidDescriptionException;
import org.cybergarage.upnp.device.NTS;
import org.cybergarage.upnp.device.ST;
import org.cybergarage.upnp.device.SearchListener;
import org.cybergarage.upnp.device.USN;
import org.cybergarage.upnp.event.Subscriber;
import org.cybergarage.upnp.event.Subscription;
import org.cybergarage.upnp.event.SubscriptionRequest;
		getDeviceData().setDescriptionURI(uri);
	}

	private String getDescriptionURI()
	{
		return getDeviceData().getDescriptionURI();
	}

	private boolean isDescriptionURI(String uri)
	{
		String descriptionURI = getDescriptionURI();
		if (uri == null || descriptionURI == null)
			return false;
		return descriptionURI.equals(uri);
	}

	public String getDescriptionFilePath()
	{
		File descriptionFile = getDescriptionFile();
		if (descriptionFile == null)
			return "";
		return descriptionFile.getAbsoluteFile().getParent();
	}
	
	/**
	 * @since 1.8.0
	 */
	public boolean loadDescription(InputStream input) throws InvalidDescriptionException
	{
		try {
// Path: stun/upnp/src/main/java/org/cybergarage/xml/Parser.java
// public abstract class Parser 
// {
// 	////////////////////////////////////////////////
// 	//	Constructor
// 	////////////////////////////////////////////////
// 
// 	public Parser()
// 	{
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse
// 	////////////////////////////////////////////////
// 
// 	public abstract Node parse(InputStream inStream) throws ParserException;
// 
// 	////////////////////////////////////////////////
// 	//	parse (URL)
// 	////////////////////////////////////////////////
// 
// 	public Node parse(URL locationURL) throws ParserException
// 	{
// 		String host = locationURL.getHost();
// 		int port = locationURL.getPort();
// 		String uri = locationURL.getPath();
// 		
// 		try {
// 	 		HttpURLConnection urlCon = (HttpURLConnection)locationURL.openConnection();
// 			urlCon.setRequestMethod("GET");
// 			urlCon.setRequestProperty(HTTP.CONTENT_LENGTH,"0");
// 			if (host != null)
// 				urlCon.setRequestProperty(HTTP.HOST, host);
// 
// 			InputStream urlIn = urlCon.getInputStream();
// 
// 			Node rootElem = parse(urlIn);
// 			
// 			urlIn.close();
// 			urlCon.disconnect();
// 
// 			return rootElem;
// 			
// 		} catch (Exception e) {
// 			//throw new ParserException(e);
// 		}
// 
// 		HTTPRequest httpReq = new HTTPRequest();
// 		httpReq.setMethod(HTTP.GET);
// 		httpReq.setURI(uri);
// 		HTTPResponse httpRes = httpReq.post(host, port);
// 		if (httpRes.isSuccessful() == false)
// 			throw new ParserException("HTTP comunication failed: no answer from peer." +
// 					"Unable to retrive resoure -> "+locationURL.toString());
// 		String content = new String(httpRes.getContent());
// 		ByteArrayInputStream strBuf = new ByteArrayInputStream(content.getBytes());
// 		return parse(strBuf);
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse (File)
// 	////////////////////////////////////////////////
// 
// 	public Node parse(File descriptionFile) throws ParserException
// 	{
// 		try {
// 			InputStream fileIn = new FileInputStream(descriptionFile);
// 			Node root = parse(fileIn);
// 			fileIn.close();
// 			return root;
// 			
// 		} catch (Exception e) {
// 			throw new ParserException(e);
// 		}
// 	}
// 
// 	////////////////////////////////////////////////
// 	//	parse (Memory)
// 	////////////////////////////////////////////////
// 	
// 	public Node parse(String descr) throws ParserException
// 	{
// 		try {
// 			InputStream decrIn = new ByteArrayInputStream(descr.getBytes());
// 			Node root = parse(decrIn);
// 			return root;
// 		} catch (Exception e) {
// 			throw new ParserException(e);
// 		}
// 	}
// 
// }


// Path: stun/upnp/src/main/java/org/cybergarage/upnp/Device.java
import org.cybergarage.upnp.event.SubscriptionResponse;
import org.cybergarage.upnp.ssdp.SSDPNotifyRequest;
import org.cybergarage.upnp.ssdp.SSDPNotifySocket;
import org.cybergarage.upnp.ssdp.SSDPPacket;
import org.cybergarage.upnp.ssdp.SSDPSearchResponse;
import org.cybergarage.upnp.ssdp.SSDPSearchResponseSocket;
import org.cybergarage.upnp.ssdp.SSDPSearchSocketList;
import org.cybergarage.upnp.xml.DeviceData;
import org.cybergarage.upnp.xml.ServiceData;
import org.cybergarage.util.Debug;
import org.cybergarage.util.FileUtil;
import org.cybergarage.util.Mutex;
import org.cybergarage.util.TimerUtil;
import org.cybergarage.xml.Node;
import org.cybergarage.xml.Parser;
import org.cybergarage.xml.ParserException;
import org.cybergarage.xml.XML;
import org.cybergarage.http.HTTP;
import java.io.File;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URL;
import java.util.Calendar;
import org.cybergarage.http.HTTP;
import org.cybergarage.http.HTTPRequest;
import org.cybergarage.http.HTTPResponse;
import org.cybergarage.http.HTTPServerList;
import org.cybergarage.http.HTTPStatus;
import org.cybergarage.net.HostInterface;
import org.cybergarage.soap.SOAPResponse;
import org.cybergarage.upnp.control.ActionListener;
import org.cybergarage.upnp.control.ActionRequest;
import org.cybergarage.upnp.control.ActionResponse;
import org.cybergarage.upnp.control.ControlRequest;
import org.cybergarage.upnp.control.ControlResponse;
import org.cybergarage.upnp.control.QueryListener;
import org.cybergarage.upnp.control.QueryRequest;
import org.cybergarage.upnp.device.Advertiser;
import org.cybergarage.upnp.device.Description;
import org.cybergarage.upnp.device.InvalidDescriptionException;
import org.cybergarage.upnp.device.NTS;
import org.cybergarage.upnp.device.ST;
import org.cybergarage.upnp.device.SearchListener;
import org.cybergarage.upnp.device.USN;
import org.cybergarage.upnp.event.Subscriber;
import org.cybergarage.upnp.event.Subscription;
import org.cybergarage.upnp.event.SubscriptionRequest;

		getDeviceData().setDescriptionURI(uri);
	}

	private String getDescriptionURI()
	{
		return getDeviceData().getDescriptionURI();
	}

	private boolean isDescriptionURI(String uri)
	{
		String descriptionURI = getDescriptionURI();
		if (uri == null || descriptionURI == null)
			return false;
		return descriptionURI.equals(uri);
	}

	public String getDescriptionFilePath()
	{
		File descriptionFile = getDescriptionFile();
		if (descriptionFile == null)
			return "";
		return descriptionFile.getAbsoluteFile().getParent();
	}
	
	/**
	 * @since 1.8.0
	 */
	public boolean loadDescription(InputStream input) throws InvalidDescriptionException
	{
		try {
			Parser parser = UPnP.getXMLParser();