KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > ejb > protocol > EjbIiopRemoteService


1 /*
2  * Copyright (c) 1998-2000 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  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.ejb.protocol;
31
32 import com.caucho.ejb.AbstractServer;
33 import com.caucho.iiop.IiopRemoteService;
34 import com.caucho.util.Log;
35
36 import java.util.logging.Level JavaDoc;
37 import java.util.logging.Logger JavaDoc;
38
39 public class EjbIiopRemoteService extends IiopRemoteService {
40   private static final Logger JavaDoc log = Log.open(EjbIiopRemoteService.class);
41   
42   private AbstractServer _server;
43
44   public EjbIiopRemoteService(AbstractServer server)
45   {
46     _server = server;
47   }
48   
49   /**
50    * Returns the context class loader.
51    */

52   public ClassLoader JavaDoc getClassLoader()
53   {
54     return _server.getClassLoader();
55   }
56   
57   /**
58    * Returns the home API class.
59    */

60   public Class JavaDoc getHomeAPI()
61   {
62     if (_server.getRemoteHomeClass() != null)
63       return _server.getRemoteHomeClass();
64     else
65       return _server.getRemoteObjectClass();
66   }
67
68   /**
69    * Returns the object API class.
70    */

71   public Class JavaDoc getObjectAPI()
72   {
73     return _server.getRemoteObjectClass();
74   }
75   
76   /**
77    * Returns the home object.
78    */

79   public Object JavaDoc getHome()
80   {
81     Object JavaDoc obj = _server.getHomeObject();
82
83     if (obj != null)
84       return obj;
85     else
86       return _server.getRemoteObject();
87   }
88
89   /**
90    * Returns the object interface.
91    */

92   public Object JavaDoc getObject(String JavaDoc local)
93   {
94     try {
95       return _server.getEJBObject(local);
96     } catch (Exception JavaDoc e) {
97       log.log(Level.FINE, e.toString(), e);
98       
99       return null;
100     }
101   }
102 }
103
Popular Tags