Object value = webAppData.getAttribute("listenerClassNames");
if (value instanceof Collection && !((Collection) value).contains(CONTEXT_LISTENER_NAME)) {
((Collection<String>) value).add(CONTEXT_LISTENER_NAME);
} else {
//try to add listener to the web app xml
ListenerType listenerType = webApp.addNewListener();
FullyQualifiedClassType className = listenerType.addNewListenerClass();
className.setStringValue(CONTEXT_LISTENER_NAME);
}
AbstractName moduleName = moduleContext.getModuleName();
Map<NamingBuilder.Key, Object> buildingContext = new HashMap<NamingBuilder.Key, Object>();
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);