KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > webadmin > ejbgen > EJBGenBean


1 /**
2  * Redistribution and use of this software and associated documentation
3  * ("Software"), with or without modification, are permitted provided
4  * that the following conditions are met:
5  *
6  * 1. Redistributions of source code must retain copyright
7  * statements and notices. Redistributions must also contain a
8  * copy of this document.
9  *
10  * 2. Redistributions in binary form must reproduce the
11  * above copyright notice, this list of conditions and the
12  * following disclaimer in the documentation and/or other
13  * materials provided with the distribution.
14  *
15  * 3. The name "OpenEJB" must not be used to endorse or promote
16  * products derived from this Software without prior written
17  * permission of The OpenEJB Group. For written permission,
18  * please contact dev@openejb.org.
19  *
20  * 4. Products derived from this Software may not be called "OpenEJB"
21  * nor may "OpenEJB" appear in their names without prior written
22  * permission of The OpenEJB Group. OpenEJB is a registered
23  * trademark of The OpenEJB Group.
24  *
25  * 5. Due credit should be given to the OpenEJB Project
26  * (http://www.openejb.org/).
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39  * OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
42  *
43  * $Id: EJBGenBean.java 2267 2005-12-01 23:36:48Z jcscoobyrs $
44  */

45 package org.openejb.webadmin.ejbgen;
46
47 import java.io.File JavaDoc;
48 import java.io.IOException JavaDoc;
49 import java.io.PrintWriter JavaDoc;
50 import java.util.StringTokenizer JavaDoc;
51
52 import org.openejb.util.FileUtils;
53 import org.openejb.util.HtmlUtilities;
54 import org.openejb.webadmin.HttpRequest;
55 import org.openejb.webadmin.HttpResponse;
56 import org.openejb.webadmin.WebAdminBean;
57
58 /** Page for user to input needed data to build EJB Skeleton.
59  * @author <a HREF="mailto:jcscoobyrs@developerkb.com">Jeremy Whitlock</a>
60  */

61 public class EJBGenBean extends WebAdminBean
62 {
63     private String JavaDoc psep = System.getProperty("file.separator"); //Operating System File Separator
64
private String JavaDoc oehp = System.getProperty("openejb.home"); //Path to OPENEJB_HOME
65
private String JavaDoc surl = "";
66     
67     /**
68      * Called after a new instance of EJBGenBean is created
69      */

70     public void ejbCreate()
71     {
72         // The section variable must match
73
// the deployment id name
74
section = "/EJBGenerator/CreateEJB";
75     }
76
77     /** called after all content is written to the browser
78      * @param request the http request
79      * @param response the http response
80      * @throws IOException if an exception is thrown
81      */

82     public void postProcess(HttpRequest request, HttpResponse response) throws IOException JavaDoc
83     {
84     }
85
86     /** called before any content is written to the browser
87      * @param request the http request
88      * @param response the http response
89      * @throws IOException if an exception is thrown
90      */

91     public void preProcess(HttpRequest request, HttpResponse response) throws IOException JavaDoc
92     {
93     }
94
95     /** writes the main body content to the broswer.
96      * This content is inside a <code>&lt;p&gt;</code> block.
97      * @param body the output to write to
98      * @exception IOException if an exception is thrown
99      */

100     public void writeBody(PrintWriter JavaDoc body) throws IOException JavaDoc
101     {
102         String JavaDoc ejbname = request.getFormParameter("ejbname");
103         String JavaDoc ejbdesc = request.getFormParameter("ejbdesc");
104         String JavaDoc ejbauth = request.getFormParameter("ejbauth");
105         String JavaDoc ejbpack = request.getFormParameter("ejbpack");
106         String JavaDoc ejbtype = request.getFormParameter("ejbtype");
107         String JavaDoc ejbsloc = request.getFormParameter("ejbsloc");
108         String JavaDoc generate = request.getFormParameter("generate");
109         String JavaDoc ejbstyp = request.getFormParameter("ejbstyp");
110         boolean error = false;
111         
112         //checks to see if the page has been submitted
113
if(generate != null)
114         {
115             if(checkSourceDir(ejbsloc))
116             {
117                 error = false;
118             }
119             else
120             {
121                 error = true;
122             }
123             
124             if(error)
125             {
126                 writeGUI(body,true);
127             }
128             else
129             {
130                 if(ejbstyp.equals("local"))
131                 {
132                     surl = ejbsloc + psep;
133                 }
134                 else
135                 {
136                     surl = "/BeanSources/";
137                 }
138                 
139                 if(ejbtype.equals("BMP"))
140                 {
141                     BMPBean newEJB = new BMPBean(ejbname,ejbdesc,ejbauth,ejbpack,ejbsloc,ejbstyp);
142                     showBeanFiles(body);
143                     System.out.println("EJB Generator has created " + ejbname + "!");
144                 }
145                 else if(ejbtype.equals("CMP"))
146                 {
147                     CMPBean newEJB = new CMPBean(ejbname,ejbdesc,ejbauth,ejbpack,ejbsloc,ejbstyp);
148                     showBeanFiles(body);
149                     System.out.println("EJB Generator has created " + ejbname + "!");
150                 }
151                 else if(ejbtype.equals("Stateful"))
152                 {
153                     StatefulBean newEJB = new StatefulBean(ejbname,ejbdesc,ejbauth,ejbpack,ejbsloc,ejbstyp);
154                     showBeanFiles(body);
155                     System.out.println("EJB Generator has created " + ejbname + "!");
156                 }
157                 else
158                 {
159                     StatelessBean newEJB = new StatelessBean(ejbname,ejbdesc,ejbauth,ejbpack,ejbsloc,ejbstyp);
160                     showBeanFiles(body);
161                     System.out.println("EJB Generator has created " + ejbname + "!");
162                 }
163                 
164                 if(ejbstyp.equals("remote"))
165                 {
166                     File JavaDoc nsdir = new File JavaDoc(oehp + psep + "beangen" + psep + "EJBGenerator" + psep + "BeanSources");
167                     
168                     if(!nsdir.exists())
169                     {
170                         nsdir.mkdirs();
171                     }
172                     
173                     File JavaDoc nzdir = new File JavaDoc(nsdir,ejbname);
174                     
175                     if(!nzdir.exists())
176                     {
177                         nzdir.mkdirs();
178                     }
179                     
180                     FileUtils.copyFile(new File JavaDoc(nzdir, ejbname + ".zip"),
181                     new File JavaDoc(ejbsloc + psep + ejbname + psep + ejbname + ".zip"));
182                 }
183             }
184         }
185         else
186         {
187             writeGUI(body,false);
188         }
189     }
190
191     /** Write the TITLE of the HTML document. This is the part
192      * that goes into the <code>&lt;head&gt;&lt;title&gt;
193      * &lt;/title&gt;&lt;/head&gt;</code> tags
194      *
195      * @param body the output to write to
196      * @exception IOException of an exception is thrown
197      *
198      */

199     public void writeHtmlTitle(PrintWriter JavaDoc body) throws IOException JavaDoc
200     {
201         body.print(HTML_TITLE);
202     }
203
204     /** Write the title of the page. This is displayed right
205      * above the main block of content.
206      *
207      * @param body the output to write to
208      * @exception IOException if an exception is thrown
209      */

210     public void writePageTitle(PrintWriter JavaDoc body) throws IOException JavaDoc
211     {
212         body.print("EJB Generator");
213     }
214
215     /** Write the sub items for this bean in the left navigation bar of
216      * the page. This should look somthing like the one below:
217      *
218      * <code>
219      * &lt;tr&gt;
220      * &lt;td valign="top" align="left"&gt;
221      * &lt;a HREF="system?show=deployments"&gt;&lt;span class="subMenuOff"&gt;
222      * &nbsp;&nbsp;&nbsp;Deployments
223      * &lt;/span&gt;
224      * &lt;/a&gt;&lt;/td&gt;
225      * &lt;/tr&gt;
226      * </code>
227      *
228      * Alternately, the bean can use the method formatSubMenuItem(..) which
229      * will create HTML like the one above
230      *
231      * @param body the output to write to
232      * @exception IOException if an exception is thrown
233      *
234      */

235     public void writeSubMenuItems(PrintWriter JavaDoc body) throws IOException JavaDoc
236     {
237     }
238     
239     /**This will verify that the file directory to save the source to
240      * actually exists. If it does, it will attempt to create the EJB
241      * skeleton. If not, it will redirect to information page with
242      * all information back in place and will prompt the user to enter
243      * a valid working directory.
244      *
245      * @param path String to the path of the source to verify
246      * it exists before trying to generate EJB Template
247      * @return Returns false if the source isn't valid
248      */

249     private boolean checkSourceDir(String JavaDoc path)
250     {
251         boolean goodDir = false;
252         File JavaDoc srcDir = new File JavaDoc(path);
253         
254         if(srcDir.exists() && srcDir.isDirectory() && srcDir.canWrite())
255         {
256             goodDir = true;
257         }
258         else
259         {
260             goodDir = false;
261         }
262         return goodDir;
263     }
264     
265     /**Writes HTML to the page for the EJB Information.
266      * This is the GUI for the user to input information
267      * about the EJB so the EJB Generator can build the
268      * appropriate template.
269      *
270      * @param body Recieves PrintWriter from writeBody() method
271      * @param error Recieves error from writeBody() method
272      */

273     private void writeGUI(PrintWriter JavaDoc body, boolean error)
274     {
275         String JavaDoc ejbname = request.getFormParameter("ejbname");
276         String JavaDoc ejbdesc = request.getFormParameter("ejbdesc");
277         String JavaDoc ejbauth = request.getFormParameter("ejbauth");
278         String JavaDoc ejbpack = request.getFormParameter("ejbpack");
279         String JavaDoc ejbtype = request.getFormParameter("ejbtype");
280         String JavaDoc ejbsloc = request.getFormParameter("ejbsloc");
281         String JavaDoc ejbstyp = request.getFormParameter("ejbstyp");
282         String JavaDoc generate = request.getFormParameter("generate");
283         String JavaDoc namehelp = "This is the name of your EJB. It will be appended to all of your source " +
284                           "files. For example, if your EJB Name was Foo, your Bean.java file would be " +
285                           "&QUOT;FooBean.java&QUOT;.";
286         String JavaDoc deschelp = "This has not been implemented yet but it will end up being in your JavaDoc " +
287                           "information describing your bean and the bean&#8217;s purpose.";
288         String JavaDoc authhelp = "This puts your name in the JavaDoc information.";
289         String JavaDoc packhelp = "This will build the proper package for your EJB. For example. If your package " +
290                           " was foo.bar, your .java files for your EJB would be put in the foo/bar/ directory.";
291         String JavaDoc typehelp = "This is to determine which EJB to build for you.";
292         String JavaDoc styphelp = "This is very important as it can keep you from reaching your source if not used " +
293                           "properly. If you are accessing the WebAdmin module from http://localhost:4203, you " +
294                           "should always select &QUOT;local&QUOT;. If the server you are accessing has been setup to " +
295                           "be accessed remotely the you should select remote.";
296         String JavaDoc slochelp = "This is where your actual files will be created. If you are accessing locally, your " +
297                           "directory structure is already setup and there is no need to download the " +
298                           "zip file. Just go to your EJB Save Location and you&#8217;ll see a folder with your EJB " +
299                           "Name. Inside of it will be your META-INF folder and the top level of your EJB&#8217;s " +
300                           "package.";
301             
302         if(ejbname == null)
303         {
304             ejbname = "";
305         }
306         if(ejbdesc == null)
307         {
308             ejbdesc = "";
309         }
310         if(ejbauth == null)
311         {
312             ejbauth = "";
313         }
314         if(ejbpack == null)
315         {
316             ejbpack = "";
317         }
318         if(ejbtype == null)
319         {
320             ejbtype = "";
321         }
322         if(ejbsloc == null)
323         {
324             ejbsloc = "";
325         }
326         if(ejbstyp == null)
327         {
328             ejbstyp = "";
329         }
330
331         body.println("Welcome to the EJB Generator! This tool will help trim development");
332         body.println("time by building the skeleton for your EJB. Fill out all ");
333         body.println("information and submit. For a brief explanation, click the column with the name of the field.");
334         body.println("<br>");
335         body.println("<br>");
336         body.println("<h2>General EJB Information</h2>");
337         body.println("<form action=\""+section+"\" method=\"post\" enctype=\"multipart/form-data\" onsubmit=\"return validate(this)\">");
338         body.println("<table width=\"100%\" border=\"1\">");
339         body.println("<tr bgcolor=\"#5A5CB8\">");
340         body.println("<td onclick=\"popupMsg(\'" + namehelp + "\')\"><font face=\"arial\" color=\"white\">EJB Name:&nbsp;&nbsp;&nbsp;</font></td><td>" +
341             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
342             HtmlUtilities.createTextFormField("ejbname",ejbname,40,0) + "</td>");
343         body.println("</tr>");
344         body.println("<tr bgcolor=\"#5A5CB8\">");
345         body.println("<td onclick=\"popupMsg(\'" + deschelp + "\')\"><font face=\"arial\" color=\"white\">EJB <br> Description:&nbsp;&nbsp;&nbsp;</font></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
346             + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
347             HtmlUtilities.createTextArea("ejbdesc",ejbdesc,3,30,"","","") + "</td>");
348         body.println("</tr>");
349         body.println("<tr bgcolor=\"#5A5CB8\">");
350         body.println("<td onclick=\"popupMsg(\'" + authhelp + "\')\"><font face=\"arial\" color=\"white\">Author:&nbsp;&nbsp;&nbsp;</font></td><td>" +
351             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
352             HtmlUtilities.createTextFormField("ejbauth",ejbauth,40,0) + "</td>");
353         body.println("</tr>");
354         body.println("<tr bgcolor=\"#5A5CB8\">");
355         body.println("<td onclick=\"popupMsg(\'" + packhelp + "\')\"><font face=\"arial\" color=\"white\">Package:&nbsp;&nbsp;&nbsp;</font></td><td>" +
356         "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
357         HtmlUtilities.createTextFormField("ejbpack",ejbpack,40,0) + "</td>");
358         body.println("</tr>");
359         body.println("<tr bgcolor=\"#5A5CB8\">");
360         body.println("<td onclick=\"popupMsg(\'" + typehelp + "\')\"><font face=\"arial\" color=\"white\">EJB Type:&nbsp;&nbsp;&nbsp;</font></td><td>" +
361             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
362             HtmlUtilities.createSelectFormField("ejbtype",""));
363         if(ejbtype.equals("BMP") || ejbtype.equals(""))
364         {
365             body.println(HtmlUtilities.createSelectOption("BMP","Entity (BMP)",true));
366             body.println(HtmlUtilities.createSelectOption("CMP","Entity (CMP)",false));
367             body.println(HtmlUtilities.createSelectOption("Stateful","Session (Stateful)",false));
368             body.println(HtmlUtilities.createSelectOption("Stateless","Session (Stateless)",false));
369         }
370         else if(ejbtype.equals("CMP"))
371         {
372             body.println(HtmlUtilities.createSelectOption("BMP","Entity (BMP)",false));
373             body.println(HtmlUtilities.createSelectOption("CMP","Entity (CMP)",true));
374             body.println(HtmlUtilities.createSelectOption("Stateful","Session (Stateful)",false));
375             body.println(HtmlUtilities.createSelectOption("Stateless","Session (Stateless)",false));
376         }
377         else if(ejbtype.equals("Stateful"))
378         {
379             body.println(HtmlUtilities.createSelectOption("BMP","Entity (BMP)",false));
380             body.println(HtmlUtilities.createSelectOption("CMP","Entity (CMP)",false));
381             body.println(HtmlUtilities.createSelectOption("Stateful","Session (Stateful)",true));
382             body.println(HtmlUtilities.createSelectOption("Stateless","Session (Stateless)",false));
383         }
384         else
385         {
386             body.println(HtmlUtilities.createSelectOption("BMP","Entity (BMP)",false));
387             body.println(HtmlUtilities.createSelectOption("CMP","Entity (CMP)",false));
388             body.println(HtmlUtilities.createSelectOption("Stateful","Session (Stateful)",false));
389             body.println(HtmlUtilities.createSelectOption("Stateless","Session (Stateless)",true));
390         }
391         //body.println(HtmlUtilities.createSelectOption("BMP","Entity (BMP)",true));
392
//body.println(HtmlUtilities.createSelectOption("CMP","Entity (CMP)",false));
393
//body.println(HtmlUtilities.createSelectOption("Stateful","Session (Stateful)",false));
394
//body.println(HtmlUtilities.createSelectOption("Stateless","Session (Stateless)",false));
395
body.println("</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
396         body.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
397         body.println("</td>");
398         body.println("</tr>");
399         body.println("<tr bgcolor=\"#5A5CB8\">");
400         body.println("<td onclick=\"popupMsg(\'" + styphelp + "\')\"><font face=\"arial\" color=\"white\">Access Type:</font></td>");
401         body.println("<td><center><font face=\"arial\" color=\"white\">");
402         body.println("Local&nbsp;&nbsp;&nbsp;" + HtmlUtilities.createInputFormField("radio","ejbstyp","local",0,0,"","","","",true,false,true) + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
403         body.println("Remote&nbsp;&nbsp;&nbsp;" + HtmlUtilities.createInputFormField("radio","ejbstyp","remote",0,0,"","","","",false,false,true));
404         body.println("</font></center></td>");
405         body.println("<tr bgcolor=\"#5A5CB8\">");
406         body.println("<td onclick=\"popupMsg(\'" + slochelp + "\')\"><font face=\"arial\" color=\"white\">Source<br>Location:&nbsp;&nbsp;&nbsp;</font></td><td>" +
407             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
408             HtmlUtilities.createTextFormField("ejbsloc",ejbsloc,40,0) + "</td>");
409         body.println("</tr>");
410         if(error)
411         {
412             body.println("<tr bgcolor=\"#5A5CB8\">");
413             body.println("<td colspan=\"2\"><font face=\"arial\" color=\"red\"><strong><center>Please enter a valid Source Location!</center></strong></font></td></tr>");
414         }
415         body.println("<tr bgcolor=\"#5A5CB8\">");
416         body.println("<td colspan=\"2\"><center>" + HtmlUtilities.createSubmitFormButton("generate","Generate") + "</center></td>");
417         body.println("</tr>");
418         body.println("</table>");
419         body.println("</form>");
420     }
421     
422     /**This method is used to get the path to where the EJB
423      * Template's source is stored locally on the computer.
424      *
425      * @return Returns the full path to the local directory
426      */

427     public String JavaDoc getBeanDir()
428     {
429         //String[] dirs = request.getFormParameter("ejbpack").split("\\.");
430
StringTokenizer JavaDoc dirs = new StringTokenizer JavaDoc(request.getFormParameter("ejbpack"),"\\.");
431         String JavaDoc beandir = request.getFormParameter("ejbsloc") + psep + request.getFormParameter("ejbname");
432         
433         //for(int i = 0; i < dirs.length; i++)
434
//{
435
// beandir = beandir + psep + dirs[i];
436
//}
437

438         while (dirs.hasMoreTokens())
439         {
440             beandir = beandir + psep + dirs.nextToken();
441         }
442
443         
444         //System.out.println(beandir);
445
return beandir;
446     }
447     
448     /**This method is used to get the proper URL to the
449      * files for local access only.
450      *
451      * @return Returns the proper URL appendage to be
452      * added to the URL for proper file access
453      */

454     public String JavaDoc getBeanURL()
455     {
456         //String[] dirs = request.getFormParameter("ejbpack").split("\\.");
457
StringTokenizer JavaDoc dirs = new StringTokenizer JavaDoc(request.getFormParameter("ejbpack"),"\\.");
458         String JavaDoc beanurl = request.getFormParameter("ejbname");
459         
460         //for(int i = 0; i < dirs.length; i++)
461
//{
462
// beanurl = beanurl + "/" + dirs[i];
463
//}
464

465         while (dirs.hasMoreTokens())
466         {
467             beanurl = beanurl + "/" + dirs.nextToken();
468         }
469
470         //System.out.println(beanurl);
471
return beanurl;
472     }
473     
474     /**This is the response after a good EJB Template generation
475      *
476      * @param body PrinterWriter is passed from the writeBody() method
477      */

478     public void showBeanFiles(PrintWriter JavaDoc body)
479     {
480         String JavaDoc beanstr = getBeanDir();
481         String JavaDoc beanurl = getBeanURL();
482         File JavaDoc beanDir = new File JavaDoc(beanstr);
483         File JavaDoc metaDir = new File JavaDoc(request.getFormParameter("ejbsloc") + psep + request.getFormParameter("ejbname") +
484         psep + "META-INF");
485         File JavaDoc[] beanFiles = beanDir.listFiles();
486         File JavaDoc[] metaFiles = metaDir.listFiles();
487
488         body.println("<h1>Your Bean Skeleton Has Been Created</h1><br>");
489         body.println("If you are accessing this tool remotely, where you ");
490         body.println("aren\'t accessing it from the server running this instance of OpenEJB, ");
491         body.println("the links are provided so you can copy and paste the source to your local ");
492         body.println("computer. Otherwise, your full directory structure for your EJB is in tact ");
493         body.println("and you can edit the sources with your favorite editor!<br><br>");
494         body.println("<table width=\"50%\" border=\"1\" align=\"center\">");
495         body.println("<tr bgcolor=\"#5A5CB8\">");
496         body.println("<td><center><font face=\"arial\" color=\"white\">Bean Files</font></center></td>");
497         body.println("</tr>");
498 // for(int i = 0; i < beanFiles.length; i++)
499
// {
500
// body.println("<tr bgcolor=\"#ffffff\">");
501
// body.println("<td><center><font face=\"arial\" color=\"white\">" +
502
// //"<a HREF=\"" + beanFiles[i].getPath() + "\">" + beanFiles[i].getName() +
503
// "<a HREF=\""+ surl + beanurl + "/" + beanFiles[i].getName() +
504
// "\">" + beanFiles[i].getName() +
505
//// body.println(HtmlUtilities.createAnchor(
506
//// "javascript:popUpHelp('" + surl + beanurl + "/" + beanFiles[i].getName() + "')",
507
//// beanFiles[i].getName(),
508
//// HtmlUtilities.ANCHOR_HREF_TYPE));
509
// "</a></font></center></td>");
510
// body.println("</font></center></td>");
511
// body.println("</tr>");
512
// }
513

514 // for(int i = 0; i < metaFiles.length; i++)
515
// {
516
// body.println("<tr bgcolor=\"#ffffff\">");
517
// body.println("<td><center><font face=\"arial\" color=\"white\"><center>" +
518
// "<a HREF=\""+ surl + request.getFormParameter("ejbname") + "/META-INF/" +
519
// metaFiles[i].getName() +
520
// "\">" + metaFiles[i].getName() +
521
//// body.println(HtmlUtilities.createAnchor(
522
//// "javascript:popUpHelp('" + surl + request.getFormParameter("ejbname") +
523
//// "/META-INF/" + metaFiles[i].getName() + "')",
524
//// metaFiles[i].getName(),
525
//// HtmlUtilities.ANCHOR_HREF_TYPE));
526
// "</a></center></font></center></td>");
527
// body.println("</tr>");
528
// }
529

530 // body.println(HtmlUtilities.createAnchor("javascript:popUpHelp('" + surl +
531
// request.getFormParameter("ejbname") + "/" +
532
// request.getFormParameter("ejbname") + ".zip')",request.getFormParameter("ejbname") + ".zip",
533
// HtmlUtilities.ANCHOR_HREF_TYPE));
534

535         body.println("<tr bgcolor=\"#ffffff\">");
536         
537         if(request.getFormParameter("ejbstyp").equals("remote"))
538         {
539             body.println("<td><center><font face=\"arial\" color=\"white\"><center>" +
540             "<a HREF=\"" + request.getURI().getFile() + surl + request.getFormParameter("ejbname") + "/" +
541             request.getFormParameter("ejbname") + ".zip" + "\">" +
542             request.getFormParameter("ejbname") + ".zip" + "</a></center></font></center></td>");
543         }
544         else
545         {
546             body.println("<td><center><font face=\"arial\" color=\"white\"><center>" +
547             "<a HREF=\"" + request.getFormParameter("ejbsloc") + "/" + request.getFormParameter("ejbname") +
548             "/" + request.getFormParameter("ejbname") + ".zip" + "\">" +
549             request.getFormParameter("ejbname") + ".zip" + "</a></center></font></center></td>");
550         }
551         
552         body.println("</tr>");
553         body.println("</table>");
554         body.println("<br>");
555         body.println("As you can see, there are all the source files needed for your skeleton.");
556         body.println(" To save time, a .zip file has been created also to give you the ability");
557         body.println(" to extract the files and the proper directory structure to fit your EJB ");
558         body.println("and it's packaging!");
559     }
560 }
561
Popular Tags