~ubuntu-branches/ubuntu/wily/libjboss-remoting-java/wily

« back to all changes in this revision

Viewing changes to tests/org/jboss/test/remoting/performance/spring/rmi/SpringRMIHandler.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************
2
 
 *                                     *
3
 
 *  JBoss: The OpenSource J2EE WebOS   *
4
 
 *                                     *
5
 
 *  Distributable under LGPL license.  *
6
 
 *  See terms of license at gnu.org.   *
7
 
 *                                     *
8
 
 ***************************************/
9
 
package org.jboss.test.remoting.performance.spring.rmi;
10
 
 
11
 
import org.jboss.remoting.callback.Callback;
12
 
import org.jboss.remoting.callback.HandleCallbackException;
13
 
import org.jboss.remoting.callback.InvokerCallbackHandler;
14
 
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
15
 
 
16
 
/**
17
 
 * @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
18
 
 */
19
 
public class SpringRMIHandler implements InvokerCallbackHandler
20
 
{
21
 
   private SpringRMICallbackServer springRMICallbackServer;
22
 
   private String sessionId;
23
 
   
24
 
   public SpringRMIHandler(String sessionId)
25
 
   {
26
 
      this.sessionId = sessionId;
27
 
   }
28
 
 
29
 
   public void start()
30
 
   {
31
 
//    Resource res = new ClassPathResource("SpringRMICallbackServerService.xml", SpringRMIHandler.class);
32
 
//    BeanFactory factory = new XmlBeanFactory(res);
33
 
//    springRMICallbackServer = (SpringRMICallbackServer)factory.getBean("springRMICallbackServerService:" );
34
 
 
35
 
    
36
 
/*
37
 
      Instead of creating callback server proxies by injection, the following xml declaration is
38
 
      replaced by programmatic creation.  Each callback server is registered under a name
39
 
      ending in the sessionId.
40
 
      
41
 
      <bean id="springRMICallbackServerService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
42
 
         <property name="serviceUrl" value="rmi://localhost:1299/SpringRMICallbackServerService"/>
43
 
         <property name="serviceInterface" value="org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer"/>
44
 
      </bean>
45
 
 */
46
 
      
47
 
      RmiProxyFactoryBean factory = new RmiProxyFactoryBean();
48
 
      factory.setServiceUrl("rmi://localhost:1299/SpringRMICallbackServerService:" + sessionId);
49
 
      factory.setServiceInterface(org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer.class);
50
 
      try
51
 
      {
52
 
         factory.afterPropertiesSet();
53
 
      }
54
 
      catch (Exception e)
55
 
      {
56
 
         System.out.println("unable to create callback proxy");
57
 
         System.out.println(e);
58
 
      }
59
 
      springRMICallbackServer = (SpringRMICallbackServer)factory.getObject();      
60
 
   }
61
 
 
62
 
   public SpringRMICallbackServer getSpringRMICallbackServer()
63
 
   {
64
 
      return springRMICallbackServer;
65
 
   }
66
 
 
67
 
   public void setSpringRMICallbackServer(SpringRMICallbackServer springRMICallbackServer)
68
 
   {
69
 
      this.springRMICallbackServer = springRMICallbackServer;
70
 
   }
71
 
 
72
 
   public void handleCallback(Callback callback) throws HandleCallbackException
73
 
   {
74
 
      System.out.println("Need to make call on SpringRMICallbackServer with results. " + callback);
75
 
 
76
 
      try
77
 
      {
78
 
         springRMICallbackServer.finishedProcessing(callback);
79
 
      }
80
 
      catch(Exception e)
81
 
      {
82
 
         e.printStackTrace();
83
 
         throw new HandleCallbackException(e.getMessage());
84
 
      }
85
 
   }
86
 
}
 
 
b'\\ No newline at end of file'