public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) { Map entries = processArchive.getEntries(); if (!entries.isEmpty()) { // get or create file definition FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (fileDefinition == null) { fileDefinition = new FileDefinition(); processDefinition.addDefinition(fileDefinition); } // add file entries to definition for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); fileDefinition.addFile((String) entry.getKey(), (byte[]) entry.getValue()); } } return processDefinition; }
public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) { Map entries = processArchive.getEntries(); if (!entries.isEmpty()) { // get or create file definition FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (fileDefinition == null) { fileDefinition = new FileDefinition(); processDefinition.addDefinition(fileDefinition); } // add file entries to definition for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); fileDefinition.addFile((String) entry.getKey(), (byte[]) entry.getValue()); } } return processDefinition; }
protected URL findResource(String name) { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) return null; // skip leading slashes int off = 0; for (int len = name.length(); off < len && name.charAt(off) == '/'; off++) /* just increase offset */; // if the resource name is absolute, that is, starts with one or more slashes if (off > 0) { // then search from the root of the process archive name = name.substring(off); } else { // otherwise, if the resource is relative, search from the classes directory name = "classes/" + name; } if (!fileDefinition.hasFile(name)) return null; try { return new URL("jbpm", null, -1, name, urlStreamHandler); } catch (MalformedURLException e) { throw new JbpmException("could not create url", e); } }
protected URL findResource(String name) { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) return null; // skip leading slashes int off = 0; for (int len = name.length(); off < len && name.charAt(off) == '/'; off++) /* just increase offset */; // if the resource name is absolute, that is, starts with one or more slashes if (off > 0) { // then search from the root of the process archive name = name.substring(off); } else { // otherwise, if the resource is relative, search from the classes directory name = "classes/" + name; } if (!fileDefinition.hasFile(name)) return null; try { return new URL("jbpm", null, -1, name, urlStreamHandler); } catch (MalformedURLException e) { throw new JbpmException("could not create url", e); } }
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 Class findClass(String className) throws ClassNotFoundException { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) { throw new ClassNotFoundException(className); } // look in the classes directory of the file module definition String fileName = "classes/" + className.replace('.', '/') + ".class"; byte[] classBytes = fileDefinition.getBytes(fileName); if (classBytes == null) throw new ClassNotFoundException(className); // if the class is in a package int packageIndex = className.lastIndexOf('.'); if (packageIndex != -1) { // check whether this class loader (or any ancestor) defined the package already String packageName = className.substring(0, packageIndex); if (getPackage(packageName) == null) { // define the package prior to defining the class // see https://jira.jboss.org/jira/browse/JBPM-1404 definePackage(packageName, null, null, null, processDefinition.getName(), Integer.toString(processDefinition.getVersion()), null, null); } } return defineClass(className, classBytes, 0, classBytes.length); } }
protected Class findClass(String className) throws ClassNotFoundException { ProcessDefinition processDefinition = getProcessDefinition(); FileDefinition fileDefinition; if (processDefinition == null || (fileDefinition = processDefinition.getFileDefinition()) == null) { throw new ClassNotFoundException(className); } // look in the classes directory of the file module definition String fileName = "classes/" + className.replace('.', '/') + ".class"; byte[] classBytes = fileDefinition.getBytes(fileName); if (classBytes == null) throw new ClassNotFoundException(className); // if the class is in a package int packageIndex = className.lastIndexOf('.'); if (packageIndex != -1) { // check whether this class loader (or any ancestor) defined the package already String packageName = className.substring(0, packageIndex); if (getPackage(packageName) == null) { // define the package prior to defining the class // see https://jira.jboss.org/jira/browse/JBPM-1404 definePackage(packageName, null, null, null, processDefinition.getName(), Integer.toString(processDefinition.getVersion()), null, null); } } return defineClass(className, classBytes, 0, classBytes.length); } }
final FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (! fileDefinition.hasFile("gpd.xml")) { targetExpression.setValue(elContext, null);
final FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (! fileDefinition.hasFile("forms.xml")) { targetExpression.setValue(elContext, Collections.emptyMap());
if (!processDefinition.getFileDefinition().hasFile(file)) { try { response.sendError(404, "Process definition " + id + " does not contain file '" + file + "'"); bytes = processDefinition.getFileDefinition().getBytes(file); response.setContentLength(bytes.length); response.setContentType(contentType);
throw new TagException(tag, "Value for process attribute is null"); final FileDefinition fileDefinition = processDefinition.getFileDefinition(); if (fileDefinition == null) { throw new TagException(tag, "Process has a null fileDefinition property");