use of java.util.EventListener in project spring-boot by spring-projects.
the class ServletContextInitializerBeans method addServletContextInitializerBean.
private void addServletContextInitializerBean(String beanName, ServletContextInitializer initializer, ListableBeanFactory beanFactory) {
if (initializer instanceof ServletRegistrationBean) {
Servlet source = ((ServletRegistrationBean<?>) initializer).getServlet();
addServletContextInitializerBean(Servlet.class, beanName, initializer, beanFactory, source);
} else if (initializer instanceof FilterRegistrationBean) {
Filter source = ((FilterRegistrationBean<?>) initializer).getFilter();
addServletContextInitializerBean(Filter.class, beanName, initializer, beanFactory, source);
} else if (initializer instanceof DelegatingFilterProxyRegistrationBean) {
String source = ((DelegatingFilterProxyRegistrationBean) initializer).getTargetBeanName();
addServletContextInitializerBean(Filter.class, beanName, initializer, beanFactory, source);
} else if (initializer instanceof ServletListenerRegistrationBean) {
EventListener source = ((ServletListenerRegistrationBean<?>) initializer).getListener();
addServletContextInitializerBean(EventListener.class, beanName, initializer, beanFactory, source);
} else {
addServletContextInitializerBean(ServletContextInitializer.class, beanName, initializer, beanFactory, initializer);
}
}
use of java.util.EventListener in project spring-boot by spring-projects.
the class ServletContextInitializerBeans method addAdaptableBeans.
@SuppressWarnings("unchecked")
protected void addAdaptableBeans(ListableBeanFactory beanFactory) {
MultipartConfigElement multipartConfig = getMultipartConfig(beanFactory);
addAsRegistrationBean(beanFactory, Servlet.class, new ServletRegistrationBeanAdapter(multipartConfig));
addAsRegistrationBean(beanFactory, Filter.class, new FilterRegistrationBeanAdapter());
for (Class<?> listenerType : ServletListenerRegistrationBean.getSupportedTypes()) {
addAsRegistrationBean(beanFactory, EventListener.class, (Class<EventListener>) listenerType, new ServletListenerRegistrationBeanAdapter());
}
}
use of java.util.EventListener in project hazelcast by hazelcast.
the class MapProxySupport method getListenerImplOrNull.
@SuppressWarnings("unchecked")
private <T extends EventListener> T getListenerImplOrNull(ListenerConfig listenerConfig) {
EventListener implementation = listenerConfig.getImplementation();
if (implementation != null) {
return (T) implementation;
}
String className = listenerConfig.getClassName();
if (className != null) {
try {
ClassLoader configClassLoader = getNodeEngine().getConfigClassLoader();
return ClassLoaderUtil.newInstance(configClassLoader, className);
} catch (Exception e) {
throw rethrow(e);
}
}
// returning null to preserve previous behavior
return null;
}
use of java.util.EventListener in project hazelcast by hazelcast.
the class MultiMapProxyImpl method initialize.
@Override
public void initialize() {
NodeEngine nodeEngine = getNodeEngine();
List<EntryListenerConfig> listenerConfigs = config.getEntryListenerConfigs();
for (EntryListenerConfig listenerConfig : listenerConfigs) {
EntryListener listener = null;
if (listenerConfig.getImplementation() != null) {
EventListener impl = listenerConfig.getImplementation();
listener = checkInstanceOf(EntryListener.class, impl, impl + " should be an instance of EntryListener");
} else if (listenerConfig.getClassName() != null) {
try {
listener = ClassLoaderUtil.newInstance(nodeEngine.getConfigClassLoader(), listenerConfig.getClassName());
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
if (listener != null) {
if (listener instanceof HazelcastInstanceAware) {
((HazelcastInstanceAware) listener).setHazelcastInstance(nodeEngine.getHazelcastInstance());
}
if (listenerConfig.isLocal()) {
addLocalEntryListener(listener);
} else {
addEntryListener(listener, listenerConfig.isIncludeValue());
}
}
}
}
use of java.util.EventListener in project cayenne by apache.
the class ProjectController method fireProcedureParameterEvent.
/**
* Informs all listeners of the ProcedureEvent. Does not send the event to
* its originator.
*/
public void fireProcedureParameterEvent(ProcedureParameterEvent e) {
setDirty(true);
EventListener[] list = listenerList.getListeners(ProcedureParameterListener.class);
for (EventListener eventListener : list) {
ProcedureParameterListener listener = (ProcedureParameterListener) eventListener;
switch(e.getId()) {
case MapEvent.ADD:
listener.procedureParameterAdded(e);
break;
case MapEvent.CHANGE:
listener.procedureParameterChanged(e);
break;
case MapEvent.REMOVE:
listener.procedureParameterRemoved(e);
break;
default:
throw new IllegalArgumentException("Invalid ProcedureParameterEvent type: " + e.getId());
}
}
}
Aggregations