KickJava   Java API By Example, From Geeks To Geeks.

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


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.AbstractEJBHome;
33 import com.caucho.ejb.AbstractServer;
34 import com.caucho.ejb.protocol.HomeSkeletonWrapper;
35 import com.caucho.util.Log;
36
37 import javax.ejb.*;
38 import java.io.ObjectStreamException JavaDoc;
39 import java.io.Serializable JavaDoc;
40 import java.util.logging.Logger JavaDoc;
41
42 /**
43  * Abstract base class for a SessionHome.
44  */

45 abstract public class StatelessHome extends AbstractEJBHome
46   implements EJBHome, EJBLocalHome, Serializable JavaDoc
47 {
48   protected static final Logger JavaDoc log = Log.open(StatelessHome.class);
49
50   protected final StatelessServer _server;
51
52   protected StatelessHome(StatelessServer server)
53   {
54     _server = server;
55   }
56
57   /**
58    * Returns the owning context
59    */

60   abstract public AbstractContext getContext();
61
62   /**
63    * Returns the owning server.
64    */

65   public StatelessServer getServer()
66   {
67     return _server;
68   }
69
70   /**
71    * Returns the owning server.
72    */

73   public AbstractServer __caucho_getServer()
74   {
75     return _server;
76   }
77
78   /**
79    * Returns the EJB's meta data.
80    */

81   public EJBMetaData getEJBMetaData()
82   {
83     return getServer().getEJBMetaData();
84   }
85
86   /**
87    * Returns the home handle for the home bean.
88    */

89   public HomeHandle getHomeHandle()
90   {
91     return getServer().getHomeHandle();
92   }
93
94   /**
95    * Returns the handle for the home bean.
96    */

97   public Handle getHandle()
98   {
99     return getContext().getHandle();
100   }
101
102   /**
103    * Returns null, since primary key isn't available to the home.
104    */

105   public Object JavaDoc getPrimaryKey()
106   {
107     return null;
108   }
109
110   /**
111    * Returns null, since the ejb object isn't available to the home.
112    */

113   public EJBObject getEJBObject()
114   {
115     return null;
116   }
117
118   /**
119    * Remove the object specified by the handle.
120    */

121   public void remove(Handle handle)
122     throws RemoveException
123   {
124     getServer().remove(handle);
125   }
126   
127   /**
128    * Remove the object specified by the primary key.
129    */

130   public void remove(Object JavaDoc primaryKey)
131     throws RemoveException
132   {
133     getServer().remove(primaryKey);
134   }
135
136   /**
137    * Serialize the HomeSkeletonWrapper in place of this object.
138    *
139    * @return the matching skeleton wrapper.
140    */

141   public Object JavaDoc writeReplace() throws ObjectStreamException JavaDoc
142   {
143     return new HomeSkeletonWrapper(getHomeHandle());
144   }
145
146   protected SessionObject _caucho_getStatelessObject()
147   {
148     return null;
149   }
150 }
151
152
153
Popular Tags