List of usage examples for org.springframework.remoting.support RemoteInvocation getAttributes
@Nullable
public Map<String, Serializable> getAttributes()
From source file:org.apache.mina.springrpc.ReturnAddressAwareRemoteInvocation.java
public ReturnAddressAwareRemoteInvocation(ReturnAddress returnAddress, RemoteInvocation decorated) { setReturnAddress(returnAddress);//from ww w . ja va 2 s . c o m setArguments(decorated.getArguments()); setAttributes(decorated.getAttributes()); setMethodName(decorated.getMethodName()); setParameterTypes(decorated.getParameterTypes()); }
From source file:org.logicblaze.lingo.jms.JmsRemotingTest.java
public void testJmsProxyFactoryBeanAndServiceExporterWithCustomInvocationObject() throws Exception { TestBean target = new TestBean("myname", 99); final JmsServiceExporter exporter = new JmsServiceExporter(); exporter.setServiceInterface(ITestBean.class); exporter.setService(target);/*ww w . jav a2s .c om*/ exporter.setRemoteInvocationExecutor(new DefaultRemoteInvocationExecutor() { public Object invoke(RemoteInvocation invocation, Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { assertNull(invocation.getAttributes()); assertNull(invocation.getAttribute("myKey")); return super.invoke(invocation, targetObject); } }); configure(exporter); subscribeToQueue(exporter, getDestinationName()); JmsProxyFactoryBean pfb = new JmsProxyFactoryBean(); pfb.setServiceInterface(ITestBean.class); pfb.setServiceUrl("http://myurl"); pfb.setRequestor(createRequestor(getDestinationName())); pfb.setRemoteInvocationFactory(new LingoRemoteInvocationFactory(strategy) { public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { RemoteInvocation invocation = super.createRemoteInvocation(methodInvocation); assertNull(invocation.getAttributes()); assertNull(invocation.getAttribute("myKey")); return invocation; } }); configure(pfb); ITestBean proxy = (ITestBean) pfb.getObject(); assertEquals("myname", proxy.getName()); assertEquals(99, proxy.getAge()); }
From source file:org.logicblaze.lingo.jms.JmsRemotingTest.java
public void testJmsProxyFactoryBeanAndServiceExporterWithInvocationAttributes() throws Exception { TestBean target = new TestBean("myname", 99); final JmsServiceExporter exporter = new JmsServiceExporter(); exporter.setServiceInterface(ITestBean.class); exporter.setService(target);//from w w w .j a va 2 s .com exporter.setRemoteInvocationExecutor(new DefaultRemoteInvocationExecutor() { public Object invoke(RemoteInvocation invocation, Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { assertNotNull(invocation.getAttributes()); assertEquals(1, invocation.getAttributes().size()); assertEquals("myValue", invocation.getAttributes().get("myKey")); assertEquals("myValue", invocation.getAttribute("myKey")); return super.invoke(invocation, targetObject); } }); configure(exporter); subscribeToQueue(exporter, getDestinationName()); JmsProxyFactoryBean pfb = new JmsProxyFactoryBean(); pfb.setServiceInterface(ITestBean.class); pfb.setServiceUrl("http://myurl"); pfb.setRequestor(createRequestor(getDestinationName())); pfb.setRemoteInvocationFactory(new LingoRemoteInvocationFactory(strategy) { public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { RemoteInvocation invocation = super.createRemoteInvocation(methodInvocation); invocation.addAttribute("myKey", "myValue"); try { invocation.addAttribute("myKey", "myValue"); fail("Should have thrown IllegalStateException"); } catch (IllegalStateException ex) { // expected: already defined } assertNotNull(invocation.getAttributes()); assertEquals(1, invocation.getAttributes().size()); assertEquals("myValue", invocation.getAttributes().get("myKey")); assertEquals("myValue", invocation.getAttribute("myKey")); return invocation; } }); configure(pfb); ITestBean proxy = (ITestBean) pfb.getObject(); assertEquals("myname", proxy.getName()); assertEquals(99, proxy.getAge()); }