/** * Returns the type of configuration object this config proxy represents. * @param element is the configuration object * @return the configuration interface class */ public static <T extends ConfigBeanProxy> Class<T> proxyType(T element) { ConfigView bean = getImpl(element); return bean.getProxyType(); }
@Override public void lifecycleEvent(InstanceLifecycleEvent lifecycleEvent) { if (!lifecycleEvent.getEventType().equals(InstanceLifecycleEventType.POST_PRODUCTION)) { return; } Map<Injectee, Object> injectees = lifecycleEvent.getKnownInjectees(); if (injectees == null) return; ConfigListener listener = (ConfigListener) lifecycleEvent.getLifecycleObject(); for (Object injectee : injectees.values()) { if (!(injectee instanceof ConfigBeanProxy)) continue; ConfigBeanProxy configBeanProxy = (ConfigBeanProxy) injectee; Object impl = ConfigSupport.getImpl(configBeanProxy); if (!(impl instanceof ObservableBean)) continue; ObservableBean ob = (ObservableBean) impl; ob.addListener(listener); } }
public void testGetImplAndAddListener() { SimpleConnector sc = habitat.getService(SimpleConnector.class); final EjbContainerAvailability ejb = sc.getEjbContainerAvailability(); ObservableBean obean = (ObservableBean) ConfigSupport.getImpl(ejb); EjbObservableBean ejbBean = new EjbObservableBean(); + ConfigSupport.getImpl(ejb).getClass().getName()); System.out.println("getImpl(ejb).getMasterView() == > " + ConfigSupport.getImpl(ejb).getMasterView().getClass().getName()); System.out.println("getImpl(ejb).getProxyType() == > " + ConfigSupport.getImpl(ejb).getProxyType().getClass().getName()); } catch (Exception e) { e.printStackTrace();
public void preDestroy() { if(monitoringLevel != null){ ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)monitoringLevel); bean.removeListener(this); } }
/** * Returns the type of configuration object this config proxy represents. * @param element is the configuration object * @return the configuration interface class */ public static <T extends ConfigBeanProxy> Class<T> proxyType(T element) { ConfigView bean = getImpl(element); return bean.getProxyType(); }
/** * Returns the type of configuration object this config proxy represents. * @param element is the configuration object * @return the configuration interface class */ public static <T extends ConfigBeanProxy> Class<T> proxyType(T element) { ConfigView bean = getImpl(element); return bean.getProxyType(); }
/** * Returns the type of configuration object this config proxy represents. * @param element is the configuration object * @return the configuration interface class */ public static <T extends ConfigBeanProxy> Class<T> proxyType(T element) { ConfigView bean = getImpl(element); return bean.getProxyType(); }
private void addChangeListener(ConfigBeanProxy bean) { if(bean != null) { ((ObservableBean) ConfigSupport.getImpl(bean)).addListener(configListener); } }
private void addListenerToResource(Resource instance) { ObservableBean bean = null; if(_logger.isLoggable(Level.FINEST)){ debug("adding listener : " + instance); } bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)instance); bean.addListener(this); }
private void addListenerToServices() { Services services = serviceUtil.getServices(); if (services != null) { ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(services); bean.addListener(this); } else { logger.log(Level.WARNING,"unable.to.register.listenersto.servicesconfig"); } }
private void removeListenerForResources() { ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(domain.getResources()); bean.removeListener(this); }
private void addListenerToResources() { Resources resources = domain.getResources(); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(resources); bean.addListener(this); }
private void addListenerToResources(){ Resources resources = domain.getResources(); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)resources); bean.addListener(this); }
private void removeListenerForResources(){ ObservableBean bean = (ObservableBean)ConfigSupport.getImpl((ConfigBeanProxy)domain.getResources()); bean.removeListener(this); } /**
/** * Remove listener from a generic resource (JDBC Connection Pool/Connector * Connection Pool/JDBC resource/Connector resource) * Used in the case of delete asadmin command * @param instance remove the resource from listening to resource events */ private void removeListenerFromResource(Resource instance) { ObservableBean bean = null; debug("removing listener : " + instance); bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)instance); bean.removeListener(this); }
private void addListenerToServer() { Servers servers = domain.getServers(); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy) servers); bean.addListener(this); }
private void removeListenerForServer() { Server server = domain.getServerNamed(environment.getInstanceName()); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(server); bean.removeListener(this); Config config = server.getConfig(); if (config != null) { ((ObservableBean)ConfigSupport.getImpl(config)).removeListener(this); } }
private void addListenerToServer() { Server server = domain.getServerNamed(environment.getInstanceName()); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(server); bean.addListener(this); Config config = server.getConfig(); if (config != null) { ((ObservableBean)ConfigSupport.getImpl(config)).addListener(this); } }
private void addListenerToServer() { Server server = domain.getServerNamed(environment.getInstanceName()); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)server); bean.addListener(this); }
private void removeListenerForServer() { Server server = domain.getServerNamed(environment.getInstanceName()); ObservableBean bean = (ObservableBean) ConfigSupport.getImpl((ConfigBeanProxy)server); bean.removeListener(this); }