private static Document getDocument(File tomcatUsersFile) throws IOException { FileObject fo = FileUtil.toFileObject(tomcatUsersFile); if (fo == null) { throw new IOException(NbBundle.getMessage(TomcatUsers.class, "MSG_FileNotFound", tomcatUsersFile.getPath())); } XMLDataObject dobj = (XMLDataObject) DataObject.find(fo); try { return dobj.getDocument(); } catch (SAXException ex) { throw (IOException) (new IOException()).initCause(ex); } }
public static boolean setShutdownPort(int port, File tomcatConf) { FileObject fo = FileUtil.toFileObject(tomcatConf); if (fo != null) { try { XMLDataObject dobj = (XMLDataObject)DataObject.find(fo); org.w3c.dom.Document doc = dobj.getDocument(); org.w3c.dom.Element root = doc.getDocumentElement(); root.setAttribute("port", String.valueOf(port)); //NOI18N updateDocument(dobj,doc); return true; } catch(org.xml.sax.SAXException ex){ Exceptions.printStackTrace(ex); } catch(org.openide.loaders.DataObjectNotFoundException ex){ Exceptions.printStackTrace(ex); } catch(javax.swing.text.BadLocationException ex){ Exceptions.printStackTrace(ex); } catch(java.io.IOException ex){ Exceptions.printStackTrace(ex); } } return false; }
try { XMLDataObject dobj = (XMLDataObject)DataObject.find(fo); org.w3c.dom.Document doc = dobj.getDocument(); org.w3c.dom.Element root = doc.getDocumentElement(); org.w3c.dom.NodeList list = root.getElementsByTagName("Service"); //NOI18N
private ComponentProducer deserializeComponentCreatorFromXML (XMLDataObject xmlDataObject, Map<TypeID, FileObject> fileObjects) { Document document; try { document = xmlDataObject.getDocument (); if (document == null) return null; } catch (IOException e) { ErrorManager.getDefault ().notify (e); return null; } catch (SAXException e) { ErrorManager.getDefault ().notify (e); return null; } XMLComponentProducer producer = XMLComponentProducer.deserialize (projectType, document); if (producer != null) { fileObjects.put(producer.getMainComponentTypeID(), xmlDataObject.getPrimaryFile()); return producer; } Debug.warning ("Error during deserialization", xmlDataObject.getPrimaryFile ()); // NOI18N return null; }
private ComponentDescriptor deserializeComponentDescriptorFromXML (XMLDataObject xmlDataObject) { Document document; try { document = xmlDataObject.getDocument (); if (document == null) return null; } catch (IOException e) { ErrorManager.getDefault ().notify (e); return null; } catch (SAXException e) { ErrorManager.getDefault ().notify (e); return null; } XMLComponentDescriptor descriptor = new XMLComponentDescriptor (); if (descriptor.deserialize (projectType, document)) return descriptor; Debug.warning ("Error during deserialization", xmlDataObject.getPrimaryFile ()); // NOI18N return null; }
Document doc = ((XMLDataObject) dObj).getDocument();