List of usage examples for org.dom4j.io XMLWriter XMLWriter
public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException
From source file:com.zimbra.cs.dav.DomUtil.java
License:Open Source License
public static void writeDocumentToStream(Document doc, OutputStream out) throws IOException { OutputFormat format = OutputFormat.createPrettyPrint(); format.setTrimText(false);/*w ww.j a va 2 s .c o m*/ format.setOmitEncoding(false); XMLWriter writer = new XMLWriter(out, format); writer.write(doc); }
From source file:com.zimbra.cs.dav.resource.DavResource.java
License:Open Source License
protected String getPropertiesAsText(DavContext ctxt) throws IOException { Element e = org.dom4j.DocumentHelper.createElement(DavElements.E_PROP); for (ResourceProperty rp : mProps.values()) rp.toElement(ctxt, e, false);//from www . j ava2 s .co m OutputFormat format = OutputFormat.createPrettyPrint(); format.setTrimText(false); format.setOmitEncoding(false); ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLWriter writer = new XMLWriter(baos, format); writer.write(e); return new String(baos.toByteArray()); }
From source file:com.zimbra.cs.dav.resource.MailItemResource.java
License:Open Source License
@Override public void patchProperties(DavContext ctxt, java.util.Collection<Element> set, java.util.Collection<QName> remove) throws DavException, IOException { List<QName> reqProps = new ArrayList<QName>(); for (QName n : remove) { mDeadProps.remove(n);/*from w w w. j av a 2 s .co m*/ reqProps.add(n); } for (Element e : set) { QName name = e.getQName(); if (name.equals(DavElements.E_DISPLAYNAME) && (type == MailItem.Type.FOLDER || type == MailItem.Type.MOUNTPOINT)) { // rename folder try { String val = e.getText(); String uri = getUri(); Mailbox mbox = getMailbox(ctxt); mbox.rename(ctxt.getOperationContext(), mId, type, val, mFolderId); setProperty(DavElements.P_DISPLAYNAME, val); UrlNamespace.addToRenamedResource(getOwner(), uri, this); UrlNamespace.addToRenamedResource(getOwner(), uri.substring(0, uri.length() - 1), this); } catch (ServiceException se) { ctxt.getResponseProp().addPropError(DavElements.E_DISPLAYNAME, new DavException(se.getMessage(), DavProtocol.STATUS_FAILED_DEPENDENCY)); } mDeadProps.remove(name); continue; } else if (name.equals(DavElements.E_CALENDAR_COLOR) && (type == MailItem.Type.FOLDER || type == MailItem.Type.MOUNTPOINT)) { // change color String colorStr = e.getText(); Color color = new Color(colorStr.substring(0, 7)); byte col = (byte) COLOR_LIST.indexOf(colorStr); if (col >= 0) color.setColor(col); try { Mailbox mbox = getMailbox(ctxt); mbox.setColor(ctxt.getOperationContext(), new int[] { mId }, type, color); } catch (ServiceException se) { ctxt.getResponseProp().addPropError(DavElements.E_CALENDAR_COLOR, new DavException(se.getMessage(), DavProtocol.STATUS_FAILED_DEPENDENCY)); } mDeadProps.remove(name); continue; } else if (name.equals(DavElements.E_SUPPORTED_CALENDAR_COMPONENT_SET)) { // change default view @SuppressWarnings("unchecked") List<Element> elements = e.elements(DavElements.E_COMP); boolean isTodo = false; boolean isEvent = false; for (Element element : elements) { Attribute attr = element.attribute(DavElements.P_NAME); if (attr != null && CalComponent.VTODO.name().equals(attr.getValue())) { isTodo = true; } else if (attr != null && CalComponent.VEVENT.name().equals(attr.getValue())) { isEvent = true; } } if (isEvent ^ isTodo) { // we support a calendar collection of type event or todo, not both or none. Type type = (isEvent) ? Type.APPOINTMENT : Type.TASK; try { Mailbox mbox = getMailbox(ctxt); mbox.setFolderDefaultView(ctxt.getOperationContext(), mId, type); // Update the view for this collection. This collection may get cached if display name is modified. // See UrlNamespace.addToRenamedResource() if (this instanceof Collection) { ((Collection) this).view = type; } } catch (ServiceException se) { ctxt.getResponseProp().addPropError(name, new DavException(se.getMessage(), DavProtocol.STATUS_FAILED_DEPENDENCY)); } } else { ctxt.getResponseProp().addPropError(name, new DavException.CannotModifyProtectedProperty(name)); } continue; } mDeadProps.put(name, e); reqProps.add(name); } String configVal = ""; if (mDeadProps.size() > 0) { org.dom4j.Document doc = org.dom4j.DocumentHelper.createDocument(); Element top = doc.addElement(CONFIG_KEY); for (Map.Entry<QName, Element> entry : mDeadProps.entrySet()) top.add(entry.getValue().detach()); ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputFormat format = OutputFormat.createCompactFormat(); XMLWriter writer = new XMLWriter(out, format); writer.write(doc); configVal = new String(out.toByteArray(), "UTF-8"); if (configVal.length() > PROP_LENGTH_LIMIT) for (Map.Entry<QName, Element> entry : mDeadProps.entrySet()) ctxt.getResponseProp().addPropError(entry.getKey(), new DavException("prop length exceeded", DavProtocol.STATUS_INSUFFICIENT_STORAGE)); } Mailbox mbox = null; try { mbox = getMailbox(ctxt); mbox.lock.lock(); Metadata data = mbox.getConfig(ctxt.getOperationContext(), CONFIG_KEY); if (data == null) { data = new Metadata(); } data.put(Integer.toString(mId), configVal); mbox.setConfig(ctxt.getOperationContext(), CONFIG_KEY, data); } catch (ServiceException se) { for (QName qname : reqProps) ctxt.getResponseProp().addPropError(qname, new DavException(se.getMessage(), HttpServletResponse.SC_FORBIDDEN)); } finally { if (mbox != null) mbox.lock.release(); } }
From source file:com.zimbra.soap.util.WsdlGenerator.java
License:Open Source License
public static void writeWsdl(OutputStream xmlOut, String targetNamespace, String serviceName, List<WsdlInfoForNamespace> nsInfos) throws IOException { Document wsdlDoc = makeWsdlDoc(nsInfos, serviceName, targetNamespace); OutputFormat format = OutputFormat.createPrettyPrint(); XMLWriter writer = new XMLWriter(xmlOut, format); writer.write(wsdlDoc);//from w w w . j av a 2 s. c om writer.close(); }
From source file:com.ztesoft.inf.extend.xstream.io.xml.Dom4JDriver.java
License:Open Source License
public HierarchicalStreamWriter createWriter(final Writer out) { final HierarchicalStreamWriter[] writer = new HierarchicalStreamWriter[1]; final FilterWriter filter = new FilterWriter(out) { @Override/* w w w . j a va 2 s. com*/ public void close() { writer[0].close(); } }; writer[0] = new Dom4JXmlWriter(new XMLWriter(filter, outputFormat), xmlFriendlyReplacer()); return writer[0]; }
From source file:com.zuuyii.action.admin.InstallAction.java
public String save() throws URISyntaxException, IOException, DocumentException { if (isInstalled()) { return ajaxJsonErrorMessage("SHOP++?????"); }//from w w w . j a v a2 s . co m if (StringUtils.isEmpty(databaseHost)) { return ajaxJsonErrorMessage("?!"); } if (StringUtils.isEmpty(databasePort)) { return ajaxJsonErrorMessage("??!"); } if (StringUtils.isEmpty(databaseUsername)) { return ajaxJsonErrorMessage("???!"); } if (StringUtils.isEmpty(databasePassword)) { return ajaxJsonErrorMessage("??!"); } if (StringUtils.isEmpty(databaseName)) { return ajaxJsonErrorMessage("???!"); } if (StringUtils.isEmpty(adminUsername)) { return ajaxJsonErrorMessage("???!"); } if (StringUtils.isEmpty(adminPassword)) { return ajaxJsonErrorMessage("??!"); } if (StringUtils.isEmpty(installStatus)) { Map<String, String> jsonMap = new HashMap<String, String>(); jsonMap.put(STATUS, "requiredCheckFinish"); return ajaxJson(jsonMap); } String jdbcUrl = "jdbc:mysql://" + databaseHost + ":" + databasePort + "/" + databaseName + "?useUnicode=true&characterEncoding=UTF-8"; Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { // ? connection = DriverManager.getConnection(jdbcUrl, databaseUsername, databasePassword); DatabaseMetaData databaseMetaData = connection.getMetaData(); String[] types = { "TABLE" }; resultSet = databaseMetaData.getTables(null, databaseName, "%", types); if (StringUtils.equalsIgnoreCase(installStatus, "databaseCheck")) { Map<String, String> jsonMap = new HashMap<String, String>(); jsonMap.put(STATUS, "databaseCheckFinish"); return ajaxJson(jsonMap); } // ? if (StringUtils.equalsIgnoreCase(installStatus, "databaseCreate")) { StringBuffer stringBuffer = new StringBuffer(); BufferedReader bufferedReader = null; String sqlFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI() .getPath() + SQL_INSTALL_FILE_NAME; bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream(sqlFilePath), "UTF-8")); String line = ""; while (null != line) { line = bufferedReader.readLine(); stringBuffer.append(line); if (null != line && line.endsWith(";")) { System.out.println("[SHOP++?]SQL: " + line); preparedStatement = connection.prepareStatement(stringBuffer.toString()); preparedStatement.executeUpdate(); stringBuffer = new StringBuffer(); } } String insertAdminSql = "INSERT INTO `Admin` VALUES ('402881862bec2a21012bec2bd8de0003','2010-10-10 0:0:0','2010-10-10 0:0:0','','admin@shopxx.net',b'1',b'0',b'0',b'0',NULL,NULL,0,NULL,'?','" + DigestUtils.md5Hex(adminPassword) + "','" + adminUsername + "');"; String insertAdminRoleSql = "INSERT INTO `Admin_Role` VALUES ('402881862bec2a21012bec2bd8de0003','402881862bec2a21012bec2b70510002');"; preparedStatement = connection.prepareStatement(insertAdminSql); preparedStatement.executeUpdate(); preparedStatement = connection.prepareStatement(insertAdminRoleSql); preparedStatement.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); return ajaxJsonErrorMessage("???!"); } finally { try { if (resultSet != null) { resultSet.close(); resultSet = null; } if (preparedStatement != null) { preparedStatement.close(); preparedStatement = null; } if (connection != null) { connection.close(); connection = null; } } catch (SQLException e) { e.printStackTrace(); } } // ??? String configFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + JDBC_CONFIG_FILE_NAME; Properties properties = new Properties(); properties.put("jdbc.driver", "com.mysql.jdbc.Driver"); properties.put("jdbc.url", jdbcUrl); properties.put("jdbc.username", databaseUsername); properties.put("jdbc.password", databasePassword); properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect"); properties.put("hibernate.show_sql", "false"); properties.put("hibernate.format_sql", "false"); OutputStream outputStream = new FileOutputStream(configFilePath); properties.store(outputStream, JDBC_CONFIG_FILE_DESCRIPTION); outputStream.close(); // ?? /*String backupWebConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + BACKUP_WEB_CONFIG_FILE_NAME; String backupApplicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + BACKUP_APPLICATION_CONTEXT_CONFIG_FILE_NAME; String backupCompassApplicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + BACKUP_COMPASS_APPLICATION_CONTEXT_CONFIG_FILE_NAME; String backupSecurityApplicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + BACKUP_SECURITY_APPLICATION_CONTEXT_CONFIG_FILE_NAME; String webConfigFilePath = new File(Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath()).getParent() + "/" + WEB_CONFIG_FILE_NAME; String applicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + APPLICATION_CONTEXT_CONFIG_FILE_NAME; String compassApplicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + COMPASS_APPLICATION_CONTEXT_CONFIG_FILE_NAME; String securityApplicationContextConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + SECURITY_APPLICATION_CONTEXT_CONFIG_FILE_NAME; FileUtils.copyFile(new File(backupWebConfigFilePath), new File(webConfigFilePath)); FileUtils.copyFile(new File(backupApplicationContextConfigFilePath), new File(applicationContextConfigFilePath)); FileUtils.copyFile(new File(backupCompassApplicationContextConfigFilePath), new File(compassApplicationContextConfigFilePath)); FileUtils.copyFile(new File(backupSecurityApplicationContextConfigFilePath), new File(securityApplicationContextConfigFilePath)); */ // ?? String systemConfigFilePath = Thread.currentThread().getContextClassLoader().getResource("").toURI() .getPath() + SystemConfigUtil.CONFIG_FILE_NAME; File systemConfigFile = new File(systemConfigFilePath); SAXReader saxReader = new SAXReader(); Document document = saxReader.read(systemConfigFile); Element rootElement = document.getRootElement(); Element systemConfigElement = rootElement.element("systemConfig"); Node isInstalledNode = document.selectSingleNode("/shopxx/systemConfig/isInstalled"); if (isInstalledNode == null) { isInstalledNode = systemConfigElement.addElement("isInstalled"); } isInstalledNode.setText("true"); try { OutputFormat outputFormat = OutputFormat.createPrettyPrint();// XML? outputFormat.setEncoding("UTF-8");// XML? outputFormat.setIndent(true);// ? outputFormat.setIndent(" ");// TAB? outputFormat.setNewlines(true);// ?? XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(systemConfigFile), outputFormat); xmlWriter.write(document); xmlWriter.close(); } catch (Exception e) { e.printStackTrace(); } return ajaxJsonSuccessMessage("SHOP++?????"); }
From source file:condorclient.utilities.XMLHandler.java
public String createName_IdXML() { String strXML = null;/*from ww w. j a v a 2 s . c o m*/ Document document = DocumentHelper.createDocument(); // document. Element root = document.addElement("root"); Element info = root.addElement("info"); Element job = info.addElement("job"); job.addAttribute("name", "test"); job.addAttribute("id", "0"); StringWriter strWtr = new StringWriter(); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding("UTF-8"); XMLWriter xmlWriter = new XMLWriter(strWtr, format); try { xmlWriter.write(document); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } strXML = strWtr.toString(); //-------- //------- //strXML=document.asXML(); //------ //------------- File file = new File("niInfo.xml"); if (file.exists()) { file.delete(); } try { file.createNewFile(); XMLWriter out = new XMLWriter(new FileWriter(file)); out.write(document); out.flush(); out.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //-------------- return strXML; }
From source file:condorclient.utilities.XMLHandler.java
public String createXML() { String strXML = null;//from w ww . j a va 2 s. com Document document = DocumentHelper.createDocument(); // document. Element root = document.addElement("root"); Element job = root.addElement("Job"); Element jobDescFile = job.addElement("item"); jobDescFile.addAttribute("about", "descfile"); Element file_name = jobDescFile.addElement("name"); file_name.addText("submit.txt"); Element filer_path = jobDescFile.addElement("path"); filer_path.addText("D:\\HTCondor\\test\\2"); StringWriter strWtr = new StringWriter(); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding("UTF-8"); XMLWriter xmlWriter = new XMLWriter(strWtr, format); try { xmlWriter.write(document); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } strXML = strWtr.toString(); //-------- //------- //strXML=document.asXML(); //------ //------------- File file = new File("condorclient.xml"); if (file.exists()) { file.delete(); } try { file.createNewFile(); XMLWriter out = new XMLWriter(new FileWriter(file)); out.write(document); out.flush(); out.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //-------------- return strXML; }
From source file:controler.ExportDataToXML.java
public ExportDataToXML() throws UnsupportedEncodingException, IOException { ArrayList<Password> data = ApplicationData.getPasswords(); Document document = DocumentHelper.createDocument(); Element root = document.addElement("Registos"); Element registo;/*www . j ava2 s.com*/ int ord = 0; for (Password reg : data) { ord++; registo = root.addElement("Registo").addAttribute("num", "" + ord); registo.addElement("titulo").addText(reg.getTitle()); registo.addElement("user").addText(reg.getUser()); registo.addElement("pass").addText(reg.getPass()); registo.addElement("site").addText(reg.getSite()); registo.addElement("nota").addText(reg.getNote()); } // Pretty print the document to System.out OutputFormat format = OutputFormat.createPrettyPrint(); XMLWriter writer; writer = new XMLWriter(System.out, format); writer.write(document); //write to file FileOutputStream fos = new FileOutputStream("cyphDados.xml"); writer = new XMLWriter(fos, format); writer.write(document); //fos.close(); }
From source file:controllers.FXMLScicumulusController.java
public void createScicumulusXML() throws IOException, Exception { paneGraph.requestFocus();//Altera o foco para o paneGraph this.fieldsRequired = Arrays.asList(txtTagWorkflow, txtDescriptionWorkflow, txtExecTagWorkflow, txtExpDirWorkflow, txtNameDatabase, txtServerDatabase, txtPortDatabase, txtUsernameDatabase, txtPasswordDatabase, txt_server_directory); //Monta o arquivo Scicumulus.xml // if (!isFieldEmpty()) { //Cria o diretrio de expanso this.directoryExp = dirProject.getAbsolutePath() + "/" + txtExpDirWorkflow.getText().trim(); File dir = new File(this.directoryExp); dir.mkdirs();//from ww w .j a v a2 s . co m File dirPrograms = new File(this.directoryExp + "/programs"); // this.directoryPrograms = dirPrograms.getPath(); dirPrograms.mkdir(); setDataActivity(this.activity);//Utilizado para gravar a ltima activity Document doc = DocumentFactory.getInstance().createDocument(); Element root = doc.addElement("SciCumulus"); Element environment = root.addElement("environment"); environment.addAttribute("type", "LOCAL"); Element binary = root.addElement("binary"); binary.addAttribute("directory", this.directoryExp + "/bin"); binary.addAttribute("execution_version", "SCCore.jar"); Element constraint = root.addElement("constraint"); constraint.addAttribute("workflow_exectag", "montage-1"); constraint.addAttribute("cores", this.txt_cores_machines.getText()); Element workspace = root.addElement("workspace"); workspace.addAttribute("workflow_dir", this.dirProject.getAbsolutePath()); Element database = root.addElement("database"); database.addAttribute("name", txtNameDatabase.getText()); database.addAttribute("server", txtServerDatabase.getText()); database.addAttribute("port", txtPortDatabase.getText()); database.addAttribute("username", txtUsernameDatabase.getText()); database.addAttribute("password", txtPasswordDatabase.getText()); Element hydraWorkflow = root.addElement("conceptualWorkflow"); hydraWorkflow.addAttribute("tag", txtTagWorkflow.getText().replace(" ", "").trim()); hydraWorkflow.addAttribute("description", txtDescriptionWorkflow.getText()); hydraWorkflow.addAttribute("exectag", txtExecTagWorkflow.getText()); hydraWorkflow.addAttribute("expdir", this.directoryExp); Element hydraActivity; for (Activity act : this.activities) { hydraActivity = hydraWorkflow.addElement("activity"); hydraActivity.addAttribute("tag", act.getTag().replace(" ", "").trim()); hydraActivity.addAttribute("description", act.getDescription()); hydraActivity.addAttribute("type", act.getType()); hydraActivity.addAttribute("template", act.getTemplatedir()); hydraActivity.addAttribute("activation", act.getActivation()); hydraActivity.addAttribute("extractor", "./extractor.cmd"); dir = new File(this.directoryExp + "/template_" + act.getName()); dir.mkdirs(); //Criando arquivo experiment.cmd File fout = new File(dir.getPath() + "/" + "experiment.cmd"); FileOutputStream fos = new FileOutputStream(fout); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos)); for (String command : act.getCommands()) { bw.write("sleep " + chb_sleeptime.getValue().toString()); bw.newLine(); bw.write(command); bw.newLine(); } bw.close(); String input = new String(); String output = new String(); int cont = 0; for (Relation rel : this.relations) { if (act.equals(rel.nodeStart)) { if (cont == 0) { //Primeira entrada Element relation1 = hydraActivity.addElement("relation"); relation1.addAttribute("reltype", "Input"); relation1.addAttribute("name", "I" + act.getName()); // relation1.addAttribute("filename", act.getInput_filename());//Colocar o nome do arquivo } Element relation2 = hydraActivity.addElement("relation"); relation2.addAttribute("reltype", "Output"); relation2.addAttribute("name", "O" + act.getName()); // relation2.addAttribute("filename", act.getOutput_filename());//Colocar o nome do arquivo // input = "I"+act.getName(); } if (act.equals(rel.nodeEnd)) { Activity dependency = (Activity) rel.nodeStart; Element relation1 = hydraActivity.addElement("relation"); relation1.addAttribute("reltype", "Input"); relation1.addAttribute("name", "I" + act.getName()); relation1.addAttribute("filename", act.getInput_filename());//Colocar o nome do arquivo relation1.addAttribute("dependency", dependency.getTag());//Colocar o nome da dependncia se existir if (cont == this.relations.size() - 1) { //ltima sada Element relation2 = hydraActivity.addElement("relation"); relation2.addAttribute("reltype", "Output"); relation2.addAttribute("name", "O" + act.getName()); // relation2.addAttribute("filename", act.getOutput_filename());//Colocar o nome do arquivo } // output = "O"+act.getName(); } cont++; } input = "I" + act.getName(); output = "O" + act.getName(); for (Field fieldAct : act.getFields()) { Element field = hydraActivity.addElement("field"); field.addAttribute("name", fieldAct.getName()); field.addAttribute("type", fieldAct.getType()); field.addAttribute("input", input); if (!fieldAct.getType().equals("string")) { field.addAttribute("output", output); } if (fieldAct.getType().equals("float")) { field.addAttribute("decimalplaces", fieldAct.getDecimalPlaces()); } if (fieldAct.getType().equals("file")) { field.addAttribute("operation", fieldAct.getOperation()); } } // String input = new String(); // String output = new String(); // // int cont = 0; // for (Relation rel : this.relations) { // if (act.equals(rel.nodeStart)) { // if (cont == 0) { // //Primeira entrada // Element relation1 = hydraActivity.addElement("relation"); // relation1.addAttribute("reltype", "Input"); // relation1.addAttribute("name", rel.getName() + "_" + "input"); //// relation1.addAttribute("filename", act.getInput_filename());//Colocar o nome do arquivo // } // Element relation2 = hydraActivity.addElement("relation"); // relation2.addAttribute("reltype", "Output"); // relation2.addAttribute("name", rel.getName() + "_" + "output"); //// relation2.addAttribute("filename", act.getOutput_filename());//Colocar o nome do arquivo // // input = rel.getName(); // } // if (act.equals(rel.nodeEnd)) { // Activity dependency = (Activity) rel.nodeStart; // Element relation1 = hydraActivity.addElement("relation"); // relation1.addAttribute("reltype", "Input"); // relation1.addAttribute("name", rel.getName() + "_" + "input"); // relation1.addAttribute("filename", act.getInput_filename());//Colocar o nome do arquivo // relation1.addAttribute("dependency", dependency.getTag());//Colocar o nome da dependncia se existir // // if (cont == this.relations.size() - 1) { // //ltima sada // Element relation2 = hydraActivity.addElement("relation"); // relation2.addAttribute("reltype", "Output"); // relation2.addAttribute("name", rel.getName() + "_" + "output"); //// relation2.addAttribute("filename", act.getOutput_filename());//Colocar o nome do arquivo // } // output = rel.getName(); // } // cont++; // } // Element field = hydraActivity.addElement("field"); // field.addAttribute("name", "FASTA_FILE"); // field.addAttribute("type", "string"); // field.addAttribute("input", input); // field.addAttribute("output", output); Element file = hydraActivity.addElement("File"); file.addAttribute("filename", "experiment.cmd"); file.addAttribute("instrumented", "true"); } Element executionWorkflow = root.addElement("executionWorkflow"); executionWorkflow.addAttribute("tag", txtTagWorkflow.getText().replace(" ", "").trim()); executionWorkflow.addAttribute("execmodel", "DYN_FAF"); executionWorkflow.addAttribute("expdir", this.directoryExp); executionWorkflow.addAttribute("max_failure", "1"); executionWorkflow.addAttribute("user_interaction", "false"); executionWorkflow.addAttribute("redundancy", "false"); executionWorkflow.addAttribute("reliability", "0.1"); Element relationInput = executionWorkflow.addElement("relation"); // relationInput.addAttribute("name", "IListFits"); relationInput.addAttribute("name", "input_workflow"); relationInput.addAttribute("filename", this.inputFile.getName()); //Gravando arquivo FileOutputStream fos = new FileOutputStream(this.directoryExp + "/SciCumulus.xml"); OutputFormat format = OutputFormat.createPrettyPrint(); XMLWriter writer = new XMLWriter(fos, format); writer.write(doc); writer.flush(); try { //Criando o arquivo machines.conf createMachinesConf(); //Criando o arquivo parameter.txt // createParameterTxt(ta_parameters.getText()); } catch (IOException ex) { Logger.getLogger(FXMLScicumulusController.class.getName()).log(Level.SEVERE, null, ex); } //Copiando arquivos para o diretrio programs Utils.copyFiles(this.dirPrograms, directoryExp + "/programs/"); Utils.copyFiles(this.inputFile, directoryExp + "/" + this.inputFile.getName()); // sendWorkflow(this.directoryExp, "/deploy/experiments"); // sendWorkflow(this.directoryExp, this.txt_server_directory.getText().trim()); // String[] dirComplete = this.directoryExp.split(this.directoryDefaultFiles)[1].split("/"); // String dirLocal = this.directoryDefaultFiles + dirComplete[0]; // sendWorkflow(dirLocal, this.txt_server_directory.getText().trim()); sendWorkflow(this.dirProject.getAbsolutePath(), this.txt_server_directory.getText().trim()); // }else{ // JOptionPane.showMessageDialog(null, "Preencha os campos obrigatrios!"); // } // if (isActivityEmpty()) { // Dialogs.create() // .owner(null) // .title("Activity Duplicate") // .masthead(null) // .message("Existe uma activity que no est conectada!") // .showInformation(); // } }