use of org.glassfish.hk2.classmodel.reflect.util.ResourceLocator in project Payara by payara.
the class ApplicationLifecycle method getDeployableParser.
public Parser getDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger) throws IOException {
try {
ResourceLocator locator = determineLocator();
// scan the jar and store the result in the deployment context.
ParsingContext.Builder parsingContextBuilder = new ParsingContext.Builder().logger(logger).executorService(executorService.getUnderlyingExecutorService()).config(new ParsingConfig() {
@Override
public Set<String> getAnnotationsOfInterest() {
return Collections.emptySet();
}
@Override
public Set<String> getTypesOfInterest() {
return Collections.emptySet();
}
@Override
public boolean modelUnAnnotatedMembers() {
return modelUnAnnotatedMembers;
}
});
// workaround bug in Builder
parsingContextBuilder.locator(locator);
ParsingContext parsingContext = parsingContextBuilder.build();
Parser parser = new Parser(parsingContext);
ReadableArchiveScannerAdapter scannerAdapter = new ReadableArchiveScannerAdapter(parser, source);
DeploymentSpan mainScanSpan = tracing.startSpan(DeploymentTracing.AppStage.CLASS_SCANNING, source.getName());
parser.parse(scannerAdapter, () -> mainScanSpan.close());
for (ReadableArchive externalLibArchive : getExternalLibraries(source, skipScanExternalLibProp)) {
ReadableArchiveScannerAdapter libAdapter = null;
try {
DeploymentSpan span = tracing.startSpan(DeploymentTracing.AppStage.CLASS_SCANNING, externalLibArchive.getName());
libAdapter = new ReadableArchiveScannerAdapter(parser, externalLibArchive);
parser.parse(libAdapter, () -> span.close());
} finally {
if (libAdapter != null) {
libAdapter.close();
}
}
}
parser.awaitTermination();
scannerAdapter.close();
return parser;
} catch (InterruptedException e) {
throw new IOException(e);
}
}
Aggregations