protected AbstractDeployable(ModuleType type,
URL moduleURL,
String rootDD) throws DDBeanCreateException {
this.type = type;
this.moduleURL = moduleURL;
rootCL = new URLClassLoader(new URL[] {moduleURL}, Thread.currentThread().getContextClassLoader());
UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {moduleURL});
root = new DDBeanRootImpl(this, resourceFinder.findResource(rootDD));
// @todo make this work with unpacked
entries = new ArrayList();
InputStream is = null;
try {
is = moduleURL.openStream();
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is));
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
entries.add(entry.getName());
}
} catch (IOException e) {
throw (DDBeanCreateException) new DDBeanCreateException("Unable to create list of entries").initCause(e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e1) {
// ignore
}
}
}
}
|