final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
final ModelNode contextsNode = resultNode.get("java: contexts");
final ServiceController<?> javaContextService = serviceRegistry.getService(ContextNames.JAVA_CONTEXT_SERVICE_NAME);
final NamingStore javaContextNamingStore = NamingStore.class.cast(javaContextService.getValue());
try {
addEntries(contextsNode.get("java:"), new NamingContext(javaContextNamingStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:")));
}
final ServiceController<?> jbossContextService = serviceRegistry.getService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME);
final NamingStore jbossContextNamingStore = NamingStore.class.cast(jbossContextService.getValue());
try {
addEntries(contextsNode.get("java:jboss"), new NamingContext(jbossContextNamingStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:jboss")));
}
final ServiceController<?> exportedContextService = serviceRegistry.getService(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME);
final NamingStore exportedContextNamingStore = NamingStore.class.cast(exportedContextService.getValue());
try {
addEntries(contextsNode.get("java:jboss/exported"), new NamingContext(exportedContextNamingStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:jboss/exported")));
}
final ServiceController<?> globalContextService = serviceRegistry.getService(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME);
final NamingStore globalContextNamingStore = NamingStore.class.cast(globalContextService.getValue());
try {
addEntries(contextsNode.get("java:global"), new NamingContext(globalContextNamingStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(NamingLogger.ROOT_LOGGER.failedToReadContextEntries("java:global")));
}