Prof. Guido Russo - Scope - Università degli Studi di Napoli Federico II
Prof. Guido Russo - Scope - Università degli Studi di Napoli Federico II
Prof. Guido Russo - Scope - Università degli Studi di Napoli Federico II
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
public boolean setAttributesOfDevice(String name, Hashtable attributes)<br />
{<br />
try {<br />
if (attributes == null) {<br />
return false;<br />
}<br />
Element node = this.device.getElementById(name);<br />
if (node == null) {<br />
return false;<br />
}<br />
attributes.put("name", name);<br />
updateAttributes(node, attributes);<br />
Document tmp = saveDocument(this.device, this.deviceFile,<br />
this.deviceDtdFileName);<br />
if (tmp != null) {<br />
this.device = tmp; return true;<br />
}<br />
return false;<br />
}<br />
catch (Exception e) {<br />
return false;<br />
}<br />
}<br />
protected boolean setNodeTag(String nodeName, String tagName, String tagSubName,<br />
Hashtable attributes) {<br />
boolean ret = true;<br />
try {<br />
Node root = this.device.getElementById(nodeName);<br />
if (root != null) {<br />
Node plugin = null;<br />
NodeList select = XPath("devices/device[@name=\"" + nodeName + "\"]/" +<br />
tagName, this.device);<br />
if (select.getLength() == 0) {<br />
plugin = this.device.createElement(tagName);<br />
root.appendChild(plugin);<br />
}<br />
else {<br />
plugin = select.item(0);<br />
}<br />
Node pluginSub = null;<br />
select = XPath("devices/device[@name=\"" + nodeName + "\"]/" + tagName +<br />
"/" + tagSubName, this.device);<br />
if (select.getLength() == 0) {<br />
pluginSub = this.device.createElement(tagSubName);<br />
plugin.appendChild(pluginSub);<br />
}<br />
else<br />
{pluginSub = select.item(0);<br />
}<br />
updateAttributes((Element)pluginSub, attributes);<br />
}<br />
else {<br />
ret = false;<br />
}<br />
Document tmp = saveDocument(this.device, this.deviceFile,<br />
this.deviceDtdFileName);<br />
if (tmp != null) {<br />
this.device = tmp; return ret;<br />
}<br />
return false;<br />
}<br />
catch (Exception e) {<br />
return false;<br />
}<br />
}<br />
/**<br />
Pietro Neroni 566/2833 Pagina 87 <strong>di</strong> 117