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

« back to all changes in this revision

Viewing changes to src/main/org/jboss/remoting/samples/transporter/multiple/client/Client.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
package org.jboss.remoting.samples.transporter.multiple.client;
 
2
 
 
3
import org.jboss.remoting.samples.transporter.multiple.Account;
 
4
import org.jboss.remoting.samples.transporter.multiple.AccountProcessor;
 
5
import org.jboss.remoting.samples.transporter.multiple.Address;
 
6
import org.jboss.remoting.samples.transporter.multiple.Customer;
 
7
import org.jboss.remoting.samples.transporter.multiple.CustomerProcessor;
 
8
import org.jboss.remoting.transporter.TransporterClient;
 
9
 
 
10
 
 
11
/**
 
12
 * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
 
13
 */
 
14
public class Client
 
15
{
 
16
   private String locatorURI = "socket://localhost:5400";
 
17
 
 
18
   public void makeClientCall() throws Exception
 
19
   {
 
20
      Customer customer = createCustomer();
 
21
 
 
22
      CustomerProcessor customerProcessor = (CustomerProcessor) TransporterClient.createTransporterClient(locatorURI, CustomerProcessor.class);
 
23
 
 
24
      System.out.println("Customer to be processed: " + customer);
 
25
      Customer processedCustomer = customerProcessor.processCustomer(customer);
 
26
      System.out.println("Customer is now: " + processedCustomer);
 
27
 
 
28
      AccountProcessor accountProcessor = (AccountProcessor) TransporterClient.createTransporterClient(locatorURI, AccountProcessor.class);
 
29
 
 
30
      System.out.println("Asking for a new account to be created for customer.");
 
31
      Account account = accountProcessor.createAccount(processedCustomer);
 
32
      System.out.println("New account: " + account);
 
33
 
 
34
      TransporterClient.destroyTransporterClient(customerProcessor);
 
35
      TransporterClient.destroyTransporterClient(accountProcessor);
 
36
 
 
37
   }
 
38
 
 
39
   private Customer createCustomer()
 
40
   {
 
41
      Customer cust = new Customer();
 
42
      cust.setFirstName("Bob");
 
43
      cust.setLastName("Smith");
 
44
      Address addr = new Address();
 
45
      addr.setStreet("101 Oak Street");
 
46
      addr.setCity("Atlanta");
 
47
      addr.setState("GA");
 
48
      addr.setZip(30249);
 
49
      cust.setAddr(addr);
 
50
 
 
51
      return cust;
 
52
   }
 
53
 
 
54
   public static void main(String[] args)
 
55
   {
 
56
      org.jboss.remoting.samples.transporter.multiple.client.Client client = new org.jboss.remoting.samples.transporter.multiple.client.Client();
 
57
      try
 
58
      {
 
59
         client.makeClientCall();
 
60
      }
 
61
      catch (Exception e)
 
62
      {
 
63
         e.printStackTrace();
 
64
      }
 
65
   }
 
66
 
 
67
 
 
68
}