Search in sources :

Example 1 with InvalidDescriptionException

use of org.cybergarage.upnp.device.InvalidDescriptionException in project i2p.i2p by i2p.

the class Device method loadDescription.

public boolean loadDescription(File file) throws InvalidDescriptionException {
    try {
        Parser parser = UPnP.getXMLParser();
        rootNode = parser.parse(file);
        if (rootNode == null)
            throw new InvalidDescriptionException(Description.NOROOT_EXCEPTION, file);
        deviceNode = rootNode.getNode(Device.ELEM_NAME);
        if (deviceNode == null)
            throw new InvalidDescriptionException(Description.NOROOTDEVICE_EXCEPTION, file);
    } catch (ParserException e) {
        throw new InvalidDescriptionException(e);
    }
    if (initializeLoadedDescription() == false)
        return false;
    setDescriptionFile(file);
    return true;
}
Also used : ParserException(org.cybergarage.xml.ParserException) InvalidDescriptionException(org.cybergarage.upnp.device.InvalidDescriptionException) Parser(org.cybergarage.xml.Parser)

Example 2 with InvalidDescriptionException

use of org.cybergarage.upnp.device.InvalidDescriptionException in project i2p.i2p by i2p.

the class Device method loadDescription.

/**
 * @since 1.8.0
 */
public boolean loadDescription(InputStream input) throws InvalidDescriptionException {
    try {
        Parser parser = UPnP.getXMLParser();
        rootNode = parser.parse(input);
        if (rootNode == null)
            throw new InvalidDescriptionException(Description.NOROOT_EXCEPTION);
        deviceNode = rootNode.getNode(Device.ELEM_NAME);
        if (deviceNode == null)
            throw new InvalidDescriptionException(Description.NOROOTDEVICE_EXCEPTION);
    } catch (ParserException e) {
        throw new InvalidDescriptionException(e);
    }
    if (initializeLoadedDescription() == false)
        return false;
    setDescriptionFile(null);
    return true;
}
Also used : ParserException(org.cybergarage.xml.ParserException) InvalidDescriptionException(org.cybergarage.upnp.device.InvalidDescriptionException) Parser(org.cybergarage.xml.Parser)

Example 3 with InvalidDescriptionException

use of org.cybergarage.upnp.device.InvalidDescriptionException in project i2p.i2p by i2p.

the class Device method loadDescription.

public boolean loadDescription(String descString) throws InvalidDescriptionException {
    try {
        Parser parser = UPnP.getXMLParser();
        rootNode = parser.parse(descString);
        if (rootNode == null)
            throw new InvalidDescriptionException(Description.NOROOT_EXCEPTION);
        deviceNode = rootNode.getNode(Device.ELEM_NAME);
        if (deviceNode == null)
            throw new InvalidDescriptionException(Description.NOROOTDEVICE_EXCEPTION);
    } catch (ParserException e) {
        throw new InvalidDescriptionException(e);
    }
    if (initializeLoadedDescription() == false)
        return false;
    setDescriptionFile(null);
    return true;
}
Also used : ParserException(org.cybergarage.xml.ParserException) InvalidDescriptionException(org.cybergarage.upnp.device.InvalidDescriptionException) Parser(org.cybergarage.xml.Parser)

Example 4 with InvalidDescriptionException

use of org.cybergarage.upnp.device.InvalidDescriptionException 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

InvalidDescriptionException (org.cybergarage.upnp.device.InvalidDescriptionException)4 Parser (org.cybergarage.xml.Parser)4 ParserException (org.cybergarage.xml.ParserException)4 ServiceData (org.cybergarage.upnp.xml.ServiceData)1 Node (org.cybergarage.xml.Node)1