com.aelitis.net.upnp.impl
Class UPnPImpl

java.lang.Object
  extended by org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderAdapter
      extended by com.aelitis.net.upnp.impl.UPnPImpl
All Implemented Interfaces:
SSDPIGDListener, UPnP, ResourceDownloaderListener

public class UPnPImpl
extends ResourceDownloaderAdapter
implements UPnP, SSDPIGDListener


Field Summary
static String NL
           
protected  AEMonitor this_mon
           
 
Constructor Summary
protected UPnPImpl(UPnPAdapter _adapter, String[] _selected_interfaces)
           
 
Method Summary
 void addLogListener(UPnPLogListener l)
           
 void addRootDeviceListener(UPnPListener l)
           
 SimpleXMLParserDocument downloadXML(UPnPDeviceImpl device, URL url)
           
 SimpleXMLParserDocument downloadXML(UPnPRootDeviceImpl root, URL url)
           
protected  SimpleXMLParserDocument downloadXMLSupport(String friendly_name, URL url)
           
 void failed(ResourceDownloader downloader, ResourceDownloaderException e)
           
protected  boolean forceDirect()
           
 UPnPAdapter getAdapter()
           
 UPnPRootDevice[] getRootDevices()
           
static UPnP getSingleton(UPnPAdapter adapter, String[] selected_interfaces)
           
 UPnPSSDP getSSDP()
           
protected  File getTraceFile()
           
 void injectDiscoveryCache(Map cache)
           
 void interfaceChanged(NetworkInterface network_interface)
           
 void log(String str)
          Logs a message to all registered log listeners
 void log(Throwable e)
           
 void logAlert(String str, boolean error, int type)
           
 SimpleXMLParserDocument parseXML(InputStream _is)
           
 SimpleXMLParserDocument performSOAPRequest(UPnPService service, String soap_action, String request)
           
 SimpleXMLParserDocument performSOAPRequest(UPnPService service, String soap_action, String request, boolean use_http_connection)
          The use_http_connection flag is set to false sometimes to avoid using the URLConnection library for some dopey UPnP routers.
 void removeLogListener(UPnPLogListener l)
           
 void removeRootDeviceListener(UPnPListener l)
           
 void reportActivity(ResourceDownloader downloader, String activity)
           
 void reset()
          resets by removing all root devices and then rediscovering them
 void rootAlive(String usn, URL location)
           
 void rootDiscovered(NetworkInterface network_interface, InetAddress local_address, String usn, URL location)
           
 void rootLost(InetAddress local_address, String usn)
           
 void search()
          scan for new
 void search(String[] STs)
           
 
Methods inherited from class org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderAdapter
completed, reportAmountComplete, reportPercentComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NL

public static final String NL
See Also:
Constant Field Values

this_mon

protected AEMonitor this_mon
Constructor Detail

UPnPImpl

protected UPnPImpl(UPnPAdapter _adapter,
                   String[] _selected_interfaces)
            throws UPnPException
Throws:
UPnPException
Method Detail

getSingleton

public static UPnP getSingleton(UPnPAdapter adapter,
                                String[] selected_interfaces)
                         throws UPnPException
Throws:
UPnPException

getSSDP

public UPnPSSDP getSSDP()
Specified by:
getSSDP in interface UPnP

injectDiscoveryCache

public void injectDiscoveryCache(Map cache)
Specified by:
injectDiscoveryCache in interface UPnP

rootDiscovered

public void rootDiscovered(NetworkInterface network_interface,
                           InetAddress local_address,
                           String usn,
                           URL location)
Specified by:
rootDiscovered in interface SSDPIGDListener

rootAlive

public void rootAlive(String usn,
                      URL location)
Specified by:
rootAlive in interface SSDPIGDListener

rootLost

public void rootLost(InetAddress local_address,
                     String usn)
Specified by:
rootLost in interface SSDPIGDListener

interfaceChanged

public void interfaceChanged(NetworkInterface network_interface)
Specified by:
interfaceChanged in interface SSDPIGDListener

search

public void search()
Description copied from interface: UPnP
scan for new

Specified by:
search in interface UPnP

search

public void search(String[] STs)
Specified by:
search in interface UPnP

reset

public void reset()
Description copied from interface: UPnP
resets by removing all root devices and then rediscovering them

Specified by:
reset in interface UPnP

parseXML

public SimpleXMLParserDocument parseXML(InputStream _is)
                                 throws SimpleXMLParserDocumentException,
                                        IOException
Throws:
SimpleXMLParserDocumentException
IOException

downloadXML

public SimpleXMLParserDocument downloadXML(UPnPRootDeviceImpl root,
                                           URL url)
                                    throws UPnPException
Throws:
UPnPException

downloadXML

public SimpleXMLParserDocument downloadXML(UPnPDeviceImpl device,
                                           URL url)
                                    throws UPnPException
Throws:
UPnPException

downloadXMLSupport

protected SimpleXMLParserDocument downloadXMLSupport(String friendly_name,
                                                     URL url)
                                              throws UPnPException
Throws:
UPnPException

forceDirect

protected boolean forceDirect()

performSOAPRequest

public SimpleXMLParserDocument performSOAPRequest(UPnPService service,
                                                  String soap_action,
                                                  String request)
                                           throws SimpleXMLParserDocumentException,
                                                  UPnPException,
                                                  IOException
Throws:
SimpleXMLParserDocumentException
UPnPException
IOException

performSOAPRequest

public SimpleXMLParserDocument performSOAPRequest(UPnPService service,
                                                  String soap_action,
                                                  String request,
                                                  boolean use_http_connection)
                                           throws SimpleXMLParserDocumentException,
                                                  UPnPException,
                                                  IOException
The use_http_connection flag is set to false sometimes to avoid using the URLConnection library for some dopey UPnP routers.

Throws:
SimpleXMLParserDocumentException
UPnPException
IOException

getTraceFile

protected File getTraceFile()

getAdapter

public UPnPAdapter getAdapter()

reportActivity

public void reportActivity(ResourceDownloader downloader,
                           String activity)
Specified by:
reportActivity in interface ResourceDownloaderListener
Overrides:
reportActivity in class ResourceDownloaderAdapter

failed

public void failed(ResourceDownloader downloader,
                   ResourceDownloaderException e)
Specified by:
failed in interface ResourceDownloaderListener
Overrides:
failed in class ResourceDownloaderAdapter

log

public void log(Throwable e)

log

public void log(String str)
Description copied from interface: UPnP
Logs a message to all registered log listeners

Specified by:
log in interface UPnP

logAlert

public void logAlert(String str,
                     boolean error,
                     int type)

addLogListener

public void addLogListener(UPnPLogListener l)
Specified by:
addLogListener in interface UPnP

removeLogListener

public void removeLogListener(UPnPLogListener l)
Specified by:
removeLogListener in interface UPnP

getRootDevices

public UPnPRootDevice[] getRootDevices()
Specified by:
getRootDevices in interface UPnP

addRootDeviceListener

public void addRootDeviceListener(UPnPListener l)
Specified by:
addRootDeviceListener in interface UPnP

removeRootDeviceListener

public void removeRootDeviceListener(UPnPListener l)
Specified by:
removeRootDeviceListener in interface UPnP