Skip to main content
summaryrefslogtreecommitdiffstats
blob: 83fe42bca9bc200cf4fb6d9c777ba66a765b5edf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.ws.internal.consumption.sampleapp.codegen;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.common.StringUtils;
import org.eclipse.jst.ws.internal.consumption.codegen.Generator;


/**
* Objects of this class represent a TestClientFilegenerator.
* */
public class TestClientFileGenerator extends Generator
{

  // Copyright
  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";


  public String fMethodName;
  public String fInputName;
  public String fResultName;
  
  /**
  * Constructor.
  *
  */
  public TestClientFileGenerator (String inputs, String methods, String results)
  {
     super();
     fInputName = inputs;
     fMethodName = methods;
     fResultName = results;
  }

  public void setFileNames(String inputs, String methods, String results)
  {
    fInputName = inputs;
    fMethodName = methods;
    fResultName = results;
  }

  //takes in a bean node
   public IStatus visit (Object object)
   {
      fbuffer.append("<%@page contentType=\"text/html;charset=UTF-8\"%>");
      fbuffer.append("<HTML>" + StringUtils.NEWLINE);
      fbuffer.append("<HEAD>" + StringUtils.NEWLINE);
      fbuffer.append("<TITLE>Web Services Test Client</TITLE>" + StringUtils.NEWLINE);
      fbuffer.append("</HEAD>" + StringUtils.NEWLINE + "");
      fbuffer.append("<FRAMESET  COLS=\"220,*\">" + StringUtils.NEWLINE);
      fbuffer.append("<FRAME SRC=\""+ fMethodName + "\" NAME=\"methods\" MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SCROLLING=\"yes\" FRAMEBORDER=\"1\">" + StringUtils.NEWLINE);
      fbuffer.append("<FRAMESET  ROWS=\"80%,20%\">" + StringUtils.NEWLINE);
      fbuffer.append("<FRAME SRC=\""+ fInputName  + "\" NAME=\"inputs\"  MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SCROLLING=\"yes\" FRAMEBORDER=\"1\">" + StringUtils.NEWLINE);
      fbuffer.append("<%").append(StringUtils.NEWLINE);
      fbuffer.append("StringBuffer resultJSP = new StringBuffer(\"").append(fResultName).append("\");").append(StringUtils.NEWLINE);
      fbuffer.append("resultJSP.append(\"?\");").append(StringUtils.NEWLINE);
      fbuffer.append("java.util.Enumeration resultEnum = request.getParameterNames();");
      fbuffer.append("while (resultEnum.hasMoreElements()) {").append(StringUtils.NEWLINE);
      fbuffer.append("Object resultObj = resultEnum.nextElement();").append(StringUtils.NEWLINE);
      fbuffer.append("resultJSP.append(resultObj.toString()).append(\"=\").append(request.getParameter(resultObj.toString())).append(\"&\");").append(StringUtils.NEWLINE);
      fbuffer.append("}").append(StringUtils.NEWLINE);
      fbuffer.append("%>").append(StringUtils.NEWLINE);
      fbuffer.append("<FRAME SRC=\"<%=resultJSP.toString()%>\" NAME=\"result\"  MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SCROLLING=\"yes\" FRAMEBORDER=\"1\">" + StringUtils.NEWLINE);
      fbuffer.append("</FRAMESET>" + StringUtils.NEWLINE);


      fbuffer.append("<NOFRAMES>" + StringUtils.NEWLINE);
      fbuffer.append("<BODY>" + StringUtils.NEWLINE);
      fbuffer.append("The Web Services Test Client requires a browser that supports frames." + StringUtils.NEWLINE);
      fbuffer.append("</BODY>" + StringUtils.NEWLINE);
      fbuffer.append("</NOFRAMES>" + StringUtils.NEWLINE);
      fbuffer.append("</FRAMESET>" + StringUtils.NEWLINE);
      fbuffer.append("</HTML>");

      return Status.OK_STATUS;
  }
}

Back to the top