/** * Return the main implementation bean for a proxy. * @param source configuration interface proxy * @return the implementation bean */ public static ConfigView getImpl(ConfigBeanProxy source) { Object bean = Proxy.getInvocationHandler(source); if (bean instanceof ConfigView) { return ((ConfigView) bean).getMasterView(); } else { return (ConfigBean) bean; } }
public WriteableView(ConfigBeanProxy readView) { this.bean = (ConfigBean) ((ConfigView) Proxy.getInvocationHandler(readView)).getMasterView(); this.defaultView = bean.createProxy(); changedAttributes = new HashMap<String, PropertyChangeEvent>(); changedCollections = new HashMap<String, ProtectedList>(); }
/** * Unwraps the proxy and returns the underlying {@link Dom} object. * * @return * null if the given instance is not actually a proxy to a DOM. */ public static Dom unwrap(ConfigBeanProxy proxy) { ConfigBeanProxy configBeanProxy = ConfigSupport.revealProxy(proxy); InvocationHandler ih = Proxy.getInvocationHandler(configBeanProxy); if (ih instanceof Dom) return (Dom) ih; if (ih instanceof ConfigView) { return (Dom) ((ConfigView)ih).getMasterView(); } return null; }
ConfigView handler = ((ConfigView) Proxy.getInvocationHandler(object)).getMasterView(); for (int index = 0 ; index<proxied.size() && !removed; index++) { Object target = proxied.get(index); try { ConfigView targetHandler = ((ConfigView) Proxy.getInvocationHandler(target)).getMasterView(); if (targetHandler==handler) { removed = (proxied.remove(index)!=null);
@SuppressWarnings("unchecked") public <T extends ConfigBeanProxy> T transform(T source) { final ConfigView handler = (ConfigView) Proxy.getInvocationHandler(source); return (T) handler.getMasterView().getProxy(handler.getMasterView().getProxyType()); } };
/** * Returns a writeable view of a configuration object * @param source the configured interface implementation * @return the new interface implementation providing write access * @throws TransactionFailure if the object cannot be enrolled (probably already enrolled in * another transaction). */ public <T extends ConfigBeanProxy> T getWriteableView(final T source) throws TransactionFailure { T configBeanProxy = revealProxy(source); ConfigView sourceBean = (ConfigView) Proxy.getInvocationHandler(configBeanProxy); WriteableView writeableView = getWriteableView(configBeanProxy, (ConfigBean) sourceBean.getMasterView()); return (T) writeableView.getProxy(sourceBean.getProxyType()); }
if (job.mEvents != null) { for (PropertyChangeEvent event : job.mEvents) { final Dom dom = (Dom) ((ConfigView) Proxy.getInvocationHandler(event.getSource())).getMasterView(); configListeners.addAll(dom.getListeners());
/** * Enroll a configuration object in a transaction and returns a writeable view of it * * @param source the configured interface implementation * @return the new interface implementation providing write access * @throws TransactionFailure if the object cannot be enrolled (probably already enrolled in * another transaction). */ public <T extends ConfigBeanProxy> T enroll(final T source) throws TransactionFailure { T configBeanProxy = ConfigSupport.revealProxy(source); ConfigView sourceBean = (ConfigView) Proxy.getInvocationHandler(configBeanProxy); WriteableView writeableView = ConfigSupport.getWriteableView(configBeanProxy, (ConfigBean) sourceBean.getMasterView()); if (!writeableView.join(this)) { throw new TransactionFailure("Cannot join transaction : " + sourceBean.getProxyType()); } return (T) writeableView.getProxy(sourceBean.getProxyType()); }
ConfigView bean = (ConfigView) Proxy.getInvocationHandler((ConfigBeanProxy) newValue); newValue = bean.getMasterView();
boolean removeNestedElements(Object object) { InvocationHandler h = Proxy.getInvocationHandler(object); if (!(h instanceof WriteableView)) { // h instanceof ConfigView ConfigBean bean = (ConfigBean) ((ConfigView) h).getMasterView(); h = bean.getWriteableView(); if (h == null) {
+ 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());
/** * Return the main implementation bean for a proxy. * @param source configuration interface proxy * @return the implementation bean */ public static ConfigView getImpl(ConfigBeanProxy source) { Object bean = Proxy.getInvocationHandler(source); if (bean instanceof ConfigView) { return ((ConfigView) bean).getMasterView(); } else { return (ConfigBean) bean; } }
@SuppressWarnings("unchecked") public <T extends ConfigBeanProxy> T transform(T source) { final ConfigView handler = (ConfigView) Proxy.getInvocationHandler(source); return (T) handler.getMasterView().getProxy(handler.getMasterView().getProxyType()); } };
@SuppressWarnings("unchecked") public <T extends ConfigBeanProxy> T transform(T source) { final ConfigView handler = (ConfigView) Proxy.getInvocationHandler(source); return (T) handler.getMasterView().getProxy(handler.getMasterView().getProxyType()); } };
public WriteableView(ConfigBeanProxy readView) { this.bean = (ConfigBean) ((ConfigView) Proxy.getInvocationHandler(readView)).getMasterView(); this.defaultView = bean.createProxy(); changedAttributes = new HashMap<String, PropertyChangeEvent>(); changedCollections = new HashMap<String, ProtectedList>(); }
public static Map<String, String> getLoggingProperties(Config c) { ConfigBean cb = (ConfigBean) ((ConfigView) Proxy.getInvocationHandler(c)).getMasterView(); ServerEnvironmentImpl env = cb.getHabitat().getService(ServerEnvironmentImpl.class); LoggingConfigImpl loggingConfig = new LoggingConfigImpl(); loggingConfig.setupConfigDir(env.getConfigDirPath(), env.getLibPath()); Map<String, String> map = new HashMap<String, String>(); try { map = loggingConfig.getLoggingProperties(); } catch (IOException ex) { } return map; }
public static Map<String, String> updateLoggingProperties(Config c, Map<String, String> properties) { ConfigBean cb = (ConfigBean) ((ConfigView) Proxy.getInvocationHandler(c)).getMasterView(); ServerEnvironmentImpl env = cb.getHabitat().getService(ServerEnvironmentImpl.class); LoggingConfigImpl loggingConfig = new LoggingConfigImpl(); loggingConfig.setupConfigDir(env.getConfigDirPath(), env.getLibPath()); Map<String, String> map = new HashMap<String, String>(); try { map = loggingConfig.updateLoggingProperties(properties); } catch (IOException ex) { } return map; }
public static Map<String, String>getLoggingProperties(Config c) { ConfigBean cb = (ConfigBean) ((ConfigView)Proxy.getInvocationHandler(c)).getMasterView(); ServerEnvironmentImpl env = cb.getHabitat().getComponent(ServerEnvironmentImpl.class); LoggingConfigImpl loggingConfig = new LoggingConfigImpl(); loggingConfig.setupConfigDir(env.getConfigDirPath(), env.getLibPath()); Map <String, String> map = new HashMap<String, String>() ; try { map = loggingConfig.getLoggingProperties(); } catch (IOException ex){ } return map; }
public static Map<String, String>updateLoggingProperties(Config c, Map<String, String>properties){ ConfigBean cb = (ConfigBean) ((ConfigView)Proxy.getInvocationHandler(c)).getMasterView(); ServerEnvironmentImpl env = cb.getHabitat().getComponent(ServerEnvironmentImpl.class); LoggingConfigImpl loggingConfig = new LoggingConfigImpl(); loggingConfig.setupConfigDir(env.getConfigDirPath(), env.getLibPath()); Map <String, String> map = new HashMap<String, String>() ; try { map = loggingConfig.updateLoggingProperties(properties); } catch (IOException ex){ } return map; }
public static String setLoggingProperty(Config c, String property, String value){ ConfigBean cb = (ConfigBean) ((ConfigView)Proxy.getInvocationHandler(c)).getMasterView(); ServerEnvironmentImpl env = cb.getHabitat().getComponent(ServerEnvironmentImpl.class); LoggingConfigImpl loggingConfig = new LoggingConfigImpl(); loggingConfig.setupConfigDir(env.getConfigDirPath(), env.getLibPath()); String prop = null; try{ prop= loggingConfig.setLoggingProperty(property, value); } catch (IOException ex){ } return prop; }