this.processDefinition = processDefinition;
}
public URL findResource(String name) {
URL url = null;
FileDefinition fileDefinition = processDefinition.getFileDefinition();
if (fileDefinition != null) {
// if the name of the resources starts with a /
if (name.startsWith("/")) {
// then we start searching from the root of the process archive
// we know that the leading slashes are removed in the names of the
// file definitions, therefore we skip the leading slashes
while (name.startsWith("/")) {
name = name.substring(1);
}
}
else {
// otherwise, (if the resource is relative), we look in the classes
// directory in the process archive
name = "classes/" + name;
}
byte[] bytes = null;
if (fileDefinition.hasFile(name)) {
bytes = fileDefinition.getBytes(name);
}
if (bytes != null) {
try {
url = new URL(null, "processresource://"
+ processDefinition.getName()