KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > client > unicast > PipeConnection


1 package com.ubermq.jms.client.unicast;
2
3 import java.io.*;
4
5 import com.ubermq.jms.client.*;
6 import com.ubermq.jms.client.impl.*;
7 import com.ubermq.jms.client.proc.*;
8 import com.ubermq.jms.common.datagram.*;
9 import com.ubermq.jms.common.datagram.impl.*;
10
11 /**
12  * Implements a pipe connection.
13  */

14 public class PipeConnection
15     extends Connection
16 {
17     /**
18      * Creates a direct pipe connection to a server that resides in
19      * process. It is necessary to know about the server object a priori.
20      * The default datagram factories are used.<p>
21      *
22      * @param s the pipe endpoint.
23      */

24     public PipeConnection(PipeEndpoint s)
25         throws IOException
26     {
27         // use the default holder, which uses the server's datagram factory,
28
// and the default client-side individual factories.
29
this(s,
30              DatagramFactory.getHolder(),
31              new NullDeliveryManager());
32     }
33
34     /**
35      * Creates a point-to-point topic connection to the specified
36      * host and port, using specified datagram factories and delivery manager.
37      * @param s the pipe endpoint.
38      * @param factory the datagram factory for wire handling
39      * @param ctlf the control factory for making control datagrams
40      * @param mdf the message factory for making messages
41      * @param manager the delivery manager to use
42      */

43     public PipeConnection(PipeEndpoint s,
44                           DatagramFactoryHolder holder,
45                           IDeliveryManager manager)
46         throws IOException
47     {
48         super(new PipeSession(holder.datagramFactory()),
49               new ClientProc(holder.controlFactory()),
50               manager,
51               holder,
52               new ObjectConnectionDescriptor(s));
53     }
54
55     static class ObjectConnectionDescriptor
56         implements ConnectionDescriptor
57     {
58         PipeEndpoint s;
59         public ObjectConnectionDescriptor(PipeEndpoint s)
60         {
61             this.s = s;
62         }
63         
64         public String JavaDoc toString()
65         {
66             return "PipeEndpoint: " + s.toString();
67         }
68     }
69
70
71 }
72
Popular Tags