Search in sources :

Example 1 with ServiceData

use of org.cybergarage.upnp.xml.ServiceData in project i2p.i2p by i2p.

the class Service method getSCPDNode.

private Node getSCPDNode() {
    ServiceData data = getServiceData();
    Node scpdNode = data.getSCPDNode();
    if (scpdNode != null)
        return scpdNode;
    // Thanks for Jaap (Sep 18, 2010)
    Device rootDev = getRootDevice();
    if (rootDev == null)
        return null;
    String scpdURLStr = getSCPDURL();
    try {
        URL scpdUrl = new URL(rootDev.getAbsoluteURL(scpdURLStr));
        scpdNode = getSCPDNode(scpdUrl);
        if (scpdNode != null) {
            data.setSCPDNode(scpdNode);
            return scpdNode;
        }
    } catch (Exception e) {
        // I2P
        Debug.warning(e);
    }
    return null;
}
Also used : Node(org.cybergarage.xml.Node) ServiceData(org.cybergarage.upnp.xml.ServiceData) URL(java.net.URL) ParserException(org.cybergarage.xml.ParserException) InvalidDescriptionException(org.cybergarage.upnp.device.InvalidDescriptionException)

Example 2 with ServiceData

use of org.cybergarage.upnp.xml.ServiceData in project i2p.i2p by i2p.

the class Service method loadSCPD.

/**
 * @since 1.8.0
 */
public boolean loadSCPD(InputStream input) throws ParserException {
    Parser parser = UPnP.getXMLParser();
    Node scpdNode = parser.parse(input);
    if (scpdNode == null)
        return false;
    ServiceData data = getServiceData();
    data.setSCPDNode(scpdNode);
    return true;
}
Also used : Node(org.cybergarage.xml.Node) ServiceData(org.cybergarage.upnp.xml.ServiceData) Parser(org.cybergarage.xml.Parser)

Example 3 with ServiceData

use of org.cybergarage.upnp.xml.ServiceData in project i2p.i2p by i2p.

the class Service method getServiceData.

// //////////////////////////////////////////////
// UserData
// //////////////////////////////////////////////
private ServiceData getServiceData() {
    Node node = getServiceNode();
    ServiceData userData = (ServiceData) node.getUserData();
    if (userData == null) {
        userData = new ServiceData();
        node.setUserData(userData);
        userData.setNode(node);
    }
    return userData;
}
Also used : Node(org.cybergarage.xml.Node) ServiceData(org.cybergarage.upnp.xml.ServiceData)

Example 4 with ServiceData

use of org.cybergarage.upnp.xml.ServiceData in project i2p.i2p by i2p.

the class Service method loadSCPD.

public boolean loadSCPD(File file) throws ParserException {
    Parser parser = UPnP.getXMLParser();
    Node scpdNode = parser.parse(file);
    if (scpdNode == null)
        return false;
    ServiceData data = getServiceData();
    data.setSCPDNode(scpdNode);
    return true;
}
Also used : Node(org.cybergarage.xml.Node) ServiceData(org.cybergarage.upnp.xml.ServiceData) Parser(org.cybergarage.xml.Parser)

Example 5 with ServiceData

use of org.cybergarage.upnp.xml.ServiceData in project i2p.i2p by i2p.

the class Service method loadSCPD.

// //////////////////////////////////////////////
// SCPD node
// //////////////////////////////////////////////
public boolean loadSCPD(String scpdStr) throws InvalidDescriptionException {
    try {
        Parser parser = UPnP.getXMLParser();
        Node scpdNode = parser.parse(scpdStr);
        if (scpdNode == null)
            return false;
        ServiceData data = getServiceData();
        data.setSCPDNode(scpdNode);
    } catch (ParserException e) {
        throw new InvalidDescriptionException(e);
    }
    return true;
}
Also used : ParserException(org.cybergarage.xml.ParserException) Node(org.cybergarage.xml.Node) InvalidDescriptionException(org.cybergarage.upnp.device.InvalidDescriptionException) ServiceData(org.cybergarage.upnp.xml.ServiceData) Parser(org.cybergarage.xml.Parser)

Aggregations

ServiceData (org.cybergarage.upnp.xml.ServiceData)5 Node (org.cybergarage.xml.Node)5 Parser (org.cybergarage.xml.Parser)3 InvalidDescriptionException (org.cybergarage.upnp.device.InvalidDescriptionException)2 ParserException (org.cybergarage.xml.ParserException)2 URL (java.net.URL)1