001package com.echothree.util.server.cdi; 002 003import javax.enterprise.event.Observes; 004import javax.enterprise.inject.spi.AfterBeanDiscovery; 005import javax.enterprise.inject.spi.Extension; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009public class CommandScopeExtension implements Extension { 010 011 private static final Logger log = LoggerFactory.getLogger(CommandScopeContext.class); 012 013 private static CommandScopeContext commandScopeContext; 014 015 void afterBeanDiscovery(@Observes AfterBeanDiscovery abd) { 016 log.debug("CommandScopeExtension.afterBeanDiscovery()"); 017 018 commandScopeContext = new CommandScopeContext(); 019 abd.addContext(commandScopeContext); 020 } 021 022 public static CommandScopeContext getCommandScopeContext() { 023 return commandScopeContext; 024 } 025 026}