use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class StateVariable method getAllowedValueList.
// //////////////////////////////////////////////
// AllowedValueList
// //////////////////////////////////////////////
public AllowedValueList getAllowedValueList() {
AllowedValueList valueList = new AllowedValueList();
Node valueListNode = getStateVariableNode().getNode(AllowedValueList.ELEM_NAME);
if (valueListNode == null)
return null;
int nNode = valueListNode.getNNodes();
for (int n = 0; n < nNode; n++) {
Node node = valueListNode.getNode(n);
if (AllowedValue.isAllowedValueNode(node) == false)
continue;
AllowedValue allowedVal = new AllowedValue(node);
valueList.add(allowedVal);
}
return valueList;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class ControlPoint method getDevice.
public Device getDevice(String name) {
int nRoots = devNodeList.size();
for (int n = 0; n < nRoots; n++) {
// AIOOB was thrown from here, maybe would be better to
// copy the list before traversal?
Node rootNode;
try {
rootNode = devNodeList.getNode(n);
} catch (ArrayIndexOutOfBoundsException aioob) {
break;
}
Device dev = getDevice(rootNode);
if (dev == null)
continue;
if (dev.isDevice(name) == true)
return dev;
Device cdev = dev.getDevice(name);
if (cdev != null)
return cdev;
}
return null;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getDeviceData.
// //////////////////////////////////////////////
// UserData
// //////////////////////////////////////////////
private DeviceData getDeviceData() {
Node node = getDeviceNode();
DeviceData userData = (DeviceData) node.getUserData();
if (userData == null) {
userData = new DeviceData();
node.setUserData(userData);
userData.setNode(node);
}
return userData;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getDescriptionData.
private synchronized byte[] getDescriptionData(String host) {
if (isNMPRMode() == false)
updateURLBase(host);
Node rootNode = getRootNode();
if (rootNode == null)
return new byte[0];
// Thanks for Mikael Hakman (04/25/05)
String desc = new String();
desc += UPnP.XML_DECLARATION;
desc += "\n";
desc += rootNode.toString();
return desc.getBytes();
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method addDevice.
/**
* Add a Device to device without checking for duplicate or syntax error.
* This method set or reset the root node of the Device and itself<br>
* <br>
* Note: This method should be used to create a dynamic<br>
* Device withtout writing any XML that describe the device<br>
*
* @param d Add Device d to the Device
*/
public void addDevice(Device d) {
Node deviceListNode = getDeviceNode().getNode(DeviceList.ELEM_NAME);
if (deviceListNode == null) {
// deviceListNode = new Node(ServiceList.ELEM_NAME); twa wrong
// ELEM_NAME;
deviceListNode = new Node(DeviceList.ELEM_NAME);
getDeviceNode().addNode(deviceListNode);
}
deviceListNode.addNode(d.getDeviceNode());
d.setRootNode(null);
if (getRootNode() == null) {
Node root = new Node(RootDescription.ROOT_ELEMENT);
root.setNameSpace("", RootDescription.ROOT_ELEMENT_NAMESPACE);
Node spec = new Node(RootDescription.SPECVERSION_ELEMENT);
Node maj = new Node(RootDescription.MAJOR_ELEMENT);
maj.setValue("1");
Node min = new Node(RootDescription.MINOR_ELEMENT);
min.setValue("0");
spec.addNode(maj);
spec.addNode(min);
root.addNode(spec);
setRootNode(root);
}
}
Aggregations