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  package org.apache.geronimo.ews.ws4j2ee.toWs.ejb;
17  
18  import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
19  import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
20  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
21  import org.apache.geronimo.ews.ws4j2ee.toWs.JavaInterfaceWriter;
22  
23  /***
24   * This class can be used to write the appropriate EJB Home interface
25   * class for the given port type.
26   *
27   * @author Rajith Priyanga
28   * @author Srinath Perera
29   * @date Nov 26, 2003
30   */
31  public class EJBHomeWriter extends JavaInterfaceWriter {
32      private String name;
33      protected EJBContext ejbcontext;
34  
35      /***
36       * Constructs a EJBHomeWriter.
37       *
38       * @param portType The port type which contains the details.
39       * @throws GenerationFault
40       */
41      public EJBHomeWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
42          super(context, ejbcontext.getEjbhomeInterface());
43          this.ejbcontext = ejbcontext;
44      }
45  //TODO
46  //	/***
47  //	 * Returns the complete file name of the source code file which is
48  //	 * generated by the writer.
49  //	 */
50  //	public String getFileName() {
51  //		name = ejbcontext.getEjbhomeInterface();
52  //		String outdir = j2eewscontext.getMiscInfo().getOutPutPath();
53  //		if (!outdir.endsWith("/"))
54  //			outdir = outdir + "/";
55  //
56  //		return outdir + name.replace('.', '/') + ".java";
57  //	}
58  
59      protected void writeAttributes() throws GenerationFault {
60      }
61  
62      protected void writeMethods() throws GenerationFault {
63          out.write("\tpublic " + ejbcontext.getEjbRemoteInterface() + " create()throws java.rmi.RemoteException,javax.ejb.CreateException;\n");
64      }
65  
66      protected String getExtendsPart() {
67          return " extends javax.ejb.EJBHome";
68      }
69  
70  }