public InputStream getInputStream() throws IOException { connect(); /* * ideally, the connection would fetch the process definition and assign it to a class * field on connect(); however, that strategy "leaks" a detached process definition */ ProcessDefinition processDefinition = getProcessDefinition(); if (processDefinition == null) throw new IOException("no active jbpm context"); // having established a "connection", check whether the file exists String fileName = url.getPath(); FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (fileDefinition == null || !fileDefinition.hasFile(fileName)) { throw new FileNotFoundException(fileName); } // retrieve file content byte[] fileContent = fileDefinition.getBytes(fileName); return new ByteArrayInputStream(fileContent); } }
public InputStream getInputStream() throws IOException { connect(); /* * ideally, the connection would fetch the process definition and assign it to a class * field on connect(); however, that strategy "leaks" a detached process definition */ ProcessDefinition processDefinition = getProcessDefinition(); if (processDefinition == null) throw new IOException("no active jbpm context"); // having established a "connection", check whether the file exists String fileName = url.getPath(); FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (fileDefinition == null || !fileDefinition.hasFile(fileName)) { throw new FileNotFoundException(fileName); } // retrieve file content byte[] fileContent = fileDefinition.getBytes(fileName); return new ByteArrayInputStream(fileContent); } }
protected URLConnection openConnection(URL url) throws IOException { return new ProcessUrlConnection(url); } };
protected URLConnection openConnection(URL url) throws IOException { return new ProcessUrlConnection(url); } };