/** * Checks if the client is connected to the BPEL engine. * * @return true if the client is connected to the BPEL engine; false otherwise. */ protected synchronized boolean isConnected() { throw new WorkflowRuntimeException("Critical Error: Called a unsupported API"); }
/** * @see org.apache.airavata.workflow.model.graph.Graph#getID() */ public String getID() { if (this.id == null) { this.id = this.name; // If its still null if (null == this.id) { throw new WorkflowRuntimeException("The workflow ID is null"); } } return this.id; }
public URI getNameSpace() { try { return new URI(WorkflowConstants.LEAD_NS); } catch (URISyntaxException e) { throw new WorkflowRuntimeException(e); } }
public static Object getObjectOfType(int index, Object obj) { switch (index) { case 0: return new Integer((String) obj); case 1: return obj; } throw new WorkflowRuntimeException("type Not Supported yet!!"); }
/** * Adds an Edge. * * @param edge * The edge to add */ protected void addEdge(EdgeImpl edge) { if (this.edges.contains(edge)) { throw new WorkflowRuntimeException("The edge is already addes"); } else { this.edges.add(edge); } }
/** * Removes an Edge. * * @param edge * The edge to remove. */ protected void removeEdge(Edge edge) { if (this.edges.contains(edge)) { this.edges.remove(edge); // this.node.edgeWasRemoved(edge); } else { throw new WorkflowRuntimeException("The edge doesn't exist."); } }
/** * @param query */ private String extractDataType(String query) { int index = query.indexOf(':'); if (index == -1) { throw new WorkflowRuntimeException("Invalid query no : delimeter found " + query); } String[] split = query.substring(index + 1).trim().split("/"); if (split.length == 0) { throw new WorkflowRuntimeException("Unknown Xpath " + query.substring(index)); } return split[split.length - 1]; }
private static URI creatEPR(URI dscURI, QName portTypeQName) { String encodedPortType; try { encodedPortType = URLEncoder.encode(portTypeQName.toString(), "UTF-8"); URI epr = dscURI.resolve("/" + encodedPortType); return epr; } catch (UnsupportedEncodingException e) { // Should not happen throw new WorkflowRuntimeException(e); } } }
/** * Moves the node at the index up. * * @param index */ public void up(int index) { if (index < 1 || index >= this.parameterNodes.size()) { throw new WorkflowRuntimeException("Illegal index: " + index); } swap(index - 1, index); }
/** * Moves the node at the index down. * * @param index */ public void down(int index) { if (index < 0 || index >= this.parameterNodes.size() - 1) { throw new WorkflowRuntimeException("Illegal index: " + index); } swap(index, index + 1); }
/** * Moves the node at the index up. * * @param index */ public void up(int index) { if (index < 1 || index >= this.parameterNodes.size()) { throw new WorkflowRuntimeException("Illegal index: " + index); } swap(index - 1, index); }
public DataPort getInputPort(String id) { for (DataPort port : this.inputPorts) { if (port.getID().equals(id)) { return port; } } throw new WorkflowRuntimeException("Port with id not found :" + id); }
private String getOperationName(String code) { String[] publicSplit = code.split("public"); String searchStr = this.functionStr.substring(this.functionStr.indexOf("("), this.functionStr.indexOf(")")); int index = -1; for (int i = 0; i < publicSplit.length; ++i) { if (publicSplit[i].indexOf(searchStr) != -1) { index = i; break; } } if (index == -1) { throw new WorkflowRuntimeException("Operation name not found"); } return publicSplit[index].substring(0, publicSplit[index].indexOf(searchStr)).trim().split(" ")[1]; }
public DataPort getOutputPort(String fromPortID) { for (DataPort port : this.outputPorts) { if (port.getID().equals(fromPortID)) { return port; } } throw new WorkflowRuntimeException("Port with id not found :" + fromPortID); }
/** * This is used for ODE * * @return The Template ID like id */ public URI getUniqueWorkflowName() { try { return new URI(WorkflowConstants.LEAD_NS + "/" + this.getName()); } catch (URISyntaxException e) { throw new WorkflowRuntimeException(e); } }
/** * Moves the node at the index down. * * @param index */ public void down(int index) { if (index < 0 || index >= this.parameterNodes.size() - 1) { throw new WorkflowRuntimeException("Illegal index: " + index); } swap(index, index + 1); }
private GpelVariable findVariable(GpelVariablesContainer variables, String variable) { Iterator<GpelVariable> iterator = variables.variables().iterator(); while (iterator.hasNext()) { GpelVariable gpelVariable = iterator.next(); if (variable.equals(gpelVariable.getName())) { return gpelVariable; } } throw new WorkflowRuntimeException("Unable to fine the variable :" + variable + " in the BPEL variables " + variables); }
/** * @see org.apache.airavata.workflow.model.graph.impl.PortImpl#getComponentPort() */ @Override public DynamicComponentPort getComponentPort() { if (this.componentPort == null) { ComponentPort port = super.getComponentPort(); if (port instanceof DynamicComponentPort) { this.componentPort = (DynamicComponentPort) port; } else { throw new WorkflowRuntimeException("UNEXPECTED ERROR: Unable to resolve Port"); } } return this.componentPort; }
private URL getBaseURL(Class klass) { String path = klass.getName().replace('.', '/').concat(".class"); // /d/e/f.class URL classURL = this.parent.getResource(path); String jarURLString; if ("jar".equals(classURL.getProtocol())) { // classURL = jar:file/a/b/c.jar!/d/e/f.class // or jar:http://example.org/a/b/c.jar!/d/e/f.class String file = classURL.getFile(); // file = file:/a/b/c.jar!d/e/f.class // or http://example.org/a/b/c.jar!d/e/f.class logger.debug("file: " + file); jarURLString = file.substring(0, file.lastIndexOf('!')); // jarURLString = file:/a/b/c.jar // or http://example.org/a/b/c.jar } else { // file:/a/b/c/d/e/f.class String file = classURL.getFile(); // /a/b/c/d/e/f.class int index = file.lastIndexOf(path); jarURLString = "file:" + file.substring(0, index); // /a/b/c/ } try { URL jarURL = new URL(jarURLString); return jarURL; } catch (MalformedURLException e) { throw new WorkflowRuntimeException(e); } }
/** * @see java.lang.Object#clone() */ @Override public Workflow clone() { XmlElement originalXML = toXML(); try { XmlElement newXML = XMLUtil.deepClone(originalXML); Workflow newWorkflow = new Workflow(newXML); return newWorkflow; } catch (GraphException e) { // This should not happen. throw new WorkflowRuntimeException(e); } catch (WorkflowException e) { // This should not happen. throw new WorkflowRuntimeException(e); } catch (UtilsException e) { // This should not happen. throw new WorkflowRuntimeException(e); } }