List of usage examples for org.springframework.jndi.support SimpleJndiBeanFactory SimpleJndiBeanFactory
public SimpleJndiBeanFactory()
From source file:marshalsec.gadgets.SpringUtil.java
public static BeanFactory makeJNDITrigger(String jndiUrl) throws Exception { SimpleJndiBeanFactory bf = new SimpleJndiBeanFactory(); bf.setShareableResources(jndiUrl);/*from www .j a v a 2 s . c o m*/ Reflections.setFieldValue(bf, "logger", new NoOpLog()); Reflections.setFieldValue(bf.getJndiTemplate(), "logger", new NoOpLog()); return bf; }
From source file:marshalsec.Red5AMFBase.java
@Override @Args(minArgs = 1, args = { "jndiUrl" }, defaultArgs = { MarshallerBase.defaultJNDIUrl }) public Object makePropertyPathFactory(UtilFactory uf, String[] args) throws Exception { String jndiUrl = args[0];//from w ww.ja v a 2s.c o m PropertyInjectingProxy bfproxy = new PropertyInjectingProxy(new SimpleJndiBeanFactory(), Collections.singletonMap("shareableResources", new String[] { jndiUrl })); // RED5 uses a regular HashMap to temporarily store the property values // // To make sure the property setters are called in the right order we // have to make sure that they end up in bins matching that order Map<String, Object> values = new LinkedHashMap<>(); int size = 16; for (; size < Short.MAX_VALUE; size = size << 1) { long p = mapHash("propertyPath".hashCode() & 0xFFFFFFFFL) % size; long t = mapHash("targetBeanName".hashCode() & 0xFFFFFFFFL) % size; long b = mapHash("beanFactory".hashCode() & 0xFFFFFFFFL) % size; if (p <= b && t <= b) { System.err.println( String.format("propertyPath @ %d targetBeanName @ %d beanFactory @ %d with table size %d", p, t, b, size)); break; } } values.put("propertyPath", "a"); values.put("targetBeanName", jndiUrl); values.put("beanFactory", bfproxy); // this blows up the table to the desired size // keys must be distributed more or less evenly or the hash table won't expand to the desired size for (int j = 0; j < size / 2; j++) { values.put("" + j, ""); } return new PropertyInjectingProxy(new PropertyPathFactoryBean(), values); }
From source file:marshalsec.BlazeDSBase.java
@Override @Args(minArgs = 1, args = { "jndiUrl" }, defaultArgs = { MarshallerBase.defaultJNDIUrl }) public Object makePropertyPathFactory(UtilFactory uf, String[] args) throws Exception { String jndiUrl = args[0];//www . ja v a2 s . co m PropertyInjectingProxy bfproxy = new PropertyInjectingProxy(new SimpleJndiBeanFactory(), Collections.singletonMap("shareableResources", Arrays.asList(jndiUrl) // this would actually be an array, // but AMFX has some trouble with // non-readable array properties )); Map<String, Object> values = new LinkedHashMap<>(); values.put("targetBeanName", jndiUrl); values.put("propertyPath", "foo"); values.put("beanFactory", bfproxy); return new PropertyInjectingProxy(new PropertyPathFactoryBean(), values); }