+ @Beta
+ public synchronized Collection<YangTextSchemaSource> getSourceTexts(final SourceIdentifier sourceIdentifier) {
+ return ImmutableSet.copyOf(texts.get(sourceIdentifier));
+ }
+
+ @Beta
+ public EffectiveModelContext trySchemaContext() throws SchemaResolutionException {
+ return trySchemaContext(StatementParserMode.DEFAULT_MODE);
+ }
+
+ @Beta
+ @SuppressWarnings("checkstyle:avoidHidingCauseException")
+ public EffectiveModelContext trySchemaContext(final StatementParserMode statementParserMode)
+ throws SchemaResolutionException {
+ final ListenableFuture<EffectiveModelContext> future = repository
+ .createEffectiveModelContextFactory(config(statementParserMode))
+ .createEffectiveModelContext(ImmutableSet.copyOf(requiredSources));
+
+ try {
+ return future.get();
+ } catch (final InterruptedException e) {
+ throw new IllegalStateException("Interrupted while waiting for SchemaContext assembly", e);
+ } catch (final ExecutionException e) {
+ final Throwable cause = e.getCause();
+ if (cause instanceof SchemaResolutionException) {
+ throw (SchemaResolutionException) cause;
+ }
+
+ throw new SchemaResolutionException("Failed to assemble SchemaContext", e);
+ }
+ }
+