return types;
} else {
try {
// scan the jar and store the result in the deployment context.
ParsingContext parsingContext = new ParsingContext.Builder().logger(context.getLogger()).executorService(executorService).build();
Parser parser = new Parser(parsingContext);
ReadableArchiveScannerAdapter scannerAdapter = new ReadableArchiveScannerAdapter(parser, context.getSource());
parser.parse(scannerAdapter, null);
for (ReadableArchive externalLibArchive :
getExternalLibraries(context)) {
ReadableArchiveScannerAdapter libAdapter = null;
try {
libAdapter = new ReadableArchiveScannerAdapter(parser, externalLibArchive);
parser.parse(libAdapter, null);
} finally {
if (libAdapter!=null) {
libAdapter.close();
}
}
}
parser.awaitTermination();
scannerAdapter.close();
context.addTransientAppMetaData(Types.class.getName(), parsingContext.getTypes());
context.addTransientAppMetaData(Parser.class.getName(), parser);
return parsingContext.getTypes();
} catch(InterruptedException e) {
throw new IOException(e);
}
}
}