Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: mobile/jndi/Context.java


1   /** Java class "Context.java" generated from Poseidon for UML.
2    *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
3    *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
4    */
5   package mobile.jndi;
6   
7   import mobile.jmsapi.*;
8   import mobile.protocol.*;
9   import mobile.Library;
10  import mobile.bearer.http.Protocol;
11  
12  /**
13   * <p>
14   * class representing java.naming.Context implementing only method lookup, however
15   * </p>
16   */
17  public class Context  implements Protocol{
18  
19    ///////////////////////////////////////
20    // operations
21  
22  
23    /**adds the message to the server logs - for debugging*/
24  
25    private void log(String msg){
26      System.out.println("JNDI Context " + msg);
27      }
28  
29  /**
30   * <p>
31   * Retrieve named object. All intermediate contexts and the target context
32   * (that named by all but terminal atomic component of the name) must already
33   * exist.
34   * </p><p>
35   *
36   * @param name is a name of a desired object
37   * </p><p>
38   * @return an object of a specified name
39   * </p>
40   */
41      public  Object lookup(String name)
42      {
43        Request req;
44        Reply   rep;
45        Object[]  dat;
46        Id_class retVal;
47  
48        req = new Request();
49        req.code = LOOKUP;
50        dat = new Object[1];
51        dat[0] = name;
52        req.setData(dat);
53  
54        try
55        {
56          log("przed processRequest");
57          rep = Library.getRequestManager().processRequest(req);
58          switch (rep.code)
59          {
60            case REP_QUEUE_CONNECTION_FACTORY:
61              retVal = new QueueConnectionFactory();
62              retVal.id = ( (Integer)(rep.getData()[0])).intValue();
63              return retVal;
64            case REP_TOPIC_CONNECTION_FACTORY:
65              retVal = new TopicConnectionFactory();
66              retVal.id = ( (Integer)(rep.getData()[0])).intValue();
67              return retVal;
68            case REP_QUEUE:
69              retVal = new Queue();
70              retVal.id = ( (Integer)(rep.getData()[0])).intValue();
71  //            retVal.setName(rep.getData()[1]);
72              return retVal;
73            case REP_TOPIC:
74              retVal = new Topic();
75              retVal.id = ( (Integer)(rep.getData()[0])).intValue();
76  //            retVal.setName(rep.getData()[1]);
77              return retVal;
78            default:
79              return null;
80          }
81  
82        }
83        catch (mobile.bearer.http.NoConnectionException e)
84        {
85          return null;
86        }
87      } // end lookup
88  
89  } // end Context
90  
91  
92  
93  
94