View Javadoc

1   /***
2    * @(#)EJBProxyService.java
3    * 
4    * JFoxSOAF, Service-Oriented Application Framework
5    * 
6    * Copyright(c) JFoxSOAF Team
7    * 
8    * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
9    * you may not use this file except in compliance with the License. 
10   * You may obtain a copy of the License at  
11   * 
12   * http://www.gnu.org/copyleft/lesser.html
13   * 
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, 
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
17   * See the License for the specific language governing permissions and 
18   * limitations under the License. 
19   * 
20   * For more information, please visit:
21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22   * http://www.huihoo.org/jfox/jfoxsoaf
23   */
24  
25  package org.huihoo.jfox.soaf.services.ejb;
26  
27  import java.rmi.RemoteException;
28  
29  import javax.ejb.EJBException;
30  import javax.ejb.EJBHome;
31  import javax.ejb.EJBObject;
32  import javax.ejb.FinderException;
33  
34  /***
35   * <p>
36   * Invokes any EJB without knowing anything more than the EJB's JNDI lookup
37   * name.
38   * </p>
39   * 
40   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
41   * @version $Revision: 1.8 $ $Date: 2005/05/22 06:49:31 $
42   * @version Revision: 1.0
43   */
44  
45  public interface EJBProxyService {
46  
47      /***
48       * Retrieve remote EJB object.
49       * 
50       * @param jndiName
51       * @return Object
52       * @throws EJBException
53       */
54      Object getRemoteObject(String jndiName) throws EJBException;
55  
56      /***
57       * Retrieve local EJB object.
58       * 
59       * @param jndiName
60       * @return Object
61       * @throws EJBException
62       */
63      Object getLocalObject(String jndiName) throws EJBException;
64  
65      /***
66       * Utility method for attempting to find a specific entity bean given it's
67       * home interface and primary key.
68       * <p>
69       * Attempts to call the following methods in order:
70       * </p>
71       * 
72       * <pre>
73       * 
74       *    home.findByPrimaryKey(int id);
75       *    home.findByPrimaryKey(long id);
76       *    home.findByPrimaryKey(Integer id);
77       *    home.findByPrimaryKey(Long id);
78       *    home.findByPrimaryKey(String id);
79       *  
80       * </pre>
81       * 
82       * @param home Reference to entity home interface.
83       * @param id Value of primary key.
84       * @return Reference to <code>EJBObject</code> to be casted to desired
85       *         type.
86       * @exception java.rmi.RemoteException Rethrown if thrown by finder method.
87       * @exception javax.ejb.FinderException Rethrown if thrown by finder method.
88       */
89      EJBObject findEntity(EJBHome home, String id) throws RemoteException,
90              FinderException;
91  
92  }