KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > ejb > session > AbstractStatelessContext


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.ejb.session;
30
31 import com.caucho.ejb.AbstractContext;
32 import com.caucho.ejb.AbstractServer;
33
34 import javax.ejb.EJBObject JavaDoc;
35 import javax.ejb.Handle JavaDoc;
36 import javax.ejb.SessionContext JavaDoc;
37
38 import javax.xml.rpc.handler.MessageContext JavaDoc;
39
40 /**
41  * Abstract base class for an session context
42  */

43 abstract public class AbstractStatelessContext extends AbstractContext
44   implements SessionContext JavaDoc
45 {
46   protected final StatelessServer _server;
47   
48   private EJBObject JavaDoc _remote;
49
50   protected AbstractStatelessContext(StatelessServer server)
51   {
52     _server = server;
53   }
54   
55   /**
56    * Returns the owning server.
57    */

58   public AbstractServer getServer()
59   {
60     return _server;
61   }
62
63   /**
64    * Returns the owning server.
65    */

66   public StatelessServer getStatelessServer()
67   {
68     return _server;
69   }
70
71   /**
72    * Returns the object's handle.
73    */

74   public Handle JavaDoc getHandle()
75   {
76     return getStatelessServer().createHandle(this);
77   }
78
79   /**
80    * For session beans, returns the object. For the home, return an
81    * illegal state exception.
82    */

83   /*
84   public EJBObject getEJBObject()
85     throws IllegalStateException
86   {
87     if (_remote == null)
88       _remote = getStatelessServer().createEJBObject(getPrimaryKey());
89     
90     return _remote;
91   }
92   */

93
94   public Object JavaDoc getPrimaryKey()
95   {
96     return "::ejb:stateless";
97   }
98   
99   public <T> T getBusinessObject(Class JavaDoc<T> businessInterface)
100   {
101     throw new UnsupportedOperationException JavaDoc();
102   }
103   
104   public Class JavaDoc getInvokedBusinessInterface()
105   {
106     throw new UnsupportedOperationException JavaDoc();
107   }
108   
109   public MessageContext JavaDoc getMessageContext()
110   {
111     throw new UnsupportedOperationException JavaDoc();
112   }
113 }
114
Popular Tags