public XmlElement toXML() { XmlElement xml = super.toXML(); xml.setAttributeValue( GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_STREAM_SOURCE); return xml; }
private void initSchema(File rootDir, File srcDir, File classesDir) { List<DataPort> inputPorts = node.getInputPorts(); for (DataPort inPort : inputPorts) { Port fromPort = inPort.getFromPort(); Node fromNode = inPort.getFromNode(); if (fromNode instanceof WSNode) { WSNode fromWsNode = (WSNode) fromNode; if (null != fromPort && fromPort instanceof DataPort) { DataPort fromDataPort = (DataPort) fromPort; WsdlDefinitions wsdl = engine.getGUI().getWorkflow().getWSDLs().get(fromWsNode.getWSDLID()); Iterator<XmlNamespace> itr = wsdl.xml().namespaces().iterator(); try { XmlElement schema = wsdl.getTypes().element("schema").clone(); // do not change the following ordering of setting // namespaces. schema.setNamespace( xsul5.XmlConstants.BUILDER.newNamespace("http://www.w3.org/2001/XMLSchema")); while (itr.hasNext()) { XmlNamespace next = itr.next(); if (!"".equals(next.getPrefix()) && null != next.getPrefix()) { schema.setAttributeValue("xmlns:" + next.getPrefix(), next.getName()); } } try { xsul5.XmlConstants.BUILDER.serializeToOutputStream( schema, new FileOutputStream( rootDir.getCanonicalPath() + File.separatorChar + "types.xsd")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } typesPath = rootDir.getCanonicalPath() + File.separatorChar + "mytype.jar"; String[] args = new String[] { "-d", classesDir.getCanonicalPath(), "-src", srcDir.getCanonicalPath(), "-out", typesPath, rootDir.getCanonicalPath() + File.separatorChar + "types.xsd" }; SchemaCompilerUtil.compile(args); } catch (XmlBuilderException e) { this.engine.getGUI().getErrorWindow().error(e); } catch (CloneNotSupportedException e) { this.engine.getGUI().getErrorWindow().error(e); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { throw new WorkflowRuntimeException("Unknown port for code generation" + fromPort); } } else { throw new WorkflowRuntimeException("Unknown from node for code generation" + fromNode); } } }