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 java.lang.String NL
           
protected  AEMonitor this_mon
           
 
Constructor Summary
protected UPnPImpl(UPnPAdapter _adapter, java.lang.String[] _selected_interfaces)
           
 
Method Summary
 void addLogListener(UPnPLogListener l)
           
 void addRootDeviceListener(UPnPListener l)
           
 SimpleXMLParserDocument downloadXML(UPnPDeviceImpl device, java.net.URL url)
           
 SimpleXMLParserDocument downloadXML(UPnPRootDeviceImpl root, java.net.URL url)
           
protected  SimpleXMLParserDocument downloadXMLSupport(java.lang.String friendly_name, java.net.URL url)
           
 void failed(ResourceDownloader downloader, ResourceDownloaderException e)
           
protected  boolean forceDirect()
           
 UPnPAdapter getAdapter()
           
 UPnPRootDevice[] getRootDevices()
           
static UPnP getSingleton(UPnPAdapter adapter, java.lang.String[] selected_interfaces)
           
 UPnPSSDP getSSDP()
           
protected  java.io.File getTraceFile()
           
 void injectDiscoveryCache(java.util.Map cache)
           
 void interfaceChanged(java.net.NetworkInterface network_interface)
           
 void log(java.lang.String str)
          Logs a message to all registered log listeners
 void log(java.lang.Throwable e)
           
 void logAlert(java.lang.String str, boolean error, int type)
           
 SimpleXMLParserDocument parseXML(java.io.InputStream _is)
           
 SimpleXMLParserDocument performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.String request)
           
 SimpleXMLParserDocument performSOAPRequest(UPnPService service, java.lang.String soap_action, java.lang.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, java.lang.String activity)
           
 void reset()
          resets by removing all root devices and then rediscovering them
 void rootAlive(java.lang.String usn, java.net.URL location)
           
 void rootDiscovered(java.net.NetworkInterface network_interface, java.net.InetAddress local_address, java.lang.String usn, java.net.URL location)
           
 void rootLost(java.net.InetAddress local_address, java.lang.String usn)
           
 void search()
          scan for new
 void search(java.lang.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 java.lang.String NL
See Also:
Constant Field Values

this_mon

protected AEMonitor this_mon
Constructor Detail

UPnPImpl

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

getSingleton

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

getSSDP

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

injectDiscoveryCache

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

rootDiscovered

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

rootAlive

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

rootLost

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

interfaceChanged

public void interfaceChanged(java.net.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(java.lang.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(java.io.InputStream _is)
                                 throws SimpleXMLParserDocumentException,
                                        java.io.IOException
Throws:
SimpleXMLParserDocumentException
java.io.IOException

downloadXML

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

downloadXML

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

downloadXMLSupport

protected SimpleXMLParserDocument downloadXMLSupport(java.lang.String friendly_name,
                                                     java.net.URL url)
                                              throws UPnPException
Throws:
UPnPException

forceDirect

protected boolean forceDirect()

performSOAPRequest

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

performSOAPRequest

public SimpleXMLParserDocument performSOAPRequest(UPnPService service,
                                                  java.lang.String soap_action,
                                                  java.lang.String request,
                                                  boolean use_http_connection)
                                           throws SimpleXMLParserDocumentException,
                                                  UPnPException,
                                                  java.io.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
java.io.IOException

getTraceFile

protected java.io.File getTraceFile()

getAdapter

public UPnPAdapter getAdapter()

reportActivity

public void reportActivity(ResourceDownloader downloader,
                           java.lang.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(java.lang.Throwable e)

log

public void log(java.lang.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(java.lang.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