View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.geronimo.ews.ws4j2ee.wsutils;
18  
19  //
20  //import java.lang.reflect.InvocationTargetException;
21  //import java.lang.reflect.Method;
22  //
23  //import javax.ejb.EJBHome;
24  //
25  //import org.apache.axis.AxisFault;
26  //import org.openejb.ContainerIndex;
27  //import org.openejb.EJBContainer;
28  
29  /***
30   * @author hemapani@opensource.lk
31   */
32  public class GeronimoUtils {
33  //	public static Object invokeEJB(
34  //		String ejbName,
35  //		String methodName,
36  //		Class[] parmClasses,
37  //		Object[] parameters)throws AxisFault{
38  //            try {
39  //                ContainerIndex index = ContainerIndex.getInstance();
40  //                String str = "Hello\n";
41  //                int length = index.length();
42  //                System.out.println(length);
43  //                for(int i = 0;i<length;i++){
44  //                	EJBContainer contianer = index.getContainer(i);
45  //                	if(contianer!= null){
46  //                		String name = contianer.getEJBName();
47  //                		if(ejbName.equals(name)){
48  //                			EJBHome statelessHome = contianer.getEJBHome();
49  //                			Object stateless = statelessHome.getClass().getMethod("create", null).invoke(statelessHome, null);
50  //                			if(parmClasses!= null){
51  //								Object obj = stateless.getClass().getMethod(methodName,parmClasses).invoke(stateless, parameters);
52  //								return obj; 
53  //                			}else{
54  //								Method[] methods = stateless.getClass().getMethods();
55  //								for(int j = 0;i< methods.length;j++){
56  //									if(methods[j].getName().equals(methodName)){
57  //										return methods[j].invoke(stateless, parameters);
58  //									}
59  //								}
60  //								throw new NoSuchMethodException(methodName+" not found");
61  //                			}
62  //                		}					
63  //                	}
64  //                }
65  //				throw new AxisFault("Dependancy ejb "+ejbName+"not found ");
66  //            } catch (Exception e) {
67  //				throw AxisFault.makeFault(e);
68  //            } 
69  //	
70  //	}
71  }