final ModelNode resultNode = context.getResult();
if (context.isNormalServer()) {
context.addStep(new OperationStepHandler() {
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
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(MESSAGES.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(MESSAGES.failedToReadContextEntries("java:jboss")));
}
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(MESSAGES.failedToReadContextEntries("java:global")));
}
final ServiceController<?> extensionRegistryController = serviceRegistry.getService(JndiViewExtensionRegistry.SERVICE_NAME);
if(extensionRegistryController != null) {
final JndiViewExtensionRegistry extensionRegistry = JndiViewExtensionRegistry.class.cast(extensionRegistryController.getValue());
for (JndiViewExtension extension : extensionRegistry.getExtensions()) {
extension.execute(new JndiViewExtensionContext() {