use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.
the class S3InputNode method edgeWasAdded.
/**
* Called whan an Edge was added to the parameter port. Change the name of this node.
*
* @throws GraphException
*
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
// TODO organize this.
if (edge instanceof DataEdge) {
DataEdge dataEdge = (DataEdge) edge;
DataPort toPort = dataEdge.getToPort();
DataType toType = toPort.getType();
List<DataEdge> edges = getEdges();
if (edges.size() == 1) {
// The first edge.
setParameterType(toType);
if (!isConfigured() && toPort instanceof WSPort) {
// Copy
copyDefaultConfiguration((WSPort) toPort);
}
} else if (edges.size() > 1) {
// Not the first edge.
DataType parameterType = getParameterType();
if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !parameterType.equals(toType)) {
throw new GraphException("Cannot connect ports with different types.");
}
} else {
// Should not happen.
throw new WorkflowRuntimeException("edges.size(): " + edges.size());
}
}
}
use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.
the class DifferedInputNode method edgeWasAdded.
/**
* Called when an Edge was added to the parameter port. Change the name of
* this node.
*
* @throws GraphException
*
* @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasAdded(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
// TODO organize this.
if (edge instanceof DataEdge) {
DataEdge dataEdge = (DataEdge) edge;
DataPort toPort = dataEdge.getToPort();
DataType toType = toPort.getType();
List<DataEdge> edges = getEdges();
if (edges.size() == 1) {
// The first edge.
setParameterType(toType);
if (!isConfigured() && toPort instanceof WSPort) {
// Copy
copyDefaultConfiguration((WSPort) toPort);
}
} else if (edges.size() > 1) {
// Not the first edge.
DataType parameterType = getParameterType();
if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !parameterType.equals(toType)) {
throw new GraphException("Cannot connect ports with different types.");
}
} else {
// Should not happen.
throw new WorkflowRuntimeException("edges.size(): " + edges.size());
}
}
}
use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.
the class SystemNode method edgeWasAdded.
/**
* @throws GraphException
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.Edge)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
super.edgeWasAdded(edge);
GraphUtil.validateConnection(edge);
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (fromDataPort.getNode() == this) {
// setType() propagates the change to the whole workflow.
if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
fromDataPort.copyType(toDataPort);
}
} else if (toDataPort.getNode() == this) {
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
toDataPort.copyType(fromDataPort);
}
} else {
throw new WorkflowRuntimeException();
}
}
}
use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.
the class ComponentSelector method update.
/**
* Updates all the registry entries.
*
* @throws ComponentRegistryException
*/
public void update() throws ComponentRegistryException {
final List<ComponentRegistry> registries = new ArrayList<ComponentRegistry>();
if (SwingUtilities.isEventDispatchThread()) {
getRegistries(registries);
} else {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
getRegistries(registries);
}
});
} catch (InterruptedException e) {
// Should not happen.
throw new WorkflowRuntimeException(e);
} catch (InvocationTargetException e) {
// Should not happen.
throw new WorkflowRuntimeException(e);
}
}
final List<ComponentTreeNode> newSubTrees = new ArrayList<ComponentTreeNode>();
for (ComponentRegistry registry : registries) {
ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
newSubTrees.add(componentTree);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ComponentTreeNode root = ComponentSelector.this.treeModel.getRoot();
ComponentSelector.this.treeModel.removeChildren(root);
logger.debug("Removed all");
for (ComponentTreeNode subTree : newSubTrees) {
ComponentSelector.this.treeModel.addNodeInto(subTree, root);
}
makeVisible((ComponentTreeNode) root.getFirstChild());
}
});
}
use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.
the class SchemaCompilerUtil method compile.
public static void compile(String[] args) {
if (args.length == 0) {
return;
}
Set flags = new HashSet();
flags.add("h");
flags.add("help");
flags.add("usage");
flags.add("license");
flags.add("quiet");
flags.add("verbose");
flags.add("version");
flags.add("dl");
flags.add("noupa");
flags.add("nopvr");
flags.add("noann");
flags.add("novdoc");
flags.add("noext");
flags.add("srconly");
flags.add("debug");
Set opts = new HashSet();
opts.add("out");
opts.add("name");
opts.add("src");
opts.add("d");
opts.add("cp");
opts.add("compiler");
opts.add("javasource");
// deprecated
opts.add("jar");
opts.add("ms");
opts.add("mx");
opts.add("repackage");
opts.add("schemaCodePrinter");
opts.add("extension");
opts.add("extensionParms");
opts.add("allowmdef");
opts.add("catalog");
CommandLine cl = new CommandLine(args, flags, opts);
String[] badopts = cl.getBadOpts();
if (badopts.length > 0) {
for (int i = 0; i < badopts.length; i++) System.out.println("Unrecognized option: " + badopts[i]);
return;
}
boolean verbose = (cl.getOpt("verbose") != null);
boolean quiet = (cl.getOpt("quiet") != null);
if (verbose)
quiet = false;
String outputfilename = cl.getOpt("out");
String repackage = cl.getOpt("repackage");
cl.getOpt("schemaCodePrinter");
SchemaCodePrinter codePrinter = null;
String name = cl.getOpt("name");
boolean download = (cl.getOpt("dl") != null);
boolean noUpa = (cl.getOpt("noupa") != null);
boolean noPvr = (cl.getOpt("nopvr") != null);
boolean noAnn = (cl.getOpt("noann") != null);
boolean noVDoc = (cl.getOpt("novdoc") != null);
boolean noExt = (cl.getOpt("noext") != null);
boolean nojavac = (cl.getOpt("srconly") != null);
boolean debug = (cl.getOpt("debug") != null);
String allowmdef = cl.getOpt("allowmdef");
Set mdefNamespaces = (allowmdef == null ? Collections.EMPTY_SET : new HashSet(Arrays.asList(XmlListImpl.split_list(allowmdef))));
List extensions = new ArrayList();
String classesdir = cl.getOpt("d");
File classes = null;
if (classesdir != null)
classes = new File(classesdir);
String srcdir = cl.getOpt("src");
File src = null;
if (srcdir != null)
src = new File(srcdir);
if (nojavac && srcdir == null && classes != null)
src = classes;
// create temp directory
File tempdir = null;
if (src == null || classes == null) {
throw new WorkflowRuntimeException("Code gen src directory or classes directory is null");
}
File jarfile = null;
if (outputfilename == null && classes == null && !nojavac)
outputfilename = "xmltypes.jar";
if (outputfilename != null)
jarfile = new File(outputfilename);
if (src == null)
src = IOUtil.createDir(tempdir, "src");
if (classes == null)
classes = IOUtil.createDir(tempdir, "classes");
File[] classpath = null;
String cpString = cl.getOpt("cp");
if (cpString != null) {
String[] cpparts = cpString.split(File.pathSeparator);
List cpList = new ArrayList();
for (int i = 0; i < cpparts.length; i++) cpList.add(new File(cpparts[i]));
classpath = (File[]) cpList.toArray(new File[cpList.size()]);
} else {
classpath = CodeGenUtil.systemClasspath();
}
String javasource = cl.getOpt("javasource");
String compiler = cl.getOpt("compiler");
String jar = cl.getOpt("jar");
if (verbose && jar != null)
System.out.println("The 'jar' option is no longer supported.");
String memoryInitialSize = cl.getOpt("ms");
String memoryMaximumSize = cl.getOpt("mx");
File[] xsdFiles = cl.filesEndingWith(".xsd");
File[] wsdlFiles = cl.filesEndingWith(".wsdl");
File[] javaFiles = cl.filesEndingWith(".java");
File[] configFiles = cl.filesEndingWith(".xsdconfig");
URL[] urlFiles = cl.getURLs();
if (xsdFiles.length + wsdlFiles.length + urlFiles.length == 0) {
System.out.println("Could not find any xsd or wsdl files to process.");
return;
}
File baseDir = cl.getBaseDir();
URI baseURI = baseDir == null ? null : baseDir.toURI();
XmlErrorPrinter err = new XmlErrorPrinter(verbose, baseURI);
String catString = cl.getOpt("catalog");
Parameters params = new Parameters();
params.setBaseDir(baseDir);
params.setXsdFiles(xsdFiles);
params.setWsdlFiles(wsdlFiles);
params.setJavaFiles(javaFiles);
params.setConfigFiles(configFiles);
params.setUrlFiles(urlFiles);
params.setClasspath(classpath);
params.setOutputJar(jarfile);
params.setName(name);
params.setSrcDir(src);
params.setClassesDir(classes);
params.setCompiler(compiler);
params.setJavaSource(javasource);
params.setMemoryInitialSize(memoryInitialSize);
params.setMemoryMaximumSize(memoryMaximumSize);
params.setNojavac(nojavac);
params.setQuiet(quiet);
params.setVerbose(verbose);
params.setDownload(download);
params.setNoUpa(noUpa);
params.setNoPvr(noPvr);
params.setNoAnn(noAnn);
params.setNoVDoc(noVDoc);
params.setNoExt(noExt);
params.setDebug(debug);
params.setErrorListener(err);
params.setRepackage(repackage);
params.setExtensions(extensions);
params.setMdefNamespaces(mdefNamespaces);
params.setCatalogFile(catString);
params.setSchemaCodePrinter(codePrinter);
compile(params);
}
Aggregations