diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen')
14 files changed, 0 insertions, 1623 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileAttributeGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileAttributeGenerator.java deleted file mode 100644 index e485e04f3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileAttributeGenerator.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * 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.consumption.codegen.bean.TypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElementType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; - - -/** -* Objects of this class represent a InputFileTypeGenerator. -* */ -public class InputFileAttributeGenerator extends InputFileTypeGenerator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private boolean fStateLess; - - /** - * Constructor. - * - */ - public InputFileAttributeGenerator (StringBuffer buffer, int currentLevel, int levelsDeep) - { - super(buffer,currentLevel,levelsDeep); - } - - - /* - * Takes in an object to be acted upon by this visitor action - * @param Object The object to be acted upon - */ - public IStatus visit (Object object) - { - - AttributeElementType attributeElementType = (AttributeElementType)object; - //if it is a bean is it stateless - attributeElementType.getTypeElement(); - - if(attributeElementType.getTypeElement().isBean()){ - BeanElement bean = (BeanElement)attributeElementType.getTypeElement(); - fStateLess = bean.isStateLess(); - } - - TypeVisitor typeVisitor = new TypeVisitor(); - InputFileTypeGenerator inputFileTypeGenerator = new InputFileTypeGenerator(fbuffer,fCurrentLevel,fLevelsDeep); - if(attributeElementType.getTypeElement().isBean() && !TypeFactory.recognizedBean(attributeElementType.getTypeElement().getName()) - && !(getReturnParam() && (TypeFactory.isRecognizedReturnType(attributeElementType.getTypeElement().getTypeName()) || fStateLess))) - - addParentGetter(attributeElementType.getGetterMethod(),attributeElementType.getTypeElement().getName()); - inputFileTypeGenerator.addParentGetter(returnParentGetter(),returnParentGetterType()); - inputFileTypeGenerator.setInstanceName(fInstanceName); - inputFileTypeGenerator.setReturnParam(getReturnParam()); - typeVisitor.run(attributeElementType,inputFileTypeGenerator); - fbuffer = inputFileTypeGenerator.getStringBuffer(); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileGenerator.java deleted file mode 100644 index 83719d761..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileGenerator.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * 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; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.MethodVisitor; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a MethodFilegenerator. -* */ -public class InputFileGenerator extends Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public String fResultName; - - /** - * Constructor. - * used directly - */ - public InputFileGenerator (String result) - { - super(); - fResultName = result; - } - - /** - * Constructor. - * called from subclasses - */ - public InputFileGenerator (StringBuffer buffer, String result) - { - super(buffer); - fResultName = result; - } - - /** - * Constructor. - * called from subclasses - */ - public InputFileGenerator (StringBuffer buffer) - { - super(buffer); - } - - public void setFileNames(String results) - { - fResultName = results; - } - - //takes in a bean node - public IStatus visit (Object object) - { - Element beanElement = (Element)object; - fbuffer.append("<%@page contentType=\"text/html;charset=UTF-8\"%>" + StringUtils.NEWLINE); - fbuffer.append("<HTML>" + StringUtils.NEWLINE); - fbuffer.append("<HEAD>" + StringUtils.NEWLINE); - fbuffer.append("<TITLE>Inputs</TITLE>" + StringUtils.NEWLINE); - fbuffer.append("</HEAD>" + StringUtils.NEWLINE); - fbuffer.append("<BODY>" + StringUtils.NEWLINE); - fbuffer.append("<H1>Inputs</H1>" + StringUtils.NEWLINE + "" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE + "String method = request.getParameter(\"method\");" + StringUtils.NEWLINE); - fbuffer.append("int methodID = 0;" + StringUtils.NEWLINE); - fbuffer.append("if (method == null) methodID = -1;" + StringUtils.NEWLINE + "" + StringUtils.NEWLINE); - fbuffer.append("boolean valid = true;" + StringUtils.NEWLINE + StringUtils.NEWLINE); - - fbuffer.append("if(methodID != -1) methodID = Integer.parseInt(method);" + StringUtils.NEWLINE); - fbuffer.append("switch (methodID){ " + StringUtils.NEWLINE); - - // go to the next generator - MethodVisitor methodVisitor = new MethodVisitor(); - InputFileHelp1Generator inputFileHelp1Generator = new InputFileHelp1Generator(fbuffer,fResultName); - methodVisitor.run(beanElement,inputFileHelp1Generator); - fbuffer = inputFileHelp1Generator.getStringBuffer(); - - fbuffer.append("case 1111111111:" + StringUtils.NEWLINE); - fbuffer.append("valid = false;" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("<FORM METHOD=\"POST\" ACTION=\"" + fResultName + "\" TARGET=\"result\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"HIDDEN\" NAME=\"method\" VALUE=\"<%=method%>\">" + StringUtils.NEWLINE); - fbuffer.append("<TABLE>" + StringUtils.NEWLINE); - fbuffer.append("<TR>" + StringUtils.NEWLINE); - fbuffer.append("<TD COLSPAN=\"1\" ALIGN=\"LEFT\">URLString:</TD>" + StringUtils.NEWLINE); - fbuffer.append("<TD ALIGN=\"left\"><INPUT TYPE=\"TEXT\" NAME=\"url1111111111\" SIZE=20></TD>" + StringUtils.NEWLINE); - fbuffer.append("</TR>" + StringUtils.NEWLINE); - fbuffer.append("</TABLE>" + StringUtils.NEWLINE); - fbuffer.append("<BR>" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"SUBMIT\" VALUE=\"Invoke\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"RESET\" VALUE=\"Clear\">" + StringUtils.NEWLINE); - fbuffer.append("</FORM>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("break;" + StringUtils.NEWLINE); - fbuffer.append("case 1111111112:" + StringUtils.NEWLINE); - fbuffer.append("valid = false;" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("<FORM METHOD=\"POST\" ACTION=\"" + fResultName + "\" TARGET=\"result\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"HIDDEN\" NAME=\"method\" VALUE=\"<%=method%>\">" + StringUtils.NEWLINE); - fbuffer.append("<BR>" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"SUBMIT\" VALUE=\"Invoke\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"RESET\" VALUE=\"Clear\">" + StringUtils.NEWLINE); - fbuffer.append("</FORM>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("break;" + StringUtils.NEWLINE); - - - - fbuffer.append("}" + StringUtils.NEWLINE); - fbuffer.append("if (valid) {" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE + "Select a method to test." + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append(Generator.TAB + "return;" + StringUtils.NEWLINE); - fbuffer.append("}" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE + StringUtils.NEWLINE); - fbuffer.append("</BODY>" + StringUtils.NEWLINE); - fbuffer.append("</HTML>" + StringUtils.NEWLINE); - - return Status.OK_STATUS; - - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp1Generator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp1Generator.java deleted file mode 100644 index 9cca6548f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp1Generator.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * 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.bean.ParameterVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.MethodElement; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a InputFileHelp1Generator. -* */ -public class InputFileHelp1Generator extends InputFileGenerator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final int INITIAL_STATE = 1; - public static final int FINAL_STATE = 2; - - public int fstate; - - /** - * Constructor. - * - */ - public InputFileHelp1Generator (StringBuffer buffer) - { - super(buffer); - fstate = INITIAL_STATE; - } - - /** - * Constructor. - * - */ - public InputFileHelp1Generator (StringBuffer buffer,String resultName) - { - super(buffer,resultName); - fstate = INITIAL_STATE; - } - - /* - * Takes in an element - * @param Object Takes in an object to be acted upon - */ - public IStatus visit (Object object) - { - Element methodElement = (Element)object; - MethodElement method = (MethodElement)methodElement; - if (method.getMethodOmmission()) return Status.OK_STATUS; - - ParameterVisitor parameterVisitor = new ParameterVisitor(); - fbuffer.append("case " + method.getNumberID()+ ":" + StringUtils.NEWLINE); - fbuffer.append("valid = false;" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("<FORM METHOD=\"POST\" ACTION=\"" + fResultName + "\" TARGET=\"result\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"HIDDEN\" NAME=\"method\" VALUE=\"<%=method%>\">" + StringUtils.NEWLINE); - - // go to the next generator - InputFileHelp2Generator inputFileHelp2Generator = new InputFileHelp2Generator(fbuffer); - parameterVisitor.run(methodElement,inputFileHelp2Generator); - fbuffer = inputFileHelp2Generator.getStringBuffer(); - - fbuffer.append("<BR>" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"SUBMIT\" VALUE=\"Invoke\">" + StringUtils.NEWLINE); - fbuffer.append("<INPUT TYPE=\"RESET\" VALUE=\"Clear\">" + StringUtils.NEWLINE); - fbuffer.append("</FORM>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("break;" + StringUtils.NEWLINE); - - - return Status.OK_STATUS; - - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp2Generator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp2Generator.java deleted file mode 100644 index 9e9232b70..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileHelp2Generator.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * 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.bean.TypeVisitor; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a InputFileHelp2Generator. -* */ -public class InputFileHelp2Generator extends InputFileHelp1Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /* - * This is actually used by the result generator to show the - * resultant Bean - * The name is the name the resultant bean is using as its instance name - */ - protected String fInstanceName; - private boolean fReturnParam=false; - - /** - * Constructor. - * - */ - public InputFileHelp2Generator (StringBuffer buffer) - { - super(buffer); - fInstanceName=""; - } - - /** - * This is state data to be used by the generators - * @param String name The instance name of the parameters type bean - */ - public void setInstanceName(String name) - { - fInstanceName = name; - } - - /** - * This is state data to be used by the generators - * @return String name The instance name of the parameters type bean - */ - public String getInstanceName() - { - return fInstanceName; - } - - - /* - * Takes in an object to be acted upon by this visitor action - * @param Object The object to be acted upon - */ - public IStatus visit (Object object) - { - Element parameterElement = (Element)object; - getVisitor(); - - fbuffer.append("<TABLE>" + StringUtils.NEWLINE); - - TypeVisitor typeVisitor = new TypeVisitor(); - InputFileTypeGenerator inputFileTypeGenerator = new InputFileTypeGenerator(fbuffer,0); - inputFileTypeGenerator.setReturnParam(getReturnParam()); - inputFileTypeGenerator.setInstanceName(fInstanceName); - typeVisitor.run(parameterElement,inputFileTypeGenerator); - fbuffer = inputFileTypeGenerator.getStringBuffer(); - - fbuffer.append("</TABLE>" + StringUtils.NEWLINE); - - return Status.OK_STATUS; - - } - - public boolean getReturnParam() - { - return fReturnParam; - } - - public void setReturnParam(boolean returnParam) - { - fReturnParam = returnParam; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileTypeGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileTypeGenerator.java deleted file mode 100644 index f6d45c3df..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileTypeGenerator.java +++ /dev/null @@ -1,291 +0,0 @@ -/******************************************************************************* - * 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 java.util.Vector; -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.bean.AttributeVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.FieldVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElementType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.SimpleElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; - - -/** -* Objects of this class represent a InputFileTypeGenerator. -* */ -public class InputFileTypeGenerator extends InputFileHelp2Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected String fParentGetters; - protected int fLevelsDeep; - protected int fColspan; - protected int fCurrentLevel; - private boolean fIsSimple; - private boolean fStateLessBean; - private Vector fGetters; - private Vector fTypes; - - /** - * Constructor. - * - */ - public InputFileTypeGenerator (StringBuffer buffer, int currentLevel) - { - super(buffer); - fCurrentLevel = currentLevel; - fLevelsDeep = -1; - fParentGetters = ""; - } - - /** - * Constructor. - * - */ - public InputFileTypeGenerator (StringBuffer buffer, int currentLevel,int levelsDeep) - { - super(buffer); - fCurrentLevel = currentLevel; - fLevelsDeep = levelsDeep; - fParentGetters = ""; - } - - public void setParentGetters(Vector getter,Vector type) - { - if(fGetters != null){ - fGetters.clear(); - fTypes.clear(); - } - addParentGetter(getter,type); - } - - - /** - * This function holds some state data that is important in getting the - * Strings for display of resultant beans - * @param String getter this is the getter of an attribute - * The idea is that by the time we get to the simple type - * we have getAddress().getStreet().... - */ - public void addParentGetter(String getter, String type) - { - if(fGetters == null) fGetters = new Vector(); - if(fTypes == null) fTypes = new Vector(); - fGetters.addElement(getter); - fTypes.addElement(type); - } - - /* - * this will be used when passing between two visitors - * - */ - public void addParentGetter(Vector getters, Vector types) - { - if(fGetters == null) fGetters = new Vector(); - if(fTypes == null) fTypes = new Vector(); - int size = getters.size(); - for(int i = 0; i<size; i++){ - fGetters.addElement(getters.get(i)); - fTypes.addElement(types.get(i)); - } - } - - protected String returnParentGetter(int count) - { - if (fGetters == null || count > fGetters.size()) return null; - return (String)fGetters.get(count); - } - - protected String returnParentGetterType(int count) - { - if (fTypes == null || count > fTypes.size()) return null; - return (String)fTypes.get(count); - } - - protected Vector returnParentGetter() - { - if (fGetters == null ) return new Vector(); - return fGetters; - } - - protected Vector returnParentGetterType() - { - if (fTypes == null ) return new Vector(); - return fTypes; - } - - protected int getterCount() - { - if(fGetters == null) return 0; - return fGetters.size(); - } - - - /** - * This function returns some state data that is important in getting the - * Strings for display of resultant beans - * @return String the string of getters to this point - * The idea is that by the time we get to the simple type - * we have getAddress().getStreet().... - */ - public String getParentGetters() - { - return fParentGetters; - } - - /* - * Takes in an object to be acted upon by this visitor action - * @param Object The object to be acted upon - */ - public IStatus visit (Object object) - { - TypeElement element = (TypeElement)object; - - if (element instanceof SimpleElement) fIsSimple = true; - else fIsSimple = false; - - //this could be a statelessbean need to know - if (element instanceof BeanElement ){ - BeanElement bean = (BeanElement)element; - if (bean.isStateLess()) fStateLessBean = true; - } - - - - //Complex type support - //first I need to find out how many levels deep - if(fLevelsDeep == -1){ - AttributeVisitor attributeVisitor = new AttributeVisitor(); - LevelsDeepVisitorAction ldva = new LevelsDeepVisitorAction(); - attributeVisitor.run(element,ldva); - fLevelsDeep = ldva.getLevelsDeep(); - //check out the fields - FieldVisitor fieldVisitor = new FieldVisitor(); - LevelsDeepVisitorAction ldva2 = new LevelsDeepVisitorAction(); - fieldVisitor.run(element,ldva2); - - if(fLevelsDeep < ldva2.getLevelsDeep())fLevelsDeep = ldva2.getLevelsDeep(); - fLevelsDeep++; - } - fColspan = fLevelsDeep - fCurrentLevel; - - //if we have a return param with no getter make sure we are on the - //attribute and not the parameter then return - if(getReturnParam() && element.getOwningElement() instanceof AttributeElementType &&(((AttributeElementType)element.getOwningElement()).getGetterMethod() == null) ) return Status.OK_STATUS; - - //Code gen for all elements - fbuffer.append("<TR>" + StringUtils.NEWLINE); - for (int i = 0; i < fCurrentLevel;i++){ - fbuffer.append("<TD WIDTH=\"5%\"></TD>" + StringUtils.NEWLINE); - } - fbuffer.append("<TD COLSPAN=\"" + fColspan + "\" ALIGN=\"LEFT\">" + element.getOwningElement().getName() + ":</TD>" + StringUtils.NEWLINE); - if(fIsSimple || TypeFactory.recognizedBean(element.getName()) - || (getReturnParam() && fStateLessBean) - || (getReturnParam() && TypeFactory.isRecognizedReturnType(element.getTypeName()))){ - if(getInstanceName().equals("")){ - DataType dataType = TypeFactory.createType(element.getName(),element.getOwningElement().getMUID()); - fbuffer.append(dataType.inputForm(element.getOwningElement().getMUID())); - } - else{ - if(getReturnParam() && (TypeFactory.isRecognizedReturnType(element.getTypeName()) || fStateLessBean)){ - DataType dataType = TypeFactory.createType(element.getTypeName(),element.getOwningElement().getMUID()); - String uniqueName = "type" + dataType.getUniqueName(); - fbuffer.append("<TD>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("if(" + getInstanceName() + " != null){" + StringUtils.NEWLINE); - String afterString = getInstanceName(); - String tmpString = "tebece"; - String prevString = getInstanceName(); - String newTmpString = ""; - for(int i=0;i<getterCount();i++){ - newTmpString = tmpString + i; - fbuffer.append(returnParentGetterType(i) + " " + newTmpString + "=" + prevString + "." + returnParentGetter(i) + ";" + StringUtils.NEWLINE); - prevString = newTmpString; - fbuffer.append("if(" + newTmpString + " != null){" + StringUtils.NEWLINE); - afterString = newTmpString; - } - fbuffer.append(element.getName() + " " + uniqueName + " = " + afterString + "." + ((AttributeElementType)element.getOwningElement()).getGetterMethod()+ ";" + StringUtils.NEWLINE); - fbuffer.append(dataType.TypeConversion(uniqueName)); - for(int i=0;i<getterCount();i++){ - fbuffer.append("}"); - } - fbuffer.append("}%>" + StringUtils.NEWLINE); - fbuffer.append("</TD>" + StringUtils.NEWLINE); - } - - else{ - fbuffer.append("<TD>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("if(" + getInstanceName() + " != null){" + StringUtils.NEWLINE); - String afterString = getInstanceName(); - String tmpString = "tebece"; - String prevString = getInstanceName(); - String newTmpString = ""; - for(int i=0;i<getterCount();i++){ - newTmpString = tmpString + i; - fbuffer.append(returnParentGetterType(i) + " " + newTmpString + "=" + prevString + "." + returnParentGetter(i) + ";" + StringUtils.NEWLINE); - prevString = newTmpString; - fbuffer.append("if(" + newTmpString + " != null){" + StringUtils.NEWLINE); - afterString = newTmpString; - } - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("<%="); - fbuffer.append(afterString + "." + ((AttributeElementType)element.getOwningElement()).getGetterMethod()+ StringUtils.NEWLINE); - fbuffer.append("%>"); - fbuffer.append("<%"); - for(int i=0;i<getterCount();i++){ - fbuffer.append("}"); - } - fbuffer.append("}%>" + StringUtils.NEWLINE); - fbuffer.append("</TD>" + StringUtils.NEWLINE); - } - } - - } - - //Now carry on down the rest of the bean - else { - AttributeVisitor attributeVisitor = new AttributeVisitor(); - attributeVisitor.setResidentVector1(returnParentGetter()); - attributeVisitor.setResidentVector2(returnParentGetterType()); - InputFileAttributeGenerator inputFileAttributeGenerator = new InputFileAttributeGenerator(fbuffer,(fCurrentLevel + 1),fLevelsDeep); - inputFileAttributeGenerator.setReturnParam(getReturnParam()); - inputFileAttributeGenerator.setInstanceName(fInstanceName); - attributeVisitor.run(element,inputFileAttributeGenerator); - fbuffer = inputFileAttributeGenerator.getStringBuffer(); - - //now do fields very similar - FieldVisitor fieldVisitor = new FieldVisitor(); - fieldVisitor.setResidentVector1(returnParentGetter()); - fieldVisitor.setResidentVector2(returnParentGetterType()); - InputFileAttributeGenerator inputFileAttributeGenerator2 = new InputFileAttributeGenerator(fbuffer,(fCurrentLevel + 1),fLevelsDeep); - inputFileAttributeGenerator2.setReturnParam(getReturnParam()); - inputFileAttributeGenerator2.setInstanceName(fInstanceName); - fieldVisitor.run(element,inputFileAttributeGenerator2); - fbuffer = inputFileAttributeGenerator2.getStringBuffer(); - - - - } - - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/LevelsDeepVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/LevelsDeepVisitorAction.java deleted file mode 100644 index a8f4cb17e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/LevelsDeepVisitorAction.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * 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.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.AttributeVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.FieldVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.TypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a LevelsDeepVisitorAction. -* */ -public class LevelsDeepVisitorAction implements VisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private int fLevelsDeep; - private int fDeepestLevel; - - /** - * Constructor. - * This is the starting point - * - */ - public LevelsDeepVisitorAction () - { - fLevelsDeep = 0; - } - - /** - * Constructor. - * This is the starting point - * - */ - public LevelsDeepVisitorAction (int current,boolean increment) - { - fLevelsDeep = current; - if(increment) fLevelsDeep++; - fDeepestLevel = fLevelsDeep; - } - - public void initialize(String resident) - { - //nothing to be done but must be implemented - } - - - - /** - * The visitor that called this VisitorAction - * @param visitor the visitor that called this visitor action - */ - public void setVisitor(Visitor visitor) - { - } - - - /** - * Returns the level of nesting within this bean - * @return int returns the int number representing the number of nests of this bean - */ - public int getLevelsDeep() - { - return fDeepestLevel; - } - - - /** - * Takes in an object to be acted upon by this visitor action - * @param Object The object to be acted upon - */ - public IStatus visit (Object object) - { - Element element = (Element)object; - if (element instanceof AttributeElement || element instanceof TypeElement){ - TypeVisitor typeVisitor = new TypeVisitor(); - LevelsDeepVisitorAction lvda = new LevelsDeepVisitorAction(fLevelsDeep,true); - typeVisitor.run(element,lvda); - - if (lvda.getLevelsDeep() > fDeepestLevel) fDeepestLevel = lvda.getLevelsDeep(); - - } - else if (element instanceof BeanElement && !(TypeFactory.recognizedBean(element.getName()))){ - AttributeVisitor attributeVisitor = new AttributeVisitor(); - LevelsDeepVisitorAction lvda = new LevelsDeepVisitorAction(fLevelsDeep,false); - attributeVisitor.run(element,lvda); - if (lvda.getLevelsDeep() > fDeepestLevel) fDeepestLevel = lvda.getLevelsDeep(); - - FieldVisitor fieldVisitor = new FieldVisitor(); - LevelsDeepVisitorAction lvda2 = new LevelsDeepVisitorAction(fLevelsDeep,false); - fieldVisitor.run(element,lvda2); - if (lvda2.getLevelsDeep() > fDeepestLevel) fDeepestLevel = lvda2.getLevelsDeep(); - - } - - return Status.OK_STATUS; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileGenerator.java deleted file mode 100644 index 3a8973402..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileGenerator.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.MethodVisitor; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a MethodFilegenerator. -* */ -public class MethodFileGenerator extends Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public String fInputName; - /** - * Constructor. - * - */ - public MethodFileGenerator (String inputs) - { - super(); - fInputName = inputs; - } - - /** - * Constructor. - * @param StringBuffer buffer to append codegen - */ - public MethodFileGenerator (StringBuffer buffer,String inputs) - { - super(buffer); - fInputName = inputs; - } - - - public void setFileNames(String inputs) - { - fInputName = inputs; - } - - //public static String LOCATOR = "Locator"; - public static String BEAN = "Proxy"; - public static String GET = "get"; - - - //takes in a bean node - public IStatus visit (Object object) - { - Element beanElement = (Element)object; - fbuffer.append("<%@page contentType=\"text/html;charset=UTF-8\"%>"); - fbuffer.append("<HTML>" + StringUtils.NEWLINE + "<HEAD>" + StringUtils.NEWLINE + "<TITLE>Methods</TITLE>" + StringUtils.NEWLINE + "</HEAD>" + StringUtils.NEWLINE + "<BODY>" + StringUtils.NEWLINE + "<H1>Methods</H1>" + StringUtils.NEWLINE + "<UL>" + StringUtils.NEWLINE); - MethodVisitor methodVisitor = new MethodVisitor(); - MethodFileHelpGenerator methodFileHelpGenerator = new MethodFileHelpGenerator(fbuffer,fInputName); - methodVisitor.run(beanElement,methodFileHelpGenerator); - fbuffer = methodFileHelpGenerator.getStringBuffer(); - fbuffer.append("</UL>" + StringUtils.NEWLINE + "</BODY>" + StringUtils.NEWLINE + "</HTML>"); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileHelpGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileHelpGenerator.java deleted file mode 100644 index 45ff5f9e2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/MethodFileHelpGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * 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.datamodel.beanmodel.MethodElement; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a MethodFilegenerator. -* */ -public class MethodFileHelpGenerator extends MethodFileGenerator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor. - * - */ - public MethodFileHelpGenerator (StringBuffer buffer,String inputName) - { - super(buffer,inputName); - } - - - //takes in a Method node - public IStatus visit (Object object) - { - Element methodElement = (Element)object; - MethodElement method = (MethodElement)methodElement; - if (method.getMethodOmmission()) return Status.OK_STATUS; - - fbuffer.append("<LI><A HREF=\"" + fInputName + "?method=" + method.getNumberID()); - fbuffer.append("\" TARGET=\"inputs\"> " + method.getDisplayName()); - fbuffer.append("</A></LI>" + StringUtils.NEWLINE); - - return Status.OK_STATUS; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileAttributeGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileAttributeGenerator.java deleted file mode 100644 index 34e7a4da0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileAttributeGenerator.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * 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 java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.TypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElementType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - -/** -* Objects of this class represent a ResultFileAttributeGenerator. -* */ -public class ResultFileAttributeGenerator extends ResultFileHelp2Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private Vector fSetterVector; - - /** - * Constructor. - * @param buffer StringBuffer object that this code generator writes to - */ - public ResultFileAttributeGenerator (StringBuffer buffer) - { - super(buffer); - - } - - /** - * Setter vector - */ - public Vector getSetterVector() - { - return fSetterVector; - } - - - /** - * Visit Method generates code for this Visitor - * @param Parameter parameter code will be generated - */ - public IStatus visit (Object object) - { - AttributeElementType attributeElementType = (AttributeElementType)object; - BasicElement element = (BasicElement)object; - if(attributeElementType.getTypeElement().isSimple() || TypeFactory.recognizedBean(attributeElementType.getTypeElement().getName())){ - //start the codegen - //ask the datatype for its request line, it may need mark up or not. - //ie For the simple types we need the mark up - //for the dom element we cant use it. - DataType dataType = TypeFactory.createType(attributeElementType.getTypeElement().getName(),element.getMUID()); - setTypeOwnerId(idName(element.getName())); - fbuffer.append(dataType.getRequestCode(element.getMUID(),getTypeOwnerId())); - - } - - TypeVisitor typeVisitor = new TypeVisitor(); - ResultFileTypeGenerator resultFileTypeGenerator = new ResultFileTypeGenerator(fbuffer); - resultFileTypeGenerator.setNumberFactory(getNumberFactory()); - resultFileTypeGenerator.setTypeOwnerId(getTypeOwnerId()); - - typeVisitor.run(attributeElementType,resultFileTypeGenerator); - setNumberFactory(resultFileTypeGenerator.getNumberFactory()); - Vector setterInputs = resultFileTypeGenerator.getResidentVector(); - if(attributeElementType.getSetterMethod() == null) return Status.OK_STATUS; - putResidentVector(attributeElementType.getSetterSignature((String)setterInputs.firstElement())); - - return Status.OK_STATUS; - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileGenerator.java deleted file mode 100644 index 586bba91a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileGenerator.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * 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; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.MethodVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a MethodFilegenerator. -* */ -public class ResultFileGenerator extends Generator -{ - public static String TRIPLE_TAB = Generator.DOUBLE_TAB + Generator.TAB; - public static String QUAD_TAB = Generator.DOUBLE_TAB + Generator.DOUBLE_TAB; - - private String setEndpointMethod; - - /** - * Constructor. - * - */ - public ResultFileGenerator () - { - super(); - } - - /** - * Constructor. - * - */ - public ResultFileGenerator (StringBuffer buffer) - { - super(buffer); - } - - //takes in a bean node - public IStatus visit (Object object) - { - Element beanElement = (Element)object; - BeanElement bean = (BeanElement)beanElement; - fbuffer.append("<%@page contentType=\"text/html;charset=UTF-8\"%>"); - fbuffer.append("<HTML>" + StringUtils.NEWLINE); - fbuffer.append("<HEAD>" + StringUtils.NEWLINE); - fbuffer.append("<TITLE>Result</TITLE>" + StringUtils.NEWLINE); - fbuffer.append("</HEAD>" + StringUtils.NEWLINE); - fbuffer.append("<BODY>" + StringUtils.NEWLINE); - fbuffer.append("<H1>Result</H1>" + StringUtils.NEWLINE + StringUtils.NEWLINE); - - fbuffer.append("<jsp:useBean id=\""+ getSessionBeanId() + "\" scope=\"session\" class=\""); - fbuffer.append(bean.getName() + "\" />" + StringUtils.NEWLINE); - if (setEndpointMethod != null && setEndpointMethod.length() > 0) - { - fbuffer.append("<%"); - fbuffer.append(StringUtils.NEWLINE); - fbuffer.append("if (request.getParameter(\"endpoint\") != null && request.getParameter(\"endpoint\").length() > 0)"); - fbuffer.append(StringUtils.NEWLINE); - fbuffer.append(getSessionBeanId()); - fbuffer.append("."); - int index = setEndpointMethod.indexOf('?'); - if (index != -1) - { - fbuffer.append(setEndpointMethod.substring(0, index)); - fbuffer.append("(new "); - fbuffer.append(setEndpointMethod.substring(index+1, setEndpointMethod.length())); - fbuffer.append("(request.getParameter(\"endpoint\")));"); - } - else - { - fbuffer.append(setEndpointMethod); - fbuffer.append("(request.getParameter(\"endpoint\"));"); - } - fbuffer.append(StringUtils.NEWLINE); - fbuffer.append("%>"); - fbuffer.append(StringUtils.NEWLINE); - } - fbuffer.append(StringUtils.NEWLINE); - - //carry on with regular gorp - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("String method = request.getParameter(\"method\");" + StringUtils.NEWLINE); - fbuffer.append("int methodID = 0;" + StringUtils.NEWLINE); - fbuffer.append("if (method == null) methodID = -1;" + StringUtils.NEWLINE + "" + StringUtils.NEWLINE); - fbuffer.append("if(methodID != -1) methodID = Integer.parseInt(method);" + StringUtils.NEWLINE); - fbuffer.append("boolean gotMethod = false;" + StringUtils.NEWLINE + StringUtils.NEWLINE); - - fbuffer.append("try {" + StringUtils.NEWLINE); - fbuffer.append("switch (methodID){ " + StringUtils.NEWLINE); - - // go to the next generator - MethodVisitor methodVisitor = new MethodVisitor(); - ResultFileHelp1Generator resultFileHelp1Generator = new ResultFileHelp1Generator(fbuffer); - resultFileHelp1Generator.setNumberFactory(getNumberFactory()); - resultFileHelp1Generator.setClientFolderPath(getClientFolderPath()); - methodVisitor.run(beanElement,resultFileHelp1Generator); - setNumberFactory(resultFileHelp1Generator.getNumberFactory()); - - fbuffer = resultFileHelp1Generator.getStringBuffer(); - - fbuffer.append("}" + StringUtils.NEWLINE); - fbuffer.append("} catch (Exception e) { " + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("exception: <%= e %>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("return;" + StringUtils.NEWLINE); - fbuffer.append("}" + StringUtils.NEWLINE); - fbuffer.append("if(!gotMethod){" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("result: N/A" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("}" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("</BODY>" + StringUtils.NEWLINE); - fbuffer.append("</HTML>"); - - return Status.OK_STATUS; - } - - /** - * @param setEndpointMethod The setEndpointMethod to set. - */ - public void setSetEndpointMethod(String setEndpointMethod) - { - this.setEndpointMethod = setEndpointMethod; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp1Generator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp1Generator.java deleted file mode 100644 index b6d38ab37..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp1Generator.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 java.util.Enumeration; -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; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.ParameterVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.ReturnParameterVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.MethodElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a ResultFilegenerator. -* */ -public class ResultFileHelp1Generator extends ResultFileGenerator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final int INITIAL_STATE = 1; - public static final int FINAL_STATE = 2; - public static final String MTEMP = "mtemp"; - public static String BEAN = "Proxy"; - - /** - * Constructor. - * @param buffer StringBuffer object that this code generator writes to - */ - public ResultFileHelp1Generator (StringBuffer buffer) - { - super(buffer); - } - - /** - * Visit Method generates code for this Visitor - * @param method method code will be generated for - */ - public IStatus visit (Object object) - { - Element methodElement = (Element)object; - - - MethodElement method = (MethodElement)methodElement; - if (method.getMethodOmmission()) return Status.OK_STATUS; - - fbuffer.append("case " + method.getNumberID()+ ":" + StringUtils.NEWLINE); - visitHelper(method); - - fbuffer.append("break;" + StringUtils.NEWLINE); - - return Status.OK_STATUS; - } - /** - * Helps out the visitor - * @param method method code will be generated for - */ - public void visitHelper (Element methodElement) - { - - fbuffer.append(Generator.DOUBLE_TAB + "gotMethod = true;" + StringUtils.NEWLINE); - - MethodElement method = (MethodElement)methodElement; - // go to the next generator - ResultFileHelp2Generator resultFileHelp2Generator = new ResultFileHelp2Generator(fbuffer); - resultFileHelp2Generator.setNumberFactory(getNumberFactory()); - ParameterVisitor parameterVisitor = new ParameterVisitor(); - parameterVisitor.run(methodElement,resultFileHelp2Generator); - fbuffer = resultFileHelp2Generator.getStringBuffer(); - setNumberFactory(resultFileHelp2Generator.getNumberFactory()); - // we must now grab the state data from the resident vector - setResidentVector(resultFileHelp2Generator.getResidentVector()); - - - //there is no return type if void occurs - - - if (method.getReturnParameterElement().getTypeElement().getName().equals("void")) - fbuffer.append(Generator.DOUBLE_TAB + getSessionBeanId() + "." +method.getName() + "("); - - else{ - fbuffer.append(Generator.DOUBLE_TAB + method.getReturnParameterElement().getTypeElement().getName() + Generator.SPACE + method.getMUID() + MTEMP + Generator.SPACE); - fbuffer.append("=" + Generator.SPACE + getSessionBeanId() + "." + method.getName() + "("); - } - - Enumeration e = fResidentVector.elements(); - while (e.hasMoreElements()){ - fbuffer.append((String)e.nextElement()); - if (e.hasMoreElements()) - fbuffer.append(","); - } - fbuffer.append(");" + StringUtils.NEWLINE); - if (!method.getReturnParameterElement().getTypeElement().getName().equals("void") && !method.getReturnParameterElement().getTypeElement().isPrimitive()){ - //in case our result is null - fbuffer.append("if(" + method.getMUID() + "mtemp == null){" + StringUtils.NEWLINE); - fbuffer.append("%>" + StringUtils.NEWLINE); - fbuffer.append("<%=" + method.getMUID() + "mtemp %>" + StringUtils.NEWLINE); - fbuffer.append("<%" + StringUtils.NEWLINE); - fbuffer.append("}else{" + StringUtils.NEWLINE); - } - - //now lets display the return bean - // if it is simple we dont need to use the generator - - if (!method.getReturnParameterElement().getTypeElement().getName().equals("void")){ - if (method.getReturnParameterElement().getTypeElement().isSimple() - || TypeFactory.recognizedBean(method.getReturnParameterElement().getTypeElement().getName()) - || TypeFactory.isStateLessBean(method.getReturnParameterElement().getTypeElement().getTypeName()) - || TypeFactory.isRecognizedReturnType(method.getReturnParameterElement().getTypeElement().getTypeName())){ - DataType dataType = TypeFactory.createType(method.getReturnParameterElement().getTypeElement().getTypeName(),method.getReturnParameterElement().getMUID()); - fbuffer.append(dataType.TypeConversion(method.getMUID() + MTEMP)); - } - else{ - fbuffer.append("%>" + StringUtils.NEWLINE); - InputFileHelp2Generator inputFileHelp2Generator = new InputFileHelp2Generator(fbuffer); - inputFileHelp2Generator.setInstanceName(method.getMUID() + MTEMP); - inputFileHelp2Generator.setReturnParam(true); - ReturnParameterVisitor returnParameterVisitor = new ReturnParameterVisitor(); - returnParameterVisitor.run(method,inputFileHelp2Generator); - fbuffer = inputFileHelp2Generator.getStringBuffer(); - fbuffer.append("<%" + StringUtils.NEWLINE); - - } - } - - if (!method.getReturnParameterElement().getTypeElement().getName().equals("void") && !method.getReturnParameterElement().getTypeElement().isPrimitive()) fbuffer.append("}" + StringUtils.NEWLINE); - - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp2Generator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp2Generator.java deleted file mode 100644 index 724285e06..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileHelp2Generator.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.consumption.codegen.Generator; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.TypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.ParameterElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; - -/** -* Objects of this class represent a ResultFileHelp2generator. -* */ -public class ResultFileHelp2Generator extends Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private String fTypeOwnerId; - - - /** - * Constructor. - * @param buffer StringBuffer object that this code generator writes to - */ - public ResultFileHelp2Generator (StringBuffer buffer) - { - super(buffer); - - } - - /** - * Visit Method generates code for this Visitor - * @param Parameter parameter code will be generated - */ - public IStatus visit (Object object) - { - - - ParameterElement parameterElement = (ParameterElement)object; - parameterElement.getTypeElement(); - if(parameterElement.getTypeElement().isSimple() || TypeFactory.recognizedBean(parameterElement.getTypeElement().getName())){ - //start the codegen - //ask the datatype for its request line, it may need mark up or not. - //ie For the simple types we need the mark up - //for the dom element we cant use it. - DataType dataType = TypeFactory.createType(parameterElement.getTypeElement().getName(),parameterElement.getMUID()); - setTypeOwnerId(idName(parameterElement.getName())); - fbuffer.append(dataType.getRequestCode(parameterElement.getMUID(),getTypeOwnerId())); - } - - //visit the type generator - ResultFileTypeGenerator resultFileTypeGenerator = new ResultFileTypeGenerator(fbuffer); - resultFileTypeGenerator.setNumberFactory(getNumberFactory()); - resultFileTypeGenerator.setTypeOwnerId(getTypeOwnerId()); - TypeVisitor TypeVisitor = new TypeVisitor(); - TypeVisitor.run(parameterElement,resultFileTypeGenerator); - fbuffer = resultFileTypeGenerator.getStringBuffer(); - setNumberFactory(resultFileTypeGenerator.getNumberFactory()); - String name = (String)resultFileTypeGenerator.getResidentVector().firstElement(); - putResidentVector(name); - - return Status.OK_STATUS; - } - - - public String getTypeOwnerId() - { - if (fTypeOwnerId == null) fTypeOwnerId = ""; - return fTypeOwnerId; - } - - public void setTypeOwnerId(String name) - { - fTypeOwnerId = name; - } - - public String idName(String name) - { - - String uniqueNum = String.valueOf(getUniqueNumber()); - String newName = name.replace('.','1') + "_" +uniqueNum + "id"; - return newName; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileTypeGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileTypeGenerator.java deleted file mode 100644 index f78cd599d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileTypeGenerator.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * 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 java.util.Enumeration; -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; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.AttributeVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.bean.FieldVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.ws.internal.datamodel.Element; - -/** -* Objects of this class represent a ResultFileHelp2generator. -* */ -public class ResultFileTypeGenerator extends ResultFileHelp2Generator -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - - public String fTypeIdName; - - /** - * Constructor. - * @param buffer StringBuffer object that this code generator writes to - */ - public ResultFileTypeGenerator (StringBuffer buffer) - { - super(buffer); - } - - /** - * Visit Method generates code for this Visitor - * @param Parameter parameter code will be generated - */ - public IStatus visit (Object object) - { - Element typeElement = (Element)object; - TypeElement type = (TypeElement)typeElement; - // right now we only have simple to worry about - if(type.isSimple() || TypeFactory.recognizedBean(type.getName())){ - // create the type that represents the simple type name - DataType dataType = TypeFactory.createType(type.getName(),type.getOwningElement().getMUID()); - - String nodeName = getTypeOwnerId()+ "Temp"; - fbuffer.append(dataType.stringConversion(type.getName(),nodeName,getTypeOwnerId())); - - putResidentVector(nodeName); - } - - else { - //must be complex - String typeName = typeElement.getName(); - fTypeIdName = idName(typeName); - - AttributeVisitor attributeVisitor = new AttributeVisitor(); - ResultFileAttributeGenerator resultFileAttributeGenerator = new ResultFileAttributeGenerator(fbuffer); - resultFileAttributeGenerator.setNumberFactory(getNumberFactory()); - attributeVisitor.run(typeElement,resultFileAttributeGenerator); - setNumberFactory(resultFileAttributeGenerator.getNumberFactory()); - fbuffer = resultFileAttributeGenerator.getStringBuffer(); - - FieldVisitor fieldVisitor = new FieldVisitor(); - ResultFileAttributeGenerator resultFileAttributeGenerator2 = new ResultFileAttributeGenerator(fbuffer); - resultFileAttributeGenerator2.setNumberFactory(getNumberFactory()); - fieldVisitor.run(typeElement,resultFileAttributeGenerator2); - setNumberFactory(resultFileAttributeGenerator2.getNumberFactory()); - fbuffer = resultFileAttributeGenerator2.getStringBuffer(); - - - fbuffer.append(Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE); - fbuffer.append(Generator.DOUBLE_TAB + "<jsp:useBean id=\"" + fTypeIdName + "\" scope=\"session\" class=\"" + typeName + "\" />" + StringUtils.NEWLINE); - fbuffer.append(Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE); - - Enumeration e = resultFileAttributeGenerator.getResidentVector().elements(); - while(e.hasMoreElements()){ - fbuffer.append(Generator.DOUBLE_TAB + fTypeIdName + "." + e.nextElement() + StringUtils.NEWLINE); - } - - Enumeration e2 = resultFileAttributeGenerator2.getResidentVector().elements(); - while(e2.hasMoreElements()){ - fbuffer.append(Generator.DOUBLE_TAB + fTypeIdName + "." + e2.nextElement() + StringUtils.NEWLINE); - } - putResidentVector(fTypeIdName); - //end of changes - - } - - return Status.OK_STATUS; - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/TestClientFileGenerator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/TestClientFileGenerator.java deleted file mode 100644 index 83fe42bca..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/TestClientFileGenerator.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * 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; - } -} |