diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption/src')
138 files changed, 0 insertions, 13295 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties deleted file mode 100644 index 19576895d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties +++ /dev/null @@ -1,176 +0,0 @@ -############################################################################### -# Copyright (c) 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 -############################################################################### - -# -# Sample messages -# -MSG_ERROR_JTS_PROXY_HAS_NO_METHODS=IWAB0179E Unable to create a sample to the proxy because the proxy does not contain methods. -MSG_ERROR_JTS_PROXY_HAS_NO_DEFAULT=IWAB0180E Unable to create a sample to the proxy because the proxy is not a bean (i.e.. the sample does not have public default constructor). -MSG_ERROR_JTS_NO_PROXY_METHODS_PROCESSED=IWAB0181E Unable to create a sample to the proxy because none of the methods in the proxy were processed. -MSG_WARN_JTS_UNSUPPORTED_TYPE=IWAB0182W The Sample JSP client does not support the following type: -MSG_WARN_JTS_UNSUPPORTED_INDEXED_PROPERTIES=IWAB0187W The Sample JSP client does not support Indexed properties. -MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS=IWAB0237W The Sample JSP client does not support arrays: -MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_INPUTS=IWAB0124W The Sample JSP client does not support input parameters that are not beans: -MSG_ERROR_JTS_CYCLIC_BEAN=IWAB0188E The Sample JSP client does not support beans containing attributes that reference the beans. -MSG_WARN_JTS_PROXY_METHODS_OMITTED=IWAB0189W The Sample JSP client omitted some methods because they contained unsupported types. -MSG_ERROR_SAMPLE_CREATION_CANCELED=IWAB0021E Sample creation was canceled -MSG_WARN_UNABLE_TO_FIND_PROXY=IWAB0022W The Proxy Resource cound not not be found. - -MSG_ERROR_CANNOT_CREATE_COMPONENT=The Web service wizard cannot automatically create component "{0}". Cancel the wizard and create the component manually. - -# -# Filters -# -FILTER_MSG_ERROR_NULL_OBJECT=IWAB0097E No object has been provided. -FILTER_MSG_ERROR_NOT_FILE=IWAB0098E The object "{0}" is not a file. -FILTER_MSG_ERROR_NOT_FOLDER=IWAB0137E The object "{0}" is not a folder. - -JAVA_FILTER_NAME=Java files -JAVA_FILTER_DESC=Files with names ending in ".java" or ".class". -JAVA_FILTER_MSG_ERROR_WRONG_EXTENSION=IWAB0102E The file "{0}" does not end in ".java" or ".class". - -WSDL_FILTER_NAME=WSDL files -WSDL_FILTER_DESC=Files with names ending in ".wsdl". -WSDL_FILTER_MSG_ERROR_WRONG_EXTENSION=IWAB0103E The file "{0}" does not end in ".wsdl". - -ISD_FILTER_NAME=ISD files -ISD_FILTER_DESC=Files with names ending in ".isd". -ISD_FILTER_MSG_ERROR_WRONG_EXTENSION=IWAB0095E The file "{0}" does not end in ".isd". - -FOLDER_FILTER_NAME=Folders -FOLDER_FILTER_DESC=Folders. - - -# -# Common messages -# - - -MSG_ERROR_PROJECT_NOT_FOUND=IWAB0069E Web project was not found. -MSG_ERROR_INSTANCE_NOT_FOUND=IWAB0070E Server was not found. - -PROGRESS_INFO_PUBLISH_WEB_PROJECT=IWAB0072I Publishing Web project. - -# -# Deployment status -# -PROGRESS_INFO_COPY_WEBSERVICE_UTILS=IWAB0023I Copying the webservice utilities. -PROGRESS_INFO_COPYING_FILE=IWAB0197I Copying SOAP run-time file. -PROGRESS_INFO_START_WEB_PROJECT=IWAB0198I Starting Web project. -PROGRESS_INFO_PUBLISHING_SERVER=IWAB0199I Publishing server. -PROGRESS_INFO_STARTING_SERVER=IWAB0200I Starting server. -PROGRESS_INFO_PUBLISH_WEB_PROJECT=IWAB0205I Publishing Web project. - - -# -# Deployment messages -# -MSG_ERROR_PROJECT_NOT_FOUND=IWAB0207E Web project was not found. -MSG_ERROR_FILECOPY_WEBSERVICE_UTILS=IWAB0024E Error in copying Webservice Utility file. -MSG_ERROR_INSTANCE_NOT_FOUND=IWAB0212E Server was not found. -MSG_ERROR_SERVER=IWAB0213E Error in starting server. -MSG_ERROR_PUBLISH=IWAB0217E Error in publishing Web project. -MSG_ERROR_ADD_MODULE=Error occured when adding the module, {0}, to the server - -MSG_WARN_NO_DB_DRIVER=IWAB0221W Unable to locate db2java.zip, please ensure db2java.zip is added to the server class path. - -MSG_ERROR_BAD_SERVER_CONFIG=IWAB0534E Unable to add EAR project to Server Configuration. -MSG_ERROR_CREATE_SERVER=IWAB0025E Unable to create server. -MSG_ERROR_STUB_ONLY=Unable to create server because only stub runtimes are available for the {0} server type. Go to Window > Preferences. Select Server > Installed Runtimes to install a non-stub runtime. - - - -# -# EJB messages -# -TASK_LABEL_CREATE_EJB_PROJECT=CreateEJBProjectTask -TASK_DESC_CREATE_EJB_PROJECT=Create an EJB Project. -MSG_ERROR_CANNOT_CREATE_EJB_PROJECT=IWAB0432E Unable to create EJB project. -MSG_ERROR_CANNOT_CREATE_APP_CLIENT_PROJECT=IWAB0026E Unable to create application client project {0}. -MSG_ERROR_CANNOT_CREATE_JAVA_PROJECT=IWAB0027E Unable to create Java project {0}. -MSG_ERROR_CANNOT_CREATE_EAR_PROJECT=IWAB0062E Unable to create EAR project {0}. - -# -# WebServiceMappingPage Messages -# - -# -# Validator task descriptions -# -TASK_LABEL_WEBSERVICE_DISABLE_VALIDATION=Disable validators. -TASK_DESC_WEBSERVICE_DISABLE_VALIDATION=Temporarily disabling validators. -TASK_LABEL_WEBSERVICE_RESTORE_VALIDATION=Restore validators. -TASK_DESC_WEBSERVICE_RESTORE_VALIDATION=Restoring states of validators. -TASK_LABEL_WEBSERVICE_DISABLE_BUILD=Disable auto build. -TASK_DESC_WEBSERVICE_DISABLE_BUILD=Temporarily disabling auto build. -TASK_LABEL_WEBSERVICE_RESTORE_BUILD=Restore auto build. -TASK_DESC_WEBSERVICE_RESTORE_BUILD=Restoring state of auto build. -TASK_LABEL_WEBSERVICE_BUILD_PROJECT=Build project. -TASK_DESC_WEBSERVICE_BUILD_PROJECT=Building project. - -# -# MISC -# -TASK_DESC_CREATE_WEB_PROJECT=Create Web Project -TASK_LABEL_CREATE_WEB_PROJECT=Create Web Project -MSG_ERROR_WEB_PROJECT_CREATE=IWAB0310E An error occurred during creation of the Web Project. -MSG_ERROR_SERVER_VIEW_OPEN=IWAB0126E The server configuration editor is open for {0}. Close it and restart the wizard. - -# -# Default Proxy project messages -# - - -# -# DetectNonJavaCharsCommand -# -MSG_WARN_JAVA_METHOD_START_WITH_UPPER_CASE=IWAB0129W Java method {0} in class {1} starts with an upper case letter. Method names should begin with lower case letters. -MSG_WARN_METHOD_NAME_INVALID=IWAB0131W Java method {0} name contains underscore or numeric digits followed by a lower case letter.\ -Method names should not contain lower case letters after a numeric or underscore. -MSG_WARN_BOOLEAN_PROPERTY_ACCESSORS=IWAB0132W Boolean property accessor {0} in bean {1} begins with "get". Boolean getter methods should begin wth "is". -MSG_WARN_PACKAGE_NAME_HAS_UPPER_CASE=IWAB0133W The package name {0} of class {1} includes upper case letters. Package names should consist of lower case letters only. - -# -# JavaToModelCommand -# -LABEL_OK=OK -DESCRIPTION_OK=Select OK to continue - -LABEL_CANCEL=Cancel -DESCRIPTION_CANCEL=Select Cancel to cancel - -# -# CreateMonitorCommand -# -MSG_ERROR_UNABLE_TO_START_MONITOR=IWAB0001E Unable to monitor port {0} of {1}. -MSG_INFO_MONITORING_NOT_SUPPORTED=IWAB0002I {0} does not support port monitoring. - -# -# CopyWSDLCommand -# -COMMAND_LABEL_COPY_WSDL=Copying WSDL -COMMAND_DESC_COPY_WSDL=Copying WSDL into the workspace for Web service deployment -MSG_ERROR_COPY_WSDL=IWAB0028E Failed to copy WSDL {0} to {1} - -# -# AssociateModuleWithEARCommand -# -MSG_ERROR_UNABLE_TO_ASSOCIATE=Unable to associate component {0} to ear component {1}. - -# -# CreateModuleCommand -# -MSG_ERROR_CREATE_FLEX_PROJET=An error occured during creation of flexible project {0}. -MSG_ERROR_CREATE_WEB_COMPONENT=An error occured during creation of Web component {0}. -MSG_ERROR_CREATE_EJB_COMPONENT=An error occured during creation of EJB component {0}. -MSG_ERROR_CREATE_APPCLIENT_COMPONENT=An error occured during creation of Application Client component {0}. -MSG_ERROR_CREATE_EAR_COMPONENT=An error occured during creation of EAR component {0}. -MSG_ERROR_COMPONENT_CREATION=Unable to create project {0} and/or component {1}. diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Generator.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Generator.java deleted file mode 100644 index a260ac085..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Generator.java +++ /dev/null @@ -1,235 +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.codegen; - -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - - - -/** -* Objects of this class represent a generator. -* */ -public class Generator implements VisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * The StringBuffer that holds the codegen - * */ - protected StringBuffer fbuffer; - - /** - * The Visitor that calls the visit method - * */ - protected Visitor fVisitor; - - /** - * Vector that holds state data for this generator - * */ - protected Vector fResidentVector; - - /* - * This int holds the current number - */ - protected int fUniqueNumber =0; - - - protected String fClientFolderPath; - - public static final String FACTORY = "Factory"; - - public static final String TAB = " "; - public static final String DOUBLE_TAB = " "; - public static final String SPACE = " "; - - /** - * Constructor. - * - */ - public Generator () - { - fbuffer = new StringBuffer(); - fResidentVector = new Vector(); - - } - - /** - * Constructor. - * @param StringBuffer Takes the buffer it will write code to - */ - public Generator (StringBuffer buffer) - { - fbuffer = buffer; - fResidentVector = new Vector(); - } - - public void initialize(String resident) - { - //nothing to be done but must be implemented - } - - public String getClientFolderPath() - { - return fClientFolderPath; - } - - public void setClientFolderPath(String fClientFolderPath_) - { - fClientFolderPath = fClientFolderPath_; - } - - protected String serviceName = ""; - protected String portName = ""; - protected String packageName = ""; - protected String proxyBaseName = ""; - - public void setInfo(String service, String port, String packageName, String proxyBase) - { - serviceName = service; - portName = port; - this.packageName = packageName; - proxyBaseName = proxyBase; - } - - private static final char[] BAD_SYMBOLS = {'-', ' '}; // symbols that can appear in the folder name but it is not allowed in a java bean name - private static final char UNDERSCORE = '_'; // replace the above ones by underscore - public String getSessionBeanId() - { - String name = getClientFolderPath(); - int index = name.lastIndexOf("/"); - index++; - String newName = name.substring(index); - for ( int i = 0; i < BAD_SYMBOLS.length; i++ ) { - newName = newName.replace ( BAD_SYMBOLS[i], UNDERSCORE ); - } - return newName+ "id"; - } - - /* - * The Number Factory is here for naming purposes. In - * this way we insure no names we create in a piece of - * code gen are the same. We keep track of the numbers - * used and we hand back the next one. Like take a number - * buddy - * @param int number we are at as the state data has to be settable - */ - public void setNumberFactory(int number) - { - fUniqueNumber = number; - } - - - /* - * This is a unique number for state purposes - * @return int - */ - public int getNumberFactory() - { - return fUniqueNumber; - } - /* - * This is a unique number for naming purposes - * @return int - */ - public int getUniqueNumber() - { - return fUniqueNumber++; - } - - - /** - * returns the current StringBuffer - * @return StringBuffer Takes the buffer it will write code too - */ - public StringBuffer getStringBuffer () - { - return fbuffer; - } - - - /** - * returns the Visitor that called this generator - * @return Visitor - */ - public Visitor getVisitor () - { - return fVisitor; - } - - - - - /** - * vector used to hold state data - * @parameter Visitor - */ - public void putResidentVector (Object object) - { - fResidentVector.addElement(object); - } - - - /** - * vector used to hold state data - * @parameter Visitor - */ - public void setResidentVector (Vector vector) - { - fResidentVector = vector; - } - - - /** - * returns the resident vector - * @return Visitor - */ - public Vector getResidentVector () - { - return fResidentVector; - } - - - /** - * This function is used to initialize any state a generator may have - * - **/ - - public void initialize() - { - //to be implemented in sublasses - } - - - /** - * sets the visitor that calls the visit - * @parameter Visitor - */ - - public void setVisitor(Visitor visitor) - { - fVisitor = visitor; - } - - - public IStatus visit (Object object) - { - //implemented by subclasses - return Status.OK_STATUS; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/RelVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/RelVisitor.java deleted file mode 100644 index fac00ac9b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/RelVisitor.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.codegen; - -import java.util.Enumeration; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.ws.internal.datamodel.BasicElement; -import org.eclipse.wst.ws.internal.datamodel.Rel; - - -/** -* Objects of this class represent a visitor. -* This vistor will visit elements in a model given a -* particular rel -* */ -public class RelVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private int fElementCounter; - private int fTotalElements; - private String frelName; - - /** - * Constructor. - * - */ - - public RelVisitor (String relName) - { - frelName = relName; - } - - public int getTotalElementsToVisit() - { - return fTotalElements; - } - - public boolean isLastElement() - { - if(getTotalElementsToVisit() - presentElement() == 0) return true; - return false; - } - - public int presentElement() - { - return fElementCounter; - } - - public void initialize(VisitorAction va) - { - //implemented by subclasses - } - public IStatus run (Object sourceElement,VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - initialize(vAction); - - vAction.setVisitor(this); - Rel rel = ((BasicElement)sourceElement).getRel(frelName); - //set some state data - fTotalElements = rel.getNumberOfTargetElements(); - fElementCounter = 0; - - Enumeration e = rel.getTargetElements(); - while (e.hasMoreElements()){ - BasicElement targetElement = (BasicElement)e.nextElement(); - fElementCounter++; - initialize(vAction); - status = vAction.visit(targetElement); - } - return status; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Visitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Visitor.java deleted file mode 100644 index c68cdadb0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Visitor.java +++ /dev/null @@ -1,30 +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.codegen; - -import org.eclipse.core.runtime.IStatus; - - -/** -* Objects of this class represent a visitor. -* */ -public interface Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public IStatus run (Object object, VisitorAction vAction); - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/VisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/VisitorAction.java deleted file mode 100644 index 9a3d6537f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/VisitorAction.java +++ /dev/null @@ -1,31 +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.codegen; - -import org.eclipse.core.runtime.IStatus; - - -/** -* Objects of this class represent a VisitorAction. -* The visitor walks the model and the VisitorAction -* does the action -* */ -public interface VisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public IStatus visit (Object object); - public void setVisitor(Visitor visitor); - public void initialize(String residentString); -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/AttributeVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/AttributeVisitor.java deleted file mode 100644 index 6d3a90665..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/AttributeVisitor.java +++ /dev/null @@ -1,78 +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.codegen.bean; - -import java.util.Vector; - -import org.eclipse.jst.ws.internal.consumption.codegen.RelVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileAttributeGenerator; - - -/** -* Objects of this class represent a visitor. -* */ -public class AttributeVisitor extends RelVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private Vector fResidentVector1; - private Vector fResidentVector2; - - /** - * Constructor. - * - */ - - public AttributeVisitor () - { - super(TypeElement.REL_ATTRIBUTES); - } - - public AttributeVisitor (String rel) - { - super(rel); - } - - public void setResidentString(String resident) - { - } - - public void setResidentVector1(Vector resident) - { - fResidentVector1 = resident; - } - - public void setResidentVector2(Vector resident) - { - fResidentVector2 = resident; - } - - - public void initialize(VisitorAction vAction) - { - //hack for 197726 - - if(vAction instanceof InputFileAttributeGenerator){ - if(fResidentVector1 == null) fResidentVector1=new Vector(); - if(fResidentVector2 == null) fResidentVector2=new Vector(); - ((InputFileAttributeGenerator)vAction).setParentGetters(fResidentVector1,fResidentVector2); - } - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/FieldVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/FieldVisitor.java deleted file mode 100644 index e8934d4d9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/FieldVisitor.java +++ /dev/null @@ -1,72 +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.codegen.bean; - -import java.util.Vector; - -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileAttributeGenerator; - - -/** -* Objects of this class represent a visitor. -* */ -public class FieldVisitor extends AttributeVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private Vector fResidentVector1; - private Vector fResidentVector2; - - /** - * Constructor. - * - */ - - public FieldVisitor () - { - super(TypeElement.REL_FIELDS); - } - - public void setResidentString(String resident) - { - } - - public void setResidentVector1(Vector resident) - { - fResidentVector1 = resident; - } - - public void setResidentVector2(Vector resident) - { - fResidentVector2 = resident; - } - - - public void initialize(VisitorAction vAction) - { - //hack for 197726 - - if(vAction instanceof InputFileAttributeGenerator){ - if(fResidentVector1 == null) fResidentVector1=new Vector(); - if(fResidentVector2 == null) fResidentVector2=new Vector(); - ((InputFileAttributeGenerator)vAction).setParentGetters(fResidentVector1,fResidentVector2); - } - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/MethodVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/MethodVisitor.java deleted file mode 100644 index 34664622f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/MethodVisitor.java +++ /dev/null @@ -1,40 +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.codegen.bean; - -import org.eclipse.jst.ws.internal.consumption.codegen.RelVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; - - -/** -* Objects of this class represent a visitor. -* */ -public class MethodVisitor extends RelVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor. - * - */ - - public MethodVisitor () - { - super(BeanElement.REL_METHODS); - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ParameterVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ParameterVisitor.java deleted file mode 100644 index 0749312d4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ParameterVisitor.java +++ /dev/null @@ -1,40 +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.codegen.bean; - -import org.eclipse.jst.ws.internal.consumption.codegen.RelVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.MethodElement; - - -/** -* Objects of this class represent a visitor. -* */ -public class ParameterVisitor extends RelVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor. - * - */ - - public ParameterVisitor () - { - super(MethodElement.REL_PARAMETERS); - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ReturnParameterVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ReturnParameterVisitor.java deleted file mode 100644 index 1f6207072..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/ReturnParameterVisitor.java +++ /dev/null @@ -1,40 +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.codegen.bean; - -import org.eclipse.jst.ws.internal.consumption.codegen.RelVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.MethodElement; - - -/** -* Objects of this class represent a visitor. -* */ -public class ReturnParameterVisitor extends RelVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor. - * - */ - - public ReturnParameterVisitor () - { - super(MethodElement.REL_RETURN_PARAMETERS); - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/TypeVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/TypeVisitor.java deleted file mode 100644 index d254615d7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/TypeVisitor.java +++ /dev/null @@ -1,38 +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.codegen.bean; - -import org.eclipse.jst.ws.internal.consumption.codegen.RelVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeElement; - - -/** -* Objects of this class represent a visitor. -* */ -public class TypeVisitor extends RelVisitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor. - * - */ - - public TypeVisitor () - { - super(TypeElement.REL_TYPE); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsBeanVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsBeanVisitorAction.java deleted file mode 100644 index d167c8951..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsBeanVisitorAction.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.codegen.javamofvisitoractions; - -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofMethodVisitor; - - - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a BeanElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk the methods in the JavaClass -* */ -public class DetectNonJavaCharsBeanVisitorAction extends VisitorActionImpl -{ - private static char UNDERSCORE = '_'; - - public DetectNonJavaCharsBeanVisitorAction ( Vector messages, Vector beans) - { - super (messages, beans); - } - - /** - * The visit will create the bean - * Walk the methods - * @param JavaClass the class to be used to create the bean model - **/ - public IStatus visit (Object javaclass) - { - JavaClass javaClass = (JavaClass)javaclass; - String packageName = javaClass.getJavaPackage().getPackageName(); - String beanName = javaClass.getName(); - - if (!isBeanVisited(javaClass)) { - addVisitedBean(javaClass); - // check the bean name - checkBeanName(beanName); - checkPackageName(packageName, beanName); - DetectNonJavaCharsMethodVisitorAction methodVisitorAction = new DetectNonJavaCharsMethodVisitorAction(getMessages(), getBeansVisited()); - JavaMofMethodVisitor methodVisitor = new JavaMofMethodVisitor(); - methodVisitor.run(javaClass,methodVisitorAction); - } - - return Status.OK_STATUS; - } - - private void checkBeanName(String beanName) - { - - // check if the bean starts with a lower case - if ( Character.isLowerCase(beanName.charAt(0))) - addMessage("WARN_BEAN_NAME_STARTS_WITH_LOWER_CASE", new String[]{beanName}); - - - //check if the name has an underscore, then next letter should be upper case - int underScoreIndex = beanName.indexOf(UNDERSCORE); - String tempName = beanName; - while(underScoreIndex !=-1) { - tempName = tempName.substring(underScoreIndex+1); - if ( Character.isLowerCase(tempName.charAt(0))) { - addMessage("MSG_WARN_METHOD_NAME_INVALID", new String[] { beanName }); - break; - } - else - underScoreIndex = tempName.indexOf(UNDERSCORE); - } - } - - private void checkPackageName(String packageName, String beanName) - { - if (!packageName.equals(packageName.toLowerCase())) - addMessage("MSG_WARN_PACKAGE_NAME_HAS_UPPER_CASE", new String[] { packageName, beanName }); - } - } diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsMethodVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsMethodVisitorAction.java deleted file mode 100644 index 53f249b34..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsMethodVisitorAction.java +++ /dev/null @@ -1,115 +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.codegen.javamofvisitoractions; - -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofParameterVisitor; - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a BeanElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk the methods in the JavaClass -* */ -public class DetectNonJavaCharsMethodVisitorAction extends VisitorActionImpl -{ - private static char UNDERSCORE = '_'; - private boolean serviceBean = false; - - public DetectNonJavaCharsMethodVisitorAction ( Vector messages, Vector beans) - { - super (messages, beans); - if ( beans.size() == 1) - serviceBean = true; - } - - /** - * Create a method element from the method - * @param Method the class to be used to create the method - **/ - public IStatus visit (Object imethod) - { - - Method method = (Method)imethod; - String className = method.getContainingJavaClass().getName(); - String name = method.getName(); - - if ( serviceBean && !method.isConstructor() ) - checkUpperCase(name, className); - - // for service bean or any referenced bean property accessors - if ( serviceBean || name.startsWith("get") || name.startsWith("set") || name.startsWith("is")) - { - checkUnderScore(name, className); - checkNumericDigits(name, className); - checkBooleanProperties(method, className); - - DetectNonJavaCharsParameterVisitorAction parameterVisitorAction = new DetectNonJavaCharsParameterVisitorAction(getMessages(), getBeansVisited()); - // rsk Passing in null for the environment. DetectNonJavaCharsParameterVisitorAction always returns an OK status. - JavaMofParameterVisitor parameterVisitor = new JavaMofParameterVisitor(null); - parameterVisitor.run(method, parameterVisitorAction); - } - - return Status.OK_STATUS; - } - - private void checkUpperCase(String name, String className) - { - // in a service bean check if any method starts with upper case letter - if ( Character.isUpperCase(name.charAt(0))) - addMessage("MSG_WARN_JAVA_METHOD_START_WITH_UPPER_CASE", new String[]{name, className}); - - } - - private void checkUnderScore(String name, String className) - { - //check if the name has an underscore, then next letter should be upper case - int underScoreIndex = name.indexOf(UNDERSCORE); - String tempName = name; - while(underScoreIndex !=-1) { - tempName = tempName.substring(underScoreIndex+1); - if ( Character.isLowerCase(tempName.charAt(0))) { - addMessage("MSG_WARN_METHOD_NAME_INVALID", new String[]{name, className}); - break; - } - else - underScoreIndex = tempName.indexOf(UNDERSCORE); - } - } - - private void checkNumericDigits(String name, String className) - { - //check if the name has a numeric, then next letter should be upper case - for ( int i = 0; i < name.length(); i++) - { - if ( Character.isDigit(name.charAt(i))) - { - if (Character.isLowerCase(name.charAt(i+1))) { - addMessage("MSG_WARN_METHOD_NAME_INVALID", new String[]{name, className}); - break; - } - } - } - } - private void checkBooleanProperties(Method method, String className) - { - if (!serviceBean && method.getName().startsWith("get") && - (method.getReturnType().getName().equals("boolean") || - method.getReturnType().getName().equals("java.lang.Boolean"))) - addMessage("MSG_WARN_BOOLEAN_PROPERTY_ACCESSORS", new String[]{method.getName(), className}); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsParameterVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsParameterVisitorAction.java deleted file mode 100644 index 680c07964..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsParameterVisitorAction.java +++ /dev/null @@ -1,86 +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.codegen.javamofvisitoractions; - -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.ArrayType; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofBeanVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; - - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a BeanElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk the methods in the JavaClass -* */ -public class DetectNonJavaCharsParameterVisitorAction extends VisitorActionImpl -{ - - public DetectNonJavaCharsParameterVisitorAction ( Vector messages, Vector beans) - { - super (messages, beans); - } - - /** - * Create a method element from the method - * @param Method the class to be used to create the method - **/ - public IStatus visit (Object ijavaParameter) - { - - JavaParameter javaParameter = (JavaParameter) ijavaParameter; - JavaClass javaClass = null; - if ( javaParameter.getJavaType() instanceof JavaClass) - { - javaClass = (JavaClass) javaParameter.getJavaType(); - if (javaClass.isArray()) - { - JavaHelpers componentType = ((ArrayType)javaClass).getComponentTypeAsHelper(); - if (componentType instanceof JavaClass) - { - javaClass = (JavaClass)componentType; - } - else - { - javaClass = null; //The array contains primitive types, there is no need for further checking. - } - } - } - if (toBeVisited(javaClass)) { - DetectNonJavaCharsBeanVisitorAction beanVisitorAction = new DetectNonJavaCharsBeanVisitorAction(getMessages(), getBeansVisited()); - JavaMofBeanVisitor beanVisitor = new JavaMofBeanVisitor(); - beanVisitor.run(javaClass,beanVisitorAction); - } - - return Status.OK_STATUS; - } - - - private boolean toBeVisited (JavaClass javaClass) - { - //check for recognized types - if( javaClass == null || - javaClass.isPrimitive() || - javaClass.getJavaName().startsWith("javax") || - TypeFactory.recognizedBean(javaClass.getJavaName())) - return false; - else - return true; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofAttributeVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofAttributeVisitorAction.java deleted file mode 100644 index 2fad331e5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofAttributeVisitorAction.java +++ /dev/null @@ -1,144 +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.codegen.javamofvisitoractions; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofTypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.jst.ws.internal.consumption.sampleapp.common.SamplePropertyDescriptor; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusException; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a AttributeElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk a complex type -* */ -public class JavaMofAttributeVisitorAction extends JavaMofBeanVisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private MessageUtils msgUtils_; - - /* - *Constructor - **/ - public JavaMofAttributeVisitorAction(Element parentElement, String project, Environment env) - { - super(parentElement,project, env); - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Create a type element from the JavaHelper - * @param JavaParameter the mof element to be used to create the attribute - **/ - - - //bean info code - - - public IStatus visit (Object propertyDecorator) - { - IStatus status = Status.OK_STATUS; - - //PropertyDecorator pd = (PropertyDecorator)propertyDecorator; - SamplePropertyDescriptor pd = (SamplePropertyDescriptor)propertyDecorator; - - - try{ - //if the type of this attribute is unsupported dont make an Attribute - if(!(getReturnParam() && TypeFactory.isRecognizedReturnType((JavaHelpers)pd.getPropertyType())) - && (TypeFactory.isUnSupportedType((JavaHelpers)pd.getPropertyType()))){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_TYPE") + ((JavaHelpers)pd.getPropertyType()).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_TYPE") + ((JavaHelpers)pd.getPropertyType()).getJavaName(),null)); - return status; - } - - Method setMethod = pd.getWriteMethod(); - Method getMethod = pd.getReadMethod(); - if(setMethod != null){ - if(setMethod.isStatic()){ - setMethod=null; - } - } - if(getMethod != null){ - if(getMethod.isStatic()){ - getMethod=null; - } - } - if(pd.isfStatic()){ - return status; - } - - AttributeElement attributeElement = (AttributeElement)BeanModelElementsFactory.getBeanModelElement(propertyDecorator,fParentElement); - - if(attributeElement != null){ - - //lets check and see if the getter takes input params - //if so throw an error - //now the inputs - if(getMethod != null){ - JavaParameter javaParameter[] = getMethod.listParametersWithoutReturn(); - if(javaParameter.length > 0){ - if(getReturnParam()) return status; - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_INDEXED_PROPERTIES") + getMethod.getName() ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_INDEXED_PROPERTIES" ) + getMethod.getName(),null)); - return status; - } - } - if(setMethod != null) attributeElement.setSetterMethod(setMethod.getMethodElementSignature()); - if(getMethod != null) attributeElement.setGetterMethod(getMethod.getMethodElementSignature()); - - JavaMofTypeVisitorAction typeVisitorAction = new JavaMofTypeVisitorAction(attributeElement,clientProject, env_); - typeVisitorAction.setStatusMonitor(getStatusMonitor()); - typeVisitorAction.setBeansCreated(getBeansCreated()); - typeVisitorAction.setReturnParam(getReturnParam()); - JavaMofTypeVisitor typeVisitor = new JavaMofTypeVisitor(env_); - typeVisitor.setClientProject(getProject()); - status = typeVisitor.run(pd,typeVisitorAction); - - } - - return status; - }catch(Exception e) - { - env_.getLog().log(Log.WARNING, 5054, this, "visit", e); - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_ERROR_JTS_JSP_GEN"), e); - try { - env_.getStatusHandler().report(status); - } catch (StatusException e1) { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_JTS_JSP_GEN") ); - } - return status; - } - //env.Log.write(this,"visit",Log.OK,e);} - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofBeanVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofBeanVisitorAction.java deleted file mode 100644 index 73870ebac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofBeanVisitorAction.java +++ /dev/null @@ -1,436 +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.codegen.javamofvisitoractions; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.command.NullStatusMonitor; -import org.eclipse.jst.ws.internal.command.StatusMonitor; -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.javamofvisitors.JavaMofAttributeVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofFieldVisitor; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofMethodVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.ws.internal.datamodel.Element; -import org.eclipse.wst.ws.internal.datamodel.Model; - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a BeanElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk the methods in the JavaClass -* */ -public class JavaMofBeanVisitorAction implements VisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private MessageUtils msgUtils_; - protected Environment env_; - // protected BeanElement fBeanElement; - - protected Visitor fVisitor; - - /* - * The project that defines the context - **/ - protected String clientProject; - - /* - * The Status monitor - **/ - protected StatusMonitor monitor_; - - /* - * The model that will be created - **/ - protected Model fModel; - - /* - * This is the parent element used when creating a - * new element - */ - protected Element fParentElement; - - /* - * Methods processed from proxy - */ - protected Vector fBeansCreated; - - private BooleanSelection[] fMethodsSelected; - - /* - * this boolean tells wether the bean is a return parameter or an input parameter - * usually this should be set around the parametervisitoraction, and passed on from there - */ - protected boolean fReturnParam=false; - - public JavaMofBeanVisitorAction(String clientProject,BooleanSelection[] methods, Environment env) - { - this.clientProject = clientProject; - fMethodsSelected = methods; - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - env_ = env; - } - - - - /* - *Constructor - * @param Model model is the Model that this bean will be placed in - * @param IProject used in nature - **/ - public JavaMofBeanVisitorAction(Model model, String clientProject, Environment env) - { - this.clientProject = clientProject; - fModel = model; - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - env_ = env; - } - - /* - *Constructor - * @param Element the parent element that this element will be added too - * @param IProject used in nature - **/ - public JavaMofBeanVisitorAction(Element parentElement, String clientProject, Environment env ) - { - fParentElement = parentElement; - this.clientProject = clientProject; - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - env_ = env; - } - - /** - * The visit will create the bean - * Walk the methods - * @param JavaClass the class to be used to create the bean model - **/ - public IStatus visit (Object javaclass) - { - Choice OKChoice = new Choice('O', msgUtils_.getMessage("LABEL_OK"), msgUtils_.getMessage("DESCRIPTION_OK")); - Choice CancelChoice = new Choice('C', msgUtils_.getMessage("LABEL_CANCEL"), msgUtils_.getMessage("DESCRIPTION_CANCEL")); - IStatus status = Status.OK_STATUS; - JavaClass javaClass = (JavaClass)javaclass; - - - BeanElement beanElement = (BeanElement)BeanModelElementsFactory.getBeanModelElement(javaClass,fParentElement,fModel); - if(beanElement.isOwnerParameter()) { - resetBeansCreated(); - } - fModel = beanElement.getModel(); - - //this for the subsequent beans that represent types - //first do the attributes - //if we are not on the root - if (!(beanElement == fModel.getRootElement())){ - Enumeration e = getBeansCreated().elements(); - while(e.hasMoreElements()){ - String name = (String)e.nextElement(); - if(name.equals(javaClass.getName())){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_ERROR_JTS_CYCLIC_BEAN" ) ); - //getStatusMonitor().reportStatus(new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //WebServiceConsumptionPlugin.getMessage( "%MSG_ERROR_JTS_CYCLIC_BEAN" ),null)); - return status; - } - } - - JavaMofAttributeVisitorAction attributeVisitorAction = new JavaMofAttributeVisitorAction(beanElement,clientProject, env_); - //attributeVisitorAction.setStatusMonitor(getStatusMonitor()); - Vector childVector = ((Vector)getBeansCreated().clone()); - childVector.addElement(javaClass.getName()); - attributeVisitorAction.setBeansCreated(childVector); - attributeVisitorAction.setReturnParam(getReturnParam()); - JavaMofAttributeVisitor attributeVisitor = new JavaMofAttributeVisitor(); - attributeVisitor.setReturnParameter(getReturnParam()); - attributeVisitor.setProject(getProject()); - attributeVisitor.setEnvironment(env_); - status = attributeVisitor.run(javaClass,attributeVisitorAction); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - - JavaMofFieldVisitorAction fieldVisitorAction = new JavaMofFieldVisitorAction(beanElement,clientProject, env_); - //fieldVisitorAction.setStatusMonitor(getStatusMonitor()); - Vector childVector2 = ((Vector)getBeansCreated().clone()); - childVector2.addElement(javaClass.getName()); - fieldVisitorAction.setBeansCreated(childVector2); - fieldVisitorAction.setReturnParam(getReturnParam()); - JavaMofFieldVisitor fieldVisitor = new JavaMofFieldVisitor(); - fieldVisitor.setProject(getProject()); - status = fieldVisitor.run(javaClass,fieldVisitorAction); - // - severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - - } - - //this is to insure we are on the proxy - //now do the methods - if (beanElement == fModel.getRootElement()){ - //first lets make sure the proxy is in good form - //-it has a default constructor - //-it has at least one method - //otherwise return the problem in the form of a status - - if (!proxyCheck(javaClass, status)) return status; - JavaMofMethodVisitorAction methodVisitorAction = new JavaMofMethodVisitorAction(beanElement,clientProject, env_); - - //methodVisitorAction.setStatusMonitor(getStatusMonitor()); - JavaMofMethodVisitor methodVisitor = new JavaMofMethodVisitor(); - methodVisitor.setMethodSelection(fMethodsSelected); - status = methodVisitor.run(javaClass,methodVisitorAction); - - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - //This is where we check for several things: - //-if no methods were processed because of unsupported types then we send back that result - //-if there were any methods omitted we should warn them - - //first no methods - if (!methodVisitorAction.wereMethodsProcessed()){ - //this has to be done to insure the dialog is an error - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_JTS_NO_PROXY_METHODS_PROCESSED") ); - return status; - //getStatusMonitor().reportStatus( new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_ERROR_JTS_NO_PROXY_METHODS_PROCESSED" ),null)); - } - //now methods omitted - else if(methodVisitorAction.wereMethodsOmitted()){ - //The dialog is already a warning so we just need to set the overall message - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_PROXY_METHODS_OMITTED") ); - return status; - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_PROXY_METHODS_OMITTED" ),null)); - } - } - return status; - } - - public void initialize(String resident) - { - //nothing to be done but must be implemented - } - - - /* - * Return the model that was created - * @return Model the bean model that was created - */ - public Model getModel() - { - return fModel; - } - - /* - * The proxy check insures there is a default constructor and - * at Least one method - * @param JavaClass javaClass is used to traverse the methods on the proxy - */ - public boolean proxyCheck(JavaClass javaClass, IStatus status) - { - // first check for a method - Iterator m=javaClass.getPublicMethods().iterator(); - if (!m.hasNext()){ - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_JTS_PROXY_HAS_NO_METHODS") ); - //getStatusMonitor().reportStatus( new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_ERROR_JTS_PROXY_HAS_NO_METHODS" ),null)); - return false; - } - //now check for a default constructor - while (m.hasNext()) { - Method method=(Method)m.next(); - if (javaClass.getName().equals(method.getName())){ - //now the inputs - JavaParameter javaParameter[] = method.listParametersWithoutReturn(); - if (javaParameter.length > 0){ - //then we have no default constructor - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_JTS_PROXY_HAS_NO_DEFAULT") ); - //getStatusMonitor().reportStatus( new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0, - //WebServiceConsumptionPlugin.getMessage( "%MSG_ERROR_JTS_PROXY_HAS_NO_DEFAULT" ),null)); - return false; - } - } - } - return true; - - } - - /** - * Sets the status monitor that this action will use to report status that occres while executing the Action. - */ - public void setStatusMonitor ( StatusMonitor monitor ) - { - monitor_ = monitor; - } - - /** - * Returns the status monitor that this task is using to report status. - */ - public StatusMonitor getStatusMonitor () - { - if (monitor_ == null) - { - monitor_ = new NullStatusMonitor(); - } - return monitor_; - } - - - /** - * check if the action has finished sucsessfully - */ - /* - public boolean isSuccessful () - { - return getStatusMonitor().canContinue(); - } - */ - public void resetBeansCreated() - { - fBeansCreated = new Vector(); - } - - public void setEnvironment(Environment env) - { - env_ = env; - } - - /* - * The command that called this will get the results of the operation in the form - * of a status. - */ - public Vector getBeansCreated () - { - if(fBeansCreated == null) fBeansCreated = new Vector(); - return fBeansCreated; - } - - /* - * The command that called this will get the results of the operation in the form - * of a status. - */ - public void setBeansCreated (Vector beansCreated) - { - fBeansCreated = beansCreated; - } - - /* - * This boolean tells wether we are dealing with a return param - */ - public boolean getReturnParam () - { - return fReturnParam; - } - - /* - * This boolean tells wether we are dealing with a return param - */ - public void setReturnParam (boolean returnparam) - { - fReturnParam = returnparam; - } - - /* - * This boolean tells wether we are dealing with a return param - */ - public String getProject () - { - return clientProject; - } - - /* - * This boolean tells wether we are dealing with a return param - */ - public void setProject (String clientProject) - { - this.clientProject = clientProject; - } - - - /** - * sets the visitor that calls the visit - * @parameter Visitor - */ - - public void setVisitor(Visitor visitor) - { - fVisitor = visitor; - } - - /* - * Sets the parent element the child then knows where to - * add itself to the model - * @param Element parent element - */ - public void setParentElement(Element element) - { - fParentElement = element; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofFieldVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofFieldVisitorAction.java deleted file mode 100644 index aae2f8f5b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofFieldVisitorAction.java +++ /dev/null @@ -1,113 +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.codegen.javamofvisitoractions; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.Field; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofTypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.FieldElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusException; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a AttributeElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk a complex type -* */ -public class JavaMofFieldVisitorAction extends JavaMofBeanVisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private MessageUtils msgUtils_; - - - /* - *Constructor - **/ - public JavaMofFieldVisitorAction(Element parentElement, String project, Environment env) - { - super(parentElement,project, env); - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Create a type element from the JavaHelper - * @param JavaParameter the mof element to be used to create the attribute - **/ - - - //bean info code - - - public IStatus visit (Object field_) - { - IStatus status = Status.OK_STATUS; - Field field = (Field)field_; - - try{ - //if the type of this attribute is unsupported dont make an Attribute - if(!(getReturnParam() && TypeFactory.isRecognizedReturnType((JavaHelpers)field.getJavaClass())) - && (TypeFactory.isUnSupportedType((JavaHelpers)field.getJavaClass()))){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_TYPE") + ((JavaHelpers)field.getJavaClass()).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_TYPE") + ((JavaHelpers)field.getJavaClass()).getJavaName(),null)); - return status; - } - - - FieldElement fieldElement = (FieldElement)BeanModelElementsFactory.getBeanModelElement(field,fParentElement); - - if(fieldElement != null){ - //lets check and see if the getter takes input params - //if so throw an error - //now the inputs - - JavaMofTypeVisitorAction typeVisitorAction = new JavaMofTypeVisitorAction(fieldElement,clientProject, env_); - typeVisitorAction.setStatusMonitor(getStatusMonitor()); - typeVisitorAction.setBeansCreated(getBeansCreated()); - typeVisitorAction.setReturnParam(getReturnParam()); - JavaMofTypeVisitor typeVisitor = new JavaMofTypeVisitor(env_); - typeVisitor.setClientProject(getProject()); - status = typeVisitor.run(field,typeVisitorAction); - - } - return status; - - }catch(Exception e) - { - env_.getLog().log(Log.WARNING, 5055, this, "visit", e); - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_ERROR_JTS_JSP_GEN"), e); - try { - env_.getStatusHandler().report(status); - } - catch (StatusException e1) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_JTS_JSP_GEN"), e1 ); - } - return status; - } - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofMethodVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofMethodVisitorAction.java deleted file mode 100644 index d1a9860f3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofMethodVisitorAction.java +++ /dev/null @@ -1,224 +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.codegen.javamofvisitoractions; - -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofParameterVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.MethodElement; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.datamodel.Element; - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a BeanElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk the methods in the JavaClass -* */ -public class JavaMofMethodVisitorAction extends JavaMofBeanVisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private MessageUtils msgUtils_; - public String fUnsupportedParameterName; - - /* - * Methods omitted from the proxy - */ - protected Vector fMethodsOmitted; - - /* - * Methods processed from proxy - */ - protected Vector fMethodsProcessed; - - - /* - *Constructor - **/ - public JavaMofMethodVisitorAction(Element parentElement,String project, Environment env) - { - super(parentElement,project, env); - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - fMethodsOmitted = new Vector(); - fMethodsProcessed = new Vector(); - - } - - /** - * Create a method element from the method - * @param Method the class to be used to create the method - **/ - public IStatus visit (Object imethod) - { - IStatus status = Status.OK_STATUS; - Method method = (Method)imethod; - - if (methodCheck(method)){ - //this is to check immediate input and return parameters - //if there is an unsupported type in these we can react immediately - //we add it to the omitted methods an go to the next one - if(!parameterCheck(method)){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS") + fUnsupportedParameterName ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS" ) + fUnsupportedParameterName,null)); - fMethodsOmitted.addElement(method.getMethodElementSignature()); - return status; - } - if(!nullConstructor(method)){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_INPUTS") + fUnsupportedParameterName ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_INPUTS" ) + fUnsupportedParameterName,null)); - fMethodsOmitted.addElement(method.getMethodElementSignature()); - return status; - - } - - //carry on all parameters supported - MethodElement methodElement = (MethodElement)BeanModelElementsFactory.getBeanModelElement(method,fParentElement); - JavaMofParameterVisitorAction parameterVisitorAction = new JavaMofParameterVisitorAction(methodElement,clientProject,env_); - parameterVisitorAction.setStatusMonitor(getStatusMonitor()); - JavaMofParameterVisitor parameterVisitor = new JavaMofParameterVisitor(env_); - status = parameterVisitor.run(method,parameterVisitorAction); - //something may have gone wrong with an internal type - if (status.getSeverity()!=Status.OK){ - //This method has to be omitted - fMethodsOmitted.addElement(method.getMethodElementSignature()); - methodElement.setMethodOmmission(true); - } - else { - fMethodsProcessed.addElement(method.getMethodElementSignature()); - } - } - - return status; - } - - /* - * Tells wether any methods were processed - * @return boolean true if any methods were processed - */ - public boolean wereMethodsProcessed() - { - if(fMethodsProcessed.isEmpty()) return false; - return true; - } - - /* - * Tells wether there were methods omitted because of unsupported types - * @return boolean true if methods were omitted - */ - public boolean wereMethodsOmitted() - { - if(fMethodsOmitted.isEmpty()) return false; - return true; - } - - /** - * There may be methods that we dont support - * and dont want in the model - * @param boolean true if all parameters are fine - **/ - public boolean methodCheck(Method method) - { - boolean ok = true; - // if we have a constructor we return false - if (method.isConstructor()) return false; - - - return ok; - } - - /** - * There may be parameters of this method that have types - * not yet supported return false if we find any - * @param boolean true if all parameters are fine - **/ - public boolean parameterCheck(Method method) - { - - boolean ok = true; - - //now the inputs - JavaParameter javaParameter[] = method.listParametersWithoutReturn(); - for (int i = 0;i<javaParameter.length;i++) { - JavaParameter param=javaParameter[i]; - JavaHelpers javaHelper1 = param.getJavaType(); - if(TypeFactory.isUnSupportedType(javaHelper1)) { - fUnsupportedParameterName = param.getName(); - return false; - } - } - return ok; - } - - - /** - * There may be parameters of this method that have types - * not yet supported return false if we find any - * @param boolean true if all parameters are fine - **/ - public boolean nullConstructor(Method method) - { - - boolean ok = true; - //now the inputs - JavaParameter javaParameter[] = method.listParametersWithoutReturn(); - for (int i = 0;i<javaParameter.length;i++) { - JavaParameter param=javaParameter[i]; - JavaHelpers javaHelper1 = param.getJavaType(); - if(javaHelper1 instanceof JavaClass){ - JavaClass javaClass = (JavaClass)javaHelper1; - if(TypeFactory.recognizedBean(javaClass.getJavaName()))return true; - Iterator m=javaClass.getMethods().iterator(); - while (m.hasNext()) { - Method method2=(Method)m.next(); - if (javaClass.getName().equals(method2.getName())){ - //now the inputs - JavaParameter javaParam[] = method2.listParametersWithoutReturn(); - if (javaParam.length > 0){ - //then we have no default constructor - fUnsupportedParameterName = param.getName(); - ok = false; - } - else return true; - } - } - } - } - return ok; - } - - - - - - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofParameterVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofParameterVisitorAction.java deleted file mode 100644 index c13418f4f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofParameterVisitorAction.java +++ /dev/null @@ -1,85 +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.codegen.javamofvisitoractions; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofTypeVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.ParameterElement; -import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.datamodel.Element; - - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a parameterElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk to its type -* */ -public class JavaMofParameterVisitorAction extends JavaMofBeanVisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private MessageUtils msgUtils_; - - /* - *Constructor - **/ - public JavaMofParameterVisitorAction(Element parentElement,String project, Environment env) - { - super(parentElement,project, env); - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Create a parameter element from the method - * @param JavaParameter the mof element to be used to create the Parameter - **/ - public IStatus visit (Object ijavaParameter) - { - IStatus status = Status.OK_STATUS; - Choice OKChoice = new Choice('O', msgUtils_.getMessage("LABEL_OK"), msgUtils_.getMessage("DESCRIPTION_OK")); - Choice CancelChoice = new Choice('C', msgUtils_.getMessage("LABEL_CANCEL"), msgUtils_.getMessage("DESCRIPTION_CANCEL")); - - ParameterElement parameterElement = (ParameterElement)BeanModelElementsFactory.getBeanModelElement(ijavaParameter,fParentElement); - JavaMofTypeVisitorAction typeVisitorAction = new JavaMofTypeVisitorAction(parameterElement,clientProject, env_); - //typeVisitorAction.setStatusMonitor(getStatusMonitor()); - typeVisitorAction.setReturnParam(parameterElement.isReturn()); - JavaMofTypeVisitor typeVisitor = new JavaMofTypeVisitor(env_); - typeVisitor.setClientProject(getProject()); - status = typeVisitor.run(ijavaParameter,typeVisitorAction); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofTypeVisitorAction.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofTypeVisitorAction.java deleted file mode 100644 index fedc99d49..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofTypeVisitorAction.java +++ /dev/null @@ -1,120 +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.codegen.javamofvisitoractions; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofBeanVisitor; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.BeanModelElementsFactory; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.datamodel.Element; - - - - -/** -* Objects of this class represent a JavaMofBeanVisitorAction. -* This VisitorAction will create a TypeElement using the -* JavaClass and the BeanModelElementsFactory -* It will also automatically walk a complex type -* */ -public class JavaMofTypeVisitorAction extends JavaMofBeanVisitorAction -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private MessageUtils msgUtils_; - - /* - *Constructor - **/ - public JavaMofTypeVisitorAction(Element parentElement,String project, Environment env) - { - super(parentElement,project, env); - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Create a type element from the JavaHelper - * @param JavaHelper the mof element to be used to create the Type - **/ - public IStatus visit (Object typeNavigator) - { - IStatus status = Status.OK_STATUS; - Choice OKChoice = new Choice('O', msgUtils_.getMessage("LABEL_OK"), msgUtils_.getMessage("DESCRIPTION_OK")); - Choice CancelChoice = new Choice('C', msgUtils_.getMessage("LABEL_CANCEL"), msgUtils_.getMessage("DESCRIPTION_CANCEL")); - - //if bean - JavaClass javaClass = null; - if(typeNavigator instanceof JavaClass){ - javaClass = (JavaClass)typeNavigator; - } - - - /* If we are dealing with a return parameter then we need to treat this differently then if it is an input - * parameter. - * We need to first see if it is a special case for return types if not we treat it the same as everything - * else. - */ - if(getReturnParam() && TypeFactory.isRecognizedReturnType((JavaHelpers)typeNavigator)) - { - BeanModelElementsFactory.getBeanModelElement(typeNavigator,fParentElement); - } - else{ - if(TypeFactory.isUnSupportedType((JavaHelpers)typeNavigator)){ - status = StatusUtils.warningStatus( msgUtils_.getMessage("MSG_WARN_JTS_UNSUPPORTED_TYPE") + ((JavaHelpers)typeNavigator).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //WebServiceConsumptionPlugin.getMessage( "%MSG_WARN_JTS_UNSUPPORTED_TYPE" ) + ((JavaHelpers)typeNavigator).getJavaName(),null)); - return status; - } - - //if javaclass is null then we have a simple type - if((javaClass == null) || TypeFactory.recognizedBean(javaClass.getJavaName())) - { - BeanModelElementsFactory.getBeanModelElement(typeNavigator,fParentElement); - } - else{ - JavaMofBeanVisitorAction beanVisitorAction = new JavaMofBeanVisitorAction(fParentElement,clientProject, env_); - beanVisitorAction.setStatusMonitor(getStatusMonitor()); - beanVisitorAction.setBeansCreated(getBeansCreated()); - beanVisitorAction.setReturnParam(getReturnParam()); - JavaMofBeanVisitor beanVisitor = new JavaMofBeanVisitor(); - status = beanVisitor.run(javaClass,beanVisitorAction); - } - } - - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/VisitorActionImpl.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/VisitorActionImpl.java deleted file mode 100644 index ff80e0152..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/VisitorActionImpl.java +++ /dev/null @@ -1,95 +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.codegen.javamofvisitoractions; - -import java.util.Vector; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.ws.internal.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - - - - - -/** -* Objects of this class represent a VisitorAction. -* It will automatically walk the methods in the JavaClass -* */ -public abstract class VisitorActionImpl implements VisitorAction -{ - - private Vector beansVisited = null; - private Vector messages = null; - private MessageUtils msgUtils_; - - public VisitorActionImpl( Vector messages, Vector beansVisited) - { - this.messages = messages; - this.beansVisited = beansVisited; - msgUtils_ = new MessageUtils( "org.eclipse.jst.ws.consumption.plugin", this ); - } - - public void initialize(String resident) - { - //nothing to be done but must be implemented - } - - /** - * Returns the vector of all messages found - */ - public Vector getMessages () - { - if (messages == null) - messages = new Vector(); - return messages; - } - - public Vector getBeansVisited() - { - if ( beansVisited == null) - beansVisited = new Vector(); - return beansVisited; - } - - public void addVisitedBean( JavaClass bean) - { - if ( beansVisited == null) - beansVisited = new Vector(); - beansVisited.add(bean); - } - - public boolean isBeanVisited (JavaClass bean) - { - return (beansVisited != null && beansVisited.contains(bean)); - } - - /** - * sets the visitor that calls the visit - * @parameter Visitor - */ - - public void setVisitor(Visitor visitor) - { - } - - protected void addMessage ( String key ) - { - getMessages().add(msgUtils_.getMessage(key)); - } - - protected void addMessage ( String key, Object[] args ) - { - getMessages().add(msgUtils_.getMessage(key,args)); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofAttributeVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofAttributeVisitor.java deleted file mode 100644 index 9e25699e0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofAttributeVisitor.java +++ /dev/null @@ -1,216 +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.codegen.javamofvisitors; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Iterator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jem.java.impl.FieldImpl; -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.command.common.JavaMofReflectionCommand; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; -import org.eclipse.jst.ws.internal.consumption.sampleapp.common.SamplePropertyDescriptor; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofAttributeVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private String clientProject; - private boolean returnParameter; - private Environment env; - - - public void setEnvironment(Environment env) - { - this.env = env; - } - - /* - * Use this to reflect - */ - public void setProject(String clientProject) - { - this.clientProject = clientProject; - } - - /* - * Use this to reflect - */ - public String getProject() - { - return clientProject; - } - - public void setReturnParameter(boolean returnParameter) - { - this.returnParameter = returnParameter; - } - - - /* - * Get the attribute belonging to this complex type - * @param JavaParameter javaParameter that owns the type - * @param VisitorAction Action to be performed on each method - **/ - public IStatus run ( Object javaclass, VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - JavaClass javaClass = (JavaClass)javaclass; - - Hashtable spdMap = new Hashtable(); - for (Iterator m=javaClass.getPublicMethods().iterator(); m.hasNext(); ) { - Method method=(Method)m.next(); - if (((method.getMethodElementSignature().startsWith("get") - || method.getMethodElementSignature().startsWith("is")) - && method.listParametersWithoutReturn().length == 0 ) - || (method.getMethodElementSignature().startsWith("set") - && method.listParametersWithoutReturn().length > 0)) { - int sub = 3; - if(method.getMethodElementSignature().startsWith("is")) - sub = 2; - String propertyName = method.getMethodElementSignature().substring(sub); - String lower = propertyName.substring(0,1).toLowerCase(); - String remainder = propertyName.substring(1); - propertyName = lower + remainder; - int index = propertyName.lastIndexOf("("); - String temp = propertyName; - propertyName = temp.substring(0,index); - - //find the propertydescriptor - SamplePropertyDescriptor spd = (SamplePropertyDescriptor)spdMap.get(propertyName); - if(spd == null){ - spd = new SamplePropertyDescriptor(propertyName); - spdMap.put(propertyName,spd); - } - if(method.getMethodElementSignature().startsWith("set")) - spd.setWriteMethod(method); - else - spd.setReadMethod(method); - - FieldImpl field = (FieldImpl)javaClass.getFieldNamed(propertyName); - JavaHelpers propertyType = null; - if(field != null){ - propertyType = field.getJavaType(); - spd.setfStatic(field.isStatic()); - } - else{ - if(method.getMethodElementSignature().startsWith("get") || method.getMethodElementSignature().startsWith("is")) - propertyType = method.getReturnType(); - else{ - JavaParameter params[] = method.listParametersWithoutReturn(); - propertyType = params[0].getJavaType(); - } - } - - spd.setPropertyType(propertyType); - - } - } - Enumeration spdEnum = spdMap.elements(); - while(spdEnum.hasMoreElements()){ - SamplePropertyDescriptor spd = (SamplePropertyDescriptor)spdEnum.nextElement(); - if(spdCheck(spd)) - status = vAction.visit(spd); - } - - return status; - - } - - private boolean spdCheck(SamplePropertyDescriptor spd) - { - //check for indexed properties - Method writeMethod = spd.getWriteMethod(); - if(writeMethod != null) - if(writeMethod.listParametersWithoutReturn().length > 1) return false; - - if(spd.getPropertyType() == null) return false; - if(spd.getPropertyType().isPrimitive()) return true; - if(returnParameter && TypeFactory.isRecognizedReturnType(spd.getPropertyType())) return true; - if(!returnParameter && TypeFactory.isUnSupportedType(spd.getPropertyType())) return true; - if(!checkPolarity(spd)) return false; - - // so its a bean make sure it has a default constructor - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setClientProject(getProject()); - javaMofRef.setProxyBean(((JavaHelpers)spd.getPropertyType()).getQualifiedName()); - javaMofRef.setEnvironment( env ); - javaMofRef.execute(null, null); - if(javaMofRef.getJavaClass() instanceof JavaClass){ - if(TypeFactory.recognizedBean(javaMofRef.getJavaClass().getJavaName())) return true; - return defaultCheck((JavaClass)javaMofRef.getJavaClass()); - - } - return true; - - } - - private boolean checkPolarity(SamplePropertyDescriptor spd){ - - Method readMethod = spd.getReadMethod(); - Method writeMethod = spd.getWriteMethod(); - if((readMethod == null && writeMethod != null) || (readMethod != null && writeMethod == null)) - return true; - if(readMethod == null && writeMethod == null) - return false; - - JavaParameter javaParameter[] = writeMethod.listParametersWithoutReturn(); - for(int i = 0;i< javaParameter.length;i++){ - JavaParameter jp = javaParameter[i]; - jp.getJavaType().getJavaName(); - readMethod.getReturnType().getJavaName(); - if(jp.getJavaType().getJavaName().equals(readMethod.getReturnType().getJavaName())) - return true; - } - return false; - } - - private boolean defaultCheck(JavaClass javaClass){ - - Iterator m=javaClass.getMethods().iterator(); - //now check for a default constructor - boolean defaultConst = true; - while (m.hasNext()) { - Method method=(Method)m.next(); - if (javaClass.getName().equals(method.getName())){ - //now the inputs - JavaParameter javaParameter[] = method.listParametersWithoutReturn(); - if (javaParameter.length > 0){ - //then we have no default constructor - defaultConst = false; - } - else if(javaParameter.length == 0){ - if (method.getJavaVisibility().getValue() == 0) - return true; - } - } - } - - return defaultConst; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofBeanVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofBeanVisitor.java deleted file mode 100644 index 2b571f830..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofBeanVisitor.java +++ /dev/null @@ -1,45 +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.codegen.javamofvisitors; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.ws.internal.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; - - - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofBeanVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /* - *Constructor - **/ - public JavaMofBeanVisitor() - { - } - - public IStatus run ( Object javaClass, VisitorAction vAction) - { - return vAction.visit((JavaClass)javaClass); - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofFieldVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofFieldVisitor.java deleted file mode 100644 index b79e238ea..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofFieldVisitor.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.codegen.javamofvisitors; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jem.java.Field; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaVisibilityKind; -import org.eclipse.jem.java.Method; -import org.eclipse.jem.java.impl.FieldImpl; -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.command.common.JavaMofReflectionCommand; -import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory; - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofFieldVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private String clientProject; - - /* - * Constructor - **/ - public JavaMofFieldVisitor() - { - } - - /* - * Use this to reflect - */ - public void setProject(String clientProject) - { - this.clientProject = clientProject; - } - - /* - * Use this to reflect - */ - public String getProject() - { - return clientProject; - } - - /* - * Get the attribute belonging to this complex type - * @param JavaParameter javaParameter that owns the type - * @param VisitorAction Action to be performed on each method - **/ - public IStatus run ( Object javaclass, VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - JavaClass javaClass = (JavaClass)javaclass; - - boolean holderClass = false; - EList implemented = javaClass.getImplementsInterfaces(); - for (int i = 0; i < implemented.size(); i++) { - JavaClass anInterface = (JavaClass) implemented.get(i); - if (anInterface.getQualifiedName().equals("javax.xml.rpc.holders.Holder")) - holderClass = true; - } - - //beaninfo code - if(holderClass){ - EList e = javaClass.getFields(); - ListIterator list = e.listIterator(); - while(list.hasNext()){ - Field field = (Field)list.next(); - if(field.getJavaVisibility().getValue() == JavaVisibilityKind.PUBLIC && !field.isFinal() && !field.isStatic()){ - if(fieldCheck((FieldImpl)field)) - status = vAction.visit(field); - } - } - } - - return status; - } - private boolean fieldCheck(FieldImpl field) - { - // so its a bean make sure it has a default constructor - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setProxyBean(field.getJavaType().getQualifiedName()); - javaMofRef.setClientProject(getProject()); - javaMofRef.execute(null, null); - if(javaMofRef.getJavaClass() instanceof JavaClass){ - if(TypeFactory.recognizedBean(javaMofRef.getJavaClass().getJavaName())) return true; - return defaultCheck((JavaClass)javaMofRef.getJavaClass()); - } - return true; - } - - private boolean defaultCheck(JavaClass javaClass){ - - Iterator m=javaClass.getMethods().iterator(); - //now check for a default constructor - boolean defaultConst = true; - while (m.hasNext()) { - Method method=(Method)m.next(); - if (javaClass.getName().equals(method.getName())){ - //now the inputs - JavaParameter javaParameter[] = method.listParametersWithoutReturn(); - if (javaParameter.length > 0){ - //then we have no default constructor - defaultConst = false; - } - else if(javaParameter.length == 0){ - if (method.getJavaVisibility().getValue() == 0) - return true; - else if(method.getJavaVisibility().getValue() == 1) - defaultConst = false; - } - } - } - - return defaultConst; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofMethodVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofMethodVisitor.java deleted file mode 100644 index 756abb953..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofMethodVisitor.java +++ /dev/null @@ -1,84 +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.codegen.javamofvisitors; - -import java.util.Iterator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofMethodVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - public String SET_ENDPOINT = "setEndPoint"; - public String GET_ENDPOINT = "getEndPoint"; - private BooleanSelection[] fMethodsSelected; - - - /* - * Constructor - **/ - public JavaMofMethodVisitor() - { - } - - public String UNDER_SCORE = "_"; - - /* - * Run through all the methods in this bean - * @param JavaClass javaclass that holds the methods - * @param VisitorAction Action to be performed on each method - **/ - public IStatus run ( Object javaclass, VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - JavaClass javaClass = (JavaClass)javaclass; - for (Iterator m=javaClass.getPublicMethods().iterator(); m.hasNext(); ) { - Method method=(Method)m.next(); - if(fMethodsSelected != null) { - boolean methodSelected = false; - for(int i =0;i < fMethodsSelected.length;i++){ - if(fMethodsSelected[i] == null) continue; - if ( fMethodsSelected[i].getValue().equals(method.getMethodElementSignature())) - methodSelected = (boolean) fMethodsSelected[i].isSelected(); - } - - method.getName(); - - if(methodSelected) - status = vAction.visit(method); - - } - else { - status = vAction.visit(method); - } - - } - return status; - } - - public void setMethodSelection(BooleanSelection[] methodSelected) - { - fMethodsSelected = methodSelected; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofParameterVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofParameterVisitor.java deleted file mode 100644 index 3a3e40478..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofParameterVisitor.java +++ /dev/null @@ -1,113 +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.codegen.javamofvisitors; - -import java.util.List; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofParameterVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private MessageUtils msgUtils_; - private Environment env_; - - /* - * Constructor - **/ - public JavaMofParameterVisitor(Environment env) - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - env_ = env; - } - - /* - * Run through all the parameters in this method - * @param JavaClass javaclass that holds the parameters - * @param VisitorAction Action to be performed on each method - **/ - public IStatus run ( Object imethod, VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - Choice OKChoice = new Choice('O', msgUtils_.getMessage("LABEL_OK"), msgUtils_.getMessage("DESCRIPTION_OK")); - Choice CancelChoice = new Choice('C', msgUtils_.getMessage("LABEL_CANCEL"), msgUtils_.getMessage("DESCRIPTION_CANCEL")); - Method method = (Method)imethod; - - JavaHelpers javaReturnParameter = method.getReturnType(); - //pgm This visitor used to take a JavaParameter type and now it is being called - // with a JavaHelpers type. Gil, please ensure that this is Ok. - status = vAction.visit(javaReturnParameter); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - - //now the inputs - List parameters = method.getParameters(); - - for (int index = 0; index < parameters.size(); index++) - { - JavaParameter param=(JavaParameter)parameters.get(index); - status = vAction.visit(param); - // - severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env_.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - } - - return status; - - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofTypeVisitor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofTypeVisitor.java deleted file mode 100644 index 410ff36bd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofTypeVisitor.java +++ /dev/null @@ -1,113 +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.codegen.javamofvisitors; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.Field; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.impl.FieldImpl; -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.command.common.JavaMofReflectionCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.common.SamplePropertyDescriptor; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; - - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofTypeVisitor implements Visitor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private Environment env_; - - private String clientProject; - - /* - * Constructor - **/ - public JavaMofTypeVisitor(Environment env) - { - env_ = env; - } - - /* - * Use this to reflect - */ - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - /* - * Use this to reflect - */ - public String getClientProject() - { - return clientProject; - } - - /* - * Get the type belonging to the parameter - * @param JavaParameter javaParameter that owns the type - * @param VisitorAction Action to be performed on each method - **/ - public IStatus run ( Object typeNavigator, VisitorAction vAction) - { - IStatus status = Status.OK_STATUS; - if (typeNavigator instanceof JavaParameter){ - - JavaParameter javaParameter = (JavaParameter)typeNavigator; - JavaHelpers javaHelpers = javaParameter.getJavaType(); - status = vAction.visit(javaHelpers); - } - else if (typeNavigator instanceof JavaHelpers){ - status = vAction.visit(typeNavigator); - } - else if (typeNavigator instanceof SamplePropertyDescriptor){ - SamplePropertyDescriptor pd = (SamplePropertyDescriptor)typeNavigator; - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setClientProject(clientProject); - javaMofRef.setProxyBean(((JavaHelpers)pd.getPropertyType()).getQualifiedName()); - javaMofRef.setEnvironment( env_ ); - status = javaMofRef.execute( null, null ); - if (status.getSeverity()==Status.ERROR) - return status; - - status = vAction.visit(javaMofRef.getJavaClass()); - } - else if (typeNavigator instanceof Field){ - FieldImpl field = (FieldImpl)typeNavigator; - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setClientProject(clientProject); - javaMofRef.setProxyBean(field.getJavaType().getQualifiedName()); - javaMofRef.setEnvironment( env_ ); - - status = javaMofRef.execute( null, null ); - if (status.getSeverity()==Status.ERROR) - return status; - - status = vAction.visit(javaMofRef.getJavaClass()); - } - - return status; - } - - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AbstractStartServer.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AbstractStartServer.java deleted file mode 100644 index 08ade9fb2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AbstractStartServer.java +++ /dev/null @@ -1,141 +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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.env.eclipse.EclipseLog; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.server.core.IServer; - -public abstract class AbstractStartServer { - -protected IProgressMonitor monitor; -private Log log_; -private MessageUtils msgUtils_; - -public AbstractStartServer() -{ - log_ = new EclipseLog(); - msgUtils_ = new MessageUtils( "org.eclipse.jst.ws.consumption.plugin", this ); -} - -/** - * Execute the command - */ -public void StartServer (IProject project, IServer server, IProgressMonitor monitor, boolean restart) throws CoreException -{ - this.monitor = monitor; - - try - { - -// IJavaServer javaServer = (IJavaServer) server.getDelegate(); -// addJarsToClassPath(javaServer); - validateRemoteServerPath(server); - - if (server.getServerState() != IServer.STATE_STOPPED) // The Server is running - { - if (server.getServerRestartState()) - { - - server.synchronousStop(false); - log_.log(Log.INFO, 5050, this, "StartServer", "project="+project+", Stop command completed, restart needed"); - publishProject(server); - startProject(server); - } - else - { - - if (restart) // WEB-INF\lib need to be reloaded - { - publishProject(server); - restartProject(project, server); - } - } - } - else { - - publishProject(server); - startProject(server); - } -} - - catch (CoreException ce) { - throw ce; - } - catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0,msgUtils_.getMessage("MSG_ERROR_SERVER"),e)); - } -} - -protected void publishProject(IServer server) throws CoreException -{ - monitor.subTask( msgUtils_.getMessage( "PROGRESS_INFO_PUBLISHING_SERVER" ) ); - IStatus status = server.publish(IServer.PUBLISH_INCREMENTAL, monitor); - if (status.getSeverity() != IStatus.OK) - throw new CoreException(status); - log_.log(Log.INFO, 5051, this, "publishProject", "IServer="+server+", Publish command completed"); - } - -protected void startProject(IServer server) throws CoreException -{ - try - { - monitor.subTask( msgUtils_.getMessage( "PROGRESS_INFO_STARTING_SERVER" ) ); - server.synchronousStart(ILaunchManager.RUN_MODE, monitor); - log_.log(Log.INFO, 5052, this, "startProject", "IServer="+server+", Start command completed"); - - } - catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0,msgUtils_.getMessage("MSG_ERROR_SERVER"),e)); - } -} - -protected void restartProject(IProject project, IServer server) throws CoreException -{ - //Do nothing -} - -public void runPreServerConfig(IServer server, IProject EARProject){ - - return; - -} - -public void runPostServerConfig(IServer server, IProject EARProject){ - - return; -} - - -protected abstract void addJarsToClassPath(IServer server) throws CoreException; -protected abstract void validateRemoteServerPath(IServer server) throws CoreException; - -public void stopServer(IServer server) throws CoreException { - - if (server != null) { - - if (server.getServerState() != IServer.STATE_STOPPED) { - server.synchronousStop(false); - } - } - -} - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AddModuleToServerCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AddModuleToServerCommand.java deleted file mode 100644 index f2656fa09..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AddModuleToServerCommand.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerWorkingCopy; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; - -public class AddModuleToServerCommand extends EnvironmentalOperation -{ - private MessageUtils msgUtils_; - - private String serverInstanceId; - private String project; - private String module; - - public AddModuleToServerCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - IServer server = ServerCore.findServer(serverInstanceId); - if (server == null) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_INSTANCE_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - - IServerWorkingCopy serverwc = null; - - try - { - //Ensure the module is not a Java utility - IProject iproject = ProjectUtilities.getProject(project); - if (!J2EEUtils.isJavaComponent(iproject, module)) - { - IModule imodule = ServerUtils.getModule(iproject, module); - if (!ServerUtil.containsModule(server, imodule, null)) - { - IModule[] imodules = new IModule[]{imodule}; - serverwc = server.createWorkingCopy(); - ServerUtil.modifyModules(serverwc, imodules, null, null); - } - - } - } catch (CoreException e) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_ADD_MODULE", new String[]{module}) ); - env.getStatusHandler().reportError(status); - return status; - } finally - { - try - { - if (serverwc != null) - { - serverwc.save(true, null); - } - } catch (CoreException ce) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_ADD_MODULE", new String[] { module }) ); - env.getStatusHandler().reportError(status); - return status; - } - } - - return status; - - - } - - public void setModule(String module) - { - this.module = module; - } - - public void setProject(String project) - { - this.project = project; - } - - public void setServerInstanceId(String serverInstanceId) - { - this.serverInstanceId = serverInstanceId; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AssociateModuleWithEARCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AssociateModuleWithEARCommand.java deleted file mode 100644 index fe3bd5899..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AssociateModuleWithEARCommand.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - -public class AssociateModuleWithEARCommand extends EnvironmentalOperation -{ - private String project_; - private String module_; - private String earProject_; - private String ear_; - - private MessageUtils msgUtils_; - - public AssociateModuleWithEARCommand(){ - msgUtils_ = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - IProject moduleProject = null; - IProject earProject = null; - - // get projects - if (project_!=null) - moduleProject = ProjectUtilities.getProject(project_); - if (earProject_!=null) - earProject = ProjectUtilities.getProject(earProject_); - - // associate modules if not already associated - if (moduleProject!=null && earProject!=null) { - if (!J2EEUtils.isComponentAssociated(earProject, ear_, moduleProject, module_)) - J2EEUtils.associateComponentToEAR(moduleProject, module_, earProject, ear_); - } - - // ensure modules are associated otherwise report error - if (!J2EEUtils.isComponentAssociated(earProject, ear_, moduleProject, module_)){ - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_UNABLE_TO_ASSOCIATE", new String[]{module_, ear_}) ); - if (env!=null) - env.getStatusHandler().reportError(status); - return status; - } - - return status; - } - - public void setProject( String project ) - { - project_ = project; - } - - public void setModule( String module ) - { - module_ = module; - } - - public void setEARProject( String earProject ) - { - earProject_ = earProject; - } - - public void setEar( String ear ) - { - ear_ = ear; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/BuildProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/BuildProjectCommand.java deleted file mode 100644 index 8e2dd3913..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/BuildProjectCommand.java +++ /dev/null @@ -1,98 +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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; - - -public class BuildProjectCommand extends EnvironmentalOperation -{ - private ValidationManager validationManager; - private IProject project_; - private boolean forceBuild_; - // rm private Model model; - - /** - * Default CTOR; - */ - public BuildProjectCommand() - { - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - try - { - if (forceBuild_) - project_.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor()); - else if (validationManager == null) - project_.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor()); - else if (validationManager.getWorkspaceAutoBuildPreference()) - project_.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor()); - } - catch (Exception e) - { - } - - try - { - Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor()); - } - catch (InterruptedException ie) - { - // continue execution - } - catch (OperationCanceledException oce) - { - // continue execution - } - - return Status.OK_STATUS; - } - /** - * @param forceBuild The forceBuild to set. - */ - public void setForceBuild(boolean forceBuild) { - this.forceBuild_ = forceBuild; - } - - /** - * @param project The project to set. - */ - public void setProject(IProject project) { - this.project_ = project; - } - - /** - * @param validationManager The validationManager to set. - */ - public void setValidationManager(ValidationManager validationManager) { - this.validationManager = validationManager; - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CheckProjectOKCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CheckProjectOKCommand.java deleted file mode 100644 index fa767a13a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CheckProjectOKCommand.java +++ /dev/null @@ -1,79 +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.command.common; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -public class CheckProjectOKCommand extends EnvironmentalOperation -{ - - private String serviceServerTypeId_; - - private MessageUtils msgUtils_; - - /** - * Default CTOR - */ - public CheckProjectOKCommand() { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - String typeid = serviceServerTypeId_; - IServer[] servers = ServerCore.getServers(); -// Iterator iterator = servers.iterator(); - boolean viewOpen = false; - String serverName = null; - - for (int i=0;i<servers.length;i++) { - IServer server = (IServer) servers[i]; - - // If the configuration editor is open for the server that we are - // deploying - // to we will prompt the user to close it. - if (server != null && server.getServerType().getId().equals(typeid)) { - viewOpen = true; - serverName = server.getName(); - break; - } - } - - if (viewOpen) { - String errorMessage = msgUtils_.getMessage("MSG_ERROR_SERVER_VIEW_OPEN", new String[] { serverName}); - return StatusUtils.errorStatus( errorMessage ); - - } - - return status; - } - - /** - * @param serviceServerId - * The serviceServer factory Id to set. - */ - public void setServiceServerTypeID(String serviceServerId) { - this.serviceServerTypeId_ = serviceServerId; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeEndpointCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeEndpointCommand.java deleted file mode 100644 index e23be406e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeEndpointCommand.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.common; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.soap.SOAPAddress; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -public class ComputeEndpointCommand extends EnvironmentalOperation -{ - private WebServicesParser webServicesParser; - private String wsdlURI; - private Boolean monitorService; - private Integer monitoredPort; - - public ComputeEndpointCommand() - { - } - - /** - * @param monitoredPort The monitoredPort to set. - */ - public void setMonitoredPort(Integer monitoredPort) - { - this.monitoredPort = monitoredPort; - } - /** - * @param monitorService The monitorService to set. - */ - public void setMonitorService(Boolean monitorService) - { - this.monitorService = monitorService; - } - /** - * @param webServicesParser The webServicesParser to set. - */ - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - /** - * @param wsdlURI The wsdlURI to set. - */ - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public String getEndpoint() - { - if (monitorService != null && monitorService.booleanValue() && monitoredPort != null) - { - Definition def = webServicesParser.getWSDLDefinition(wsdlURI); - if (def != null) - { - for (Iterator it = def.getServices().values().iterator(); it.hasNext();) - { - Service service = (Service)it.next(); - for (Iterator it2 = service.getPorts().values().iterator(); it2.hasNext();) - { - Port port = (Port)it2.next(); - for (Iterator it3 = port.getExtensibilityElements().iterator(); it3.hasNext();) - { - ExtensibilityElement ext = (ExtensibilityElement)it3.next(); - if (ext instanceof SOAPAddress) - { - String location = ((SOAPAddress)ext).getLocationURI(); - try - { - URL url = new URL(location); - url = new URL(url.getProtocol(), url.getHost(), monitoredPort.intValue(), url.getFile()); - return url.toString(); - } - catch (MalformedURLException murle) - { - int protocolIndex = location.indexOf("://"); - if (protocolIndex != -1) - { - String protocol = location.substring(0, protocolIndex+3); - int hostPortIndex = location.indexOf('/', protocolIndex+3); - String file; - if (hostPortIndex == -1) - { - hostPortIndex = location.length(); - file = ""; - } - else - file = location.substring(hostPortIndex, location.length()); - String hostPort = location.substring(protocolIndex+3, hostPortIndex); - int hostIndex = hostPort.indexOf(':'); - String host; - if (hostIndex != -1) - host = hostPort.substring(0, hostIndex+1); - else - host = hostPort + ':'; - String newPort = String.valueOf(monitoredPort.intValue()); - StringBuffer endpoint = new StringBuffer(protocol); - endpoint.append(host); - endpoint.append(newPort); - endpoint.append(file); - return endpoint.toString(); - } - } - } - } - } - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CopyWSDLCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CopyWSDLCommand.java deleted file mode 100644 index d483e2174..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CopyWSDLCommand.java +++ /dev/null @@ -1,332 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.common; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; - -import javax.wsdl.Definition; -import javax.wsdl.Import; -import javax.wsdl.Types; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.UnknownExtensibilityElement; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLWriter; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.uri.URIException; -import org.eclipse.wst.common.uriresolver.internal.util.URIEncoder; -import org.eclipse.wst.ws.internal.parser.discovery.NetUtils; -import org.eclipse.wst.ws.internal.parser.wsil.WWWAuthenticationException; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.wsdl.internal.impl.XSDSchemaExtensibilityElementImpl; -import org.eclipse.wst.wsdl.internal.impl.wsdl4j.WSDLFactoryImpl; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaDirective; -import org.eclipse.xsd.impl.XSDSchemaImpl; -import org.eclipse.xsd.util.XSDParser; -import org.w3c.dom.Element; - -public class CopyWSDLCommand extends EnvironmentalOperation -{ - private String wsdlURI; - private WebServicesParser webServicesParser; - private String destinationURI; - private Definition def; - private Vector ignoreList; - - public CopyWSDLCommand() - { - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - try - { - ignoreList = new Vector(); - if (def == null) - def = webServicesParser.getWSDLDefinition(wsdlURI); - copyWSDL(env, wsdlURI, getBaseURI(destinationURI), getLocalname(destinationURI), def); - return Status.OK_STATUS; - } - catch (Throwable t) - { - t.printStackTrace(); - IStatus status = StatusUtils.errorStatus( WebServiceConsumptionPlugin.getMessage("MSG_ERROR_COPY_WSDL", new String[]{wsdlURI, destinationURI}), t); - env.getStatusHandler().reportError(status); - return status; - } - } - - private void copyWSDL(Environment env, String uri, String destURI, String destLocalname) throws WSDLException, IOException, WWWAuthenticationException, TransformerException, TransformerConfigurationException, URIException - { - Definition definition; - - try { - definition = webServicesParser.getWSDLDefinitionVerbose(uri); - copyWSDL(env, uri, destURI, destLocalname, definition); - } catch (WSDLException e) { - copyXMLSchema(env, uri, destURI); - } - } - - private void copyWSDL(Environment env, String uri, String destURI, String destLocalname, Definition definition) throws WSDLException, IOException, WWWAuthenticationException, TransformerException, TransformerConfigurationException, URIException - { - if (!needToCopy(uri)) { - return; - } - - String baseURI = getBaseURI(uri); - if (destLocalname == null || destLocalname.length() <= 0) - destLocalname = getLocalname(uri); - - // copy WSDL - StringBuffer destinationFileURI = new StringBuffer(addTrailingSeparator(destURI)); - destinationFileURI.append(destLocalname); - WSDLFactory wsdlFactory = new WSDLFactoryImpl(); - WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); - OutputStream os = env.getURIFactory().newURI(destinationFileURI.toString()).getOutputStream(); - wsdlWriter.writeWSDL(definition, os); - os.close(); - // copy <wsdl:import>s - Map imports = definition.getImports(); - for (Iterator it = imports.values().iterator(); it.hasNext();) - { - List list = (List)it.next(); - for (Iterator listIt = list.iterator(); listIt.hasNext();) - { - Import wsdlImport = (Import)listIt.next(); - String wsdlImportURI = wsdlImport.getLocationURI(); - if (isRelative(wsdlImportURI)) - { - String importBaseURI = (new StringBuffer(baseURI)).append(wsdlImportURI).toString(); - String wsdlImportBaseURI = getBaseURI(wsdlImportURI); - StringBuffer importDestURI = new StringBuffer(destURI); - if (wsdlImportBaseURI != null) - importDestURI.append(wsdlImportBaseURI); - copyWSDL(env, importBaseURI, importDestURI.toString(), getLocalname(wsdlImportURI)); - } - } - } - Types types = definition.getTypes(); - if (types != null) - { - List schemas = types.getExtensibilityElements(); - for (Iterator it = schemas.iterator(); it.hasNext();) - { - ExtensibilityElement extElement = (ExtensibilityElement)it.next(); - if (extElement instanceof UnknownExtensibilityElement) - { - UnknownExtensibilityElement schemaElement = (UnknownExtensibilityElement)extElement; - XSDSchema xsdSchema = null; - try - { - xsdSchema = XSDSchemaImpl.createSchema(schemaElement.getElement()); - } - catch (Throwable t) - { - // ignore any extensibility elements that cannot be parsed into a - // XSDSchema instance - } - copyXMLSchema(env, xsdSchema, baseURI, destURI); - } - else if (extElement instanceof XSDSchemaExtensibilityElementImpl) - { - XSDSchemaExtensibilityElementImpl schemaElement = (XSDSchemaExtensibilityElementImpl)extElement; - XSDSchema xsdSchema = null; - try - { - xsdSchema = XSDSchemaImpl.createSchema(schemaElement.getElement()); - } - catch (Throwable t) - { - // ignore any extensibility elements that cannot be parsed into a - // XSDSchema instance - } - copyXMLSchema(env, xsdSchema, baseURI, destURI); - } - } - } - } - - private String getBaseURI(String uri) - { - int index = uri.lastIndexOf('/'); - if (index == -1) - index = uri.lastIndexOf('\\'); - if (index != -1) - return uri.substring(0, index + 1); - else - return null; - } - - private String getLocalname(String uri) - { - int index = uri.lastIndexOf('/'); - if (index == -1) - index = uri.lastIndexOf('\\'); - if (index != -1) - return uri.substring(index + 1); - else - return uri; - } - - private String addTrailingSeparator(String s) - { - if (!(s.endsWith("/") || s.endsWith("\\"))) - { - StringBuffer sb = new StringBuffer(s); - sb.append('/'); - return sb.toString(); - } - else - return s; - } - - private boolean isRelative(String uri) - { - return (uri.indexOf(':') == -1); - } - - private void copyXMLSchema(Environment env, String uri, String destURI) throws TransformerException, TransformerConfigurationException, IOException, URIException - { - if (!needToCopy(uri)) { - return; - } - - // load as a cached schema - XSDSchema xsdSchema = XSDSchemaImpl.getSchemaForSchema(uri); - // if schema is not cached, parse it - if (xsdSchema == null) - { - XSDParser p = new XSDParser(); - InputStream is = NetUtils.getURLInputStream(uri); - if (is != null) - { - p.parse(is); - xsdSchema = p.getSchema(); - } - } - if (xsdSchema != null) - { - // copy schema - Element e = xsdSchema.getElement(); - DOMSource domSource = new DOMSource(e); - Transformer serializer = TransformerFactory.newInstance().newTransformer(); - serializer.setOutputProperty(OutputKeys.INDENT, "yes"); - serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - OutputStream os = env.getURIFactory().newURI((new StringBuffer(destURI)).append(getLocalname(uri)).toString()).getOutputStream(); - serializer.transform(domSource, new StreamResult(os)); - os.close(); - // copy <xsd:import>s and <xsd:include>s - copyXMLSchema(env, xsdSchema, getBaseURI(uri), destURI); - } - } - - private void copyXMLSchema(Environment env, XSDSchema xsdSchema, String baseURI, String destURI) throws TransformerException, TransformerConfigurationException, IOException, URIException - { - if (xsdSchema != null) - { - // copy <xsd:import>s and <xsd:include>s - EList xsdSchemaContents = xsdSchema.getContents(); - for (Iterator it = xsdSchemaContents.iterator(); it.hasNext();) - { - Object content = it.next(); - if (content instanceof XSDSchemaDirective) - { - XSDSchemaDirective xsdSchemaDirective = (XSDSchemaDirective)content; - String xsdSchemaDirectiveLocation = xsdSchemaDirective.getSchemaLocation(); - if (xsdSchemaDirectiveLocation != null && isRelative(xsdSchemaDirectiveLocation)) - { - String directiveURI = (new StringBuffer(baseURI)).append(xsdSchemaDirectiveLocation).toString(); - String directiveBaseURI = getBaseURI(xsdSchemaDirectiveLocation); - StringBuffer directiveDestURI = new StringBuffer(destURI); - if (directiveBaseURI != null) - directiveDestURI.append(directiveBaseURI); - copyXMLSchema(env, directiveURI, directiveDestURI.toString()); - } - } - } - } - } - - private boolean needToCopy (String uri) { - String normalizedURI = normalize(uri); - if (ignoreList.contains(normalizedURI)) - return false; - ignoreList.add(normalizedURI); - return true; - } - - private String normalize(String uri ) - { - try { - String encodedURI = URIEncoder.encode(uri,"UTF-8"); - URI normalizedURI = new URI(encodedURI); - normalizedURI = normalizedURI.normalize(); - return normalizedURI.toString(); - } catch (URISyntaxException e) { - return uri; - } catch (UnsupportedEncodingException e) { - return uri; - } - } - - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - public void setDestinationURI(String destinationURI) - { - this.destinationURI = destinationURI; - } - - public void setDefinition(Definition def) - { - this.def = def; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateEARProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateEARProjectCommand.java deleted file mode 100644 index 5d70fe4e0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateEARProjectCommand.java +++ /dev/null @@ -1,109 +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.command.common; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - - -public class CreateEARProjectCommand extends EnvironmentalOperation -{ - private String earProjectName_; - private String serverFactoryId_; - private String j2eeVersion_; - - /** - * Constructor - */ - public CreateEARProjectCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - MessageUtils msgUtils_ = new MessageUtils( "org.eclipse.jst.ws.consumption.plugin", this ); - - try - { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(earProjectName_); - if (project != null && !project.exists()) - { - IDataModel info = DataModelFactory.createDataModel(new EarComponentCreationDataModelProvider()); - info.setProperty(IEarComponentCreationDataModelProperties.PROJECT_NAME, project.getName()); - - //Set the J2EE version - if (j2eeVersion_ != null && j2eeVersion_.length()>0) - { - info.setProperty(IEarComponentCreationDataModelProperties.COMPONENT_VERSION, new Integer(j2eeVersion_)); - } - else - { - info.setProperty(IEarComponentCreationDataModelProperties.COMPONENT_VERSION, new Integer(J2EEVersionConstants.J2EE_1_3_ID)); - } - - //Set the server target - if (serverFactoryId_!=null && serverFactoryId_.length()>0) - { -// TODO - Add this logic to FlexibleProjectCreationDataModel, and op.... -// String runtimeTargetId = ServerUtils.getServerTargetIdFromFactoryId(serverFactoryId_, IServerTargetConstants.EAR_TYPE, finalJ2EEVersion); -// info.setProperty(EARComponentCreationDataModel.SERVER_TARGET_ID, runtimeTargetId ); -// info.setProperty(EARComponentCreationDataModel.ADD_SERVER_TARGET, Boolean.TRUE); - } - - //Create the EAR - IDataModelOperation operation = info.getDefaultOperation(); - operation.execute(new NullProgressMonitor(), null); - } - } - catch (ExecutionException ite) - { - IStatus status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_CANNOT_CREATE_EAR_PROJECT", new String[] {earProjectName_}), ite); - env.getStatusHandler().reportError(status); - return status; - } - return Status.OK_STATUS; - } - /** - * @param earProjectName_ The earProjectName_ to set. - */ - public void setEarProjectName(String earProjectName) - { - this.earProjectName_ = earProjectName; - } - - public void setServerFactoryId(String serverFactoryId) - { - serverFactoryId_ = serverFactoryId; - } - - public void setJ2EEVersion(String j2eeVersion) - { - j2eeVersion_ = j2eeVersion; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateJavaProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateJavaProjectCommand.java deleted file mode 100644 index 965fbd096..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateJavaProjectCommand.java +++ /dev/null @@ -1,81 +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.command.common; - -import org.eclipse.core.resources.ICommand; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - - -public class CreateJavaProjectCommand extends EnvironmentalOperation -{ - private String projectName_; - - /** - * Default CTOR - */ - public CreateJavaProjectCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName_); - - if (project != null && !project.exists()) - { - try - { - project.create(ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()), monitor); - project.open(monitor); - IProjectDescription desc = project.getDescription(); - desc.setNatureIds(new String[] {JavaCore.NATURE_ID}); - ICommand cmd = desc.newCommand(); - cmd.setBuilderName(JavaCore.BUILDER_ID); - desc.setBuildSpec(new ICommand[] {cmd}); - project.setDescription(desc, monitor); - IJavaProject javaProject = JavaCore.create(project); - Path projectRoot = new Path(Path.ROOT.append(new Path(project.getName())).toString()); - javaProject.setRawClasspath(new IClasspathEntry[] {JavaCore.newSourceEntry(projectRoot), JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER))}, monitor); - javaProject.setOutputLocation(projectRoot, monitor); - } - catch (CoreException ce) - { - IStatus status = StatusUtils.errorStatus( WebServiceConsumptionPlugin.getMessage("MSG_ERROR_CANNOT_CREATE_JAVA_PROJECT", new String[] {projectName_}), ce); - env.getStatusHandler().reportError(status); - return status; - } - } - return Status.OK_STATUS; - } - - public void setProjectName(String projectName) - { - projectName_ = projectName; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java deleted file mode 100644 index 1044e629a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java +++ /dev/null @@ -1,328 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.application.internal.operations.FlexibleJavaProjectCreationDataModelProvider; -import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentCreationDataModelProvider; -import org.eclipse.jst.j2ee.datamodel.properties.IAppClientComponentCreationDataModelProperties; -import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties; -import org.eclipse.jst.j2ee.ejb.datamodel.properties.IEjbComponentCreationDataModelProperties; -import org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider; -import org.eclipse.jst.j2ee.internal.ejb.archiveoperations.EjbComponentCreationDataModelProvider; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentCreationDataModelProvider; -import org.eclipse.jst.j2ee.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties; -import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentCreationDataModelProperties; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -public class CreateModuleCommand extends EnvironmentalOperation -{ - - public final static int WEB = J2EEUtils.WEB; - public final static int EJB = J2EEUtils.EJB; - public final static int APPCLIENT = J2EEUtils.APPCLIENT; - public final static int EAR = J2EEUtils.EAR; - - private String projectName; - private String moduleName; // may be null for non-flexible project - private int moduleType;; - private String j2eeLevel; - private String serverFactoryId; - private String serverInstanceId_; - private Environment env; - private IProgressMonitor monitor_; - - private MessageUtils msgUtils; - - public CreateModuleCommand(){ - msgUtils = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - monitor_ = monitor; - this.env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - // check if data ready - status = checkDataReady(); - if (status.getSeverity()==Status.ERROR){ - return status; - } - - // check if flexible project exists - IProject project = ProjectUtilities.getProject(projectName); - if (project==null || !project.exists()){ - status = createFlexibleJavaProject(); - if (status.getSeverity()==Status.ERROR){ - return status; - } - } - - // check if project and/or component exists - if (projectName!=null) { - if (moduleName==null){ - if (project.exists()) - return status; - } - else { - if (J2EEUtils.exists(projectName, moduleName)) - return status; - } - } - else { - return StatusUtils.errorStatus(msgUtils.getMessage("MSG_ERROR_COMPONENT_CREATION", new String[]{projectName, moduleName}) ); - } - - // create the component according to the component type specified - int type = getModuleType(); - switch (type) { - case WEB: - status = createWebComponent(); - break; - case EJB: - status = createEJBComponent(); - break; - case APPCLIENT: - status = createAppClientComponent(); - break; - case EAR: - status = createEARComponent(); - break; - - default: - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_COMPONENT_CREATION", new String[]{moduleName}) ); - } - - - return status; - } - - private IStatus checkDataReady(){ - - if (projectName==null || serverFactoryId==null){ - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_COMPONENT_CREATION", new String[]{projectName, moduleName}) ); - } - - return Status.OK_STATUS; - } - - - /** - * Create a Web component - * @return - */ - public IStatus createWebComponent(){ - IStatus status = Status.OK_STATUS; - try - { - IDataModel projectInfo = DataModelFactory.createDataModel(new WebComponentCreationDataModelProvider()); - - projectInfo.setProperty(IWebComponentCreationDataModelProperties.PROJECT_NAME,projectName); - if (moduleName!=null) - projectInfo.setProperty(IWebComponentCreationDataModelProperties.COMPONENT_NAME, moduleName); - - // get the Web servlet level - Integer servletLevel = J2EEUtils.getServletVersionForJ2EEVersion(j2eeLevel); - - if (j2eeLevel!=null) - projectInfo.setProperty(IWebComponentCreationDataModelProperties.COMPONENT_VERSION, servletLevel); - IDataModelOperation op = projectInfo.getDefaultOperation(); - op.execute(monitor_, null); - } - catch (Exception e) - { - status = StatusUtils.errorStatus( e ); - } - return status; - } - - /** - * Create an EAR component - * @return - */ - public IStatus createEARComponent(){ - IStatus status = Status.OK_STATUS; - try - { - IDataModel projectInfo = DataModelFactory.createDataModel(new EarComponentCreationDataModelProvider()); - projectInfo.setProperty(IEarComponentCreationDataModelProperties.PROJECT_NAME,projectName); - if (moduleName!=null) - projectInfo.setProperty(IEarComponentCreationDataModelProperties.COMPONENT_NAME, moduleName); - if (j2eeLevel!=null) - projectInfo.setProperty(IEarComponentCreationDataModelProperties.COMPONENT_VERSION, Integer.valueOf(j2eeLevel)); - IDataModelOperation op =projectInfo.getDefaultOperation(); - op.execute(monitor_, null); - } - catch (Exception e) - { - status = StatusUtils.errorStatus( e ); - } - return status; - } - - /** - * Create an EJB Component - * @return - */ - public IStatus createEJBComponent(){ - IStatus status = Status.OK_STATUS; - - try - { - IDataModel projectInfo = DataModelFactory.createDataModel(new EjbComponentCreationDataModelProvider()); - projectInfo.setProperty(IEjbComponentCreationDataModelProperties.PROJECT_NAME,projectName); - if (moduleName!=null) - projectInfo.setProperty(IEjbComponentCreationDataModelProperties.COMPONENT_NAME, moduleName); - - // get the EJB spec level - Integer ejbLevel = J2EEUtils.getEJBVersionForJ2EEVersion(j2eeLevel); - - if (j2eeLevel!=null) - projectInfo.setProperty(IEjbComponentCreationDataModelProperties.COMPONENT_VERSION, ejbLevel); - - //Don't create an EAR. The ADD_TO_EAR property gets defaulted to TRUE for everything except Web projects. - projectInfo.setProperty(IEjbComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE); - - IDataModelOperation op = projectInfo.getDefaultOperation(); - op.execute( monitor_, null); - } - catch (Exception e) - { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_EJB_COMPONENT", new String[]{projectName}), e); - } - return status; - } - - /** - * Create an Application Client component - * @return - */ - public IStatus createAppClientComponent() - { - IStatus status = Status.OK_STATUS; - try - { - IDataModel projectInfo = DataModelFactory.createDataModel(new AppClientComponentCreationDataModelProvider()); - projectInfo.setProperty(IAppClientComponentCreationDataModelProperties.PROJECT_NAME,projectName); - if (moduleName!=null) - projectInfo.setProperty(IAppClientComponentCreationDataModelProperties.COMPONENT_NAME, moduleName); - if (j2eeLevel!=null) - projectInfo.setProperty(IAppClientComponentCreationDataModelProperties.COMPONENT_VERSION, Integer.valueOf(j2eeLevel)); - - //Don't create an EAR. The ADD_TO_EAR property gets defaulted to TRUE for everything except Web projects. - projectInfo.setProperty(IAppClientComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE); - - IDataModelOperation op = projectInfo.getDefaultOperation(); - - op.execute( monitor_, null); - } - catch (Exception e) - { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_APPCIENT_PROJET", new String[]{projectName}), e); - } - return status; - } - - /** - * Creates Flexible Java Project structure - * This project is required if it doesn't already exist in order to create the component - * @return - * - * Note: This call may not be necessary once J2EE implements creating a flex project automatically - * with the creation of components. - */ - public IStatus createFlexibleJavaProject(){ - IStatus status = Status.OK_STATUS; - try - { - IDataModel projectInfo = DataModelFactory.createDataModel(new FlexibleJavaProjectCreationDataModelProvider()); - projectInfo.setProperty(IFlexibleJavaProjectCreationDataModelProperties.PROJECT_NAME,projectName); - - String runtimeTargetId = null; - if( serverInstanceId_ == null ) - { - // We don't have a server instance so we will get the first runtimeTarget from the factory ID. - runtimeTargetId = ServerUtils.getServerTargetIdFromFactoryId(serverFactoryId, ServerUtils.getServerTargetModuleType(moduleType), j2eeLevel); - } - else - { - // We have a server instance so we will just get it's runtimeTargetId. - IServer server = ServerCore.findServer( serverInstanceId_ ); - runtimeTargetId = server.getRuntime().getId(); - } - - projectInfo.setProperty(IFlexibleJavaProjectCreationDataModelProperties.RUNTIME_TARGET_ID,runtimeTargetId); - projectInfo.setProperty(IFlexibleJavaProjectCreationDataModelProperties.ADD_SERVER_TARGET,Boolean.TRUE); - IDataModelOperation op = projectInfo.getDefaultOperation(); - if (env!=null) - op.execute( monitor_, null); - else - op.execute(new NullProgressMonitor(), null); - - } - catch (Exception e) - { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_FLEX_PROJET", new String[]{projectName}), e); - } - return status; - } - - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public int getModuleType() - { - return moduleType; - } - - public void setModuleType(int moduleType) - { - this.moduleType = moduleType; - } - - public void setProjectName(String projectName) - { - this.projectName = projectName; - } - - /** - * Expecting 12,13,14 etc. - * @param level - */ - public void setJ2eeLevel(String level) - { - if (level !=null && level.indexOf(".")!=-1) - j2eeLevel = J2EEUtils.getJ2EEIntVersionAsString(level); - else - j2eeLevel = level; - } - - public void setServerFactoryId(String serverFactoryId) - { - this.serverFactoryId = serverFactoryId; - } - - public void setServerInstanceId( String serverInstanceId ) - { - serverInstanceId_ = serverInstanceId; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateMonitorCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateMonitorCommand.java deleted file mode 100644 index a73c85b3a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateMonitorCommand.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.common; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerPort; -import org.eclipse.wst.server.core.internal.IMonitoredServerPort; -import org.eclipse.wst.server.core.internal.IServerMonitorManager; -import org.eclipse.wst.server.core.internal.ServerMonitorManager; - -public class CreateMonitorCommand extends EnvironmentalOperation -{ - - private static final String WEB_SERVICES = "Web services"; - - private Boolean monitorService; - - private String serviceServerInstanceId; - - private Integer monitoredPort; - - public CreateMonitorCommand() { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - if (monitorService != null && monitorService.booleanValue()) { - IServer server = ServerCore.findServer(serviceServerInstanceId); - if (server != null) { - - // IMonitorableServer monitorableServer = (IMonitorableServer) - // serverDelegate; - ServerPort[] ports = server.getServerPorts(null); - ServerPort port = null; - for (int it = 0; it < ports.length; it++) { - ServerPort p = ports[it]; - String protocol = p.getProtocol(); - if (protocol != null && protocol.trim().toLowerCase().equals("http")) { - port = p; - break; - } - } - if (port != null) { - IServerMonitorManager serverMonitorManager = ServerMonitorManager.getInstance(); - IMonitoredServerPort[] monitoredPorts = serverMonitorManager.getMonitoredPorts(server); - for (int it2 = 0; it2 < monitoredPorts.length; it2++) { - IMonitoredServerPort imsPort = monitoredPorts[it2]; - if (port.getPort() == imsPort.getServerPort().getPort() && hasContentWebServices(imsPort)) // port - // already - // being - // monitored - { - if (!imsPort.isStarted()) { - try { - serverMonitorManager.startMonitor(imsPort); - } - catch (CoreException ce) { - MessageUtils msgUtils = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - IStatus error = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_UNABLE_TO_START_MONITOR", - new Object[] { String.valueOf(port.getPort()), server.getName()}), ce); - env.getStatusHandler().reportError(error); - return error; - } - } - monitoredPort = new Integer(imsPort.getMonitorPort()); - return Status.OK_STATUS; - } - } - try { - IMonitoredServerPort imsPort = serverMonitorManager.createMonitor(server, port, -1, new String[] { WEB_SERVICES}); - serverMonitorManager.startMonitor(imsPort); - monitoredPort = new Integer(imsPort.getMonitorPort()); - return Status.OK_STATUS; - } - catch (CoreException ce) { - MessageUtils msgUtils = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - IStatus error = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_UNABLE_TO_START_MONITOR", new Object[] { - String.valueOf(port.getPort()), server.getName()}), ce); - env.getStatusHandler().reportError(error); - return error; - } - } - - else { - MessageUtils msgUtils = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - IStatus info = StatusUtils.infoStatus( msgUtils.getMessage("MSG_INFO_MONITORING_NOT_SUPPORTED", - new Object[] { server.getName()}) ); - env.getStatusHandler().reportInfo(info); - return info; - } - } - } - return Status.OK_STATUS; - } - - private boolean hasContentWebServices(IMonitoredServerPort imsPort) { - String[] contents = imsPort.getContentTypes(); - for (int i = 0; i < contents.length; i++) - if (WEB_SERVICES.equals(contents[i])) return true; - return false; - } - - public void setServiceTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer) { - this.serviceServerInstanceId = typeRuntimeServer.getServerInstanceId(); - } - - public void setServiceServerInstanceId(String serviceServerInstanceId) { - this.serviceServerInstanceId = serviceServerInstanceId; - } - - public Integer getMonitoredPort() { - return monitoredPort; - } - - public void setMonitorService(Boolean value) { - monitorService = value; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateServerCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateServerCommand.java deleted file mode 100644 index 80e8343f2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateServerCommand.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.IServerWorkingCopy; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; - -public class CreateServerCommand extends EnvironmentalOperation -{ - private String serverFactoryId; - private String serverInstanceId; - - private MessageUtils msgUtils; - - /** - * Creates a server of the factory id - * Note1: Checking for server instance == null is done in the PreService/ClientInstallCommands - * Note2: Reporting of errors is done in PreService/ClientInstallCommands; simply return the status. - */ - public CreateServerCommand(){ - msgUtils = new MessageUtils(WebServiceConsumptionPlugin.ID + ".plugin", this); - - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - if (serverFactoryId==null){ - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_SERVER") ); - return status; - } - - IServerWorkingCopy serverWC = null; - IServer server = null; - try { - IServerType serverType = ServerCore.findServerType(serverFactoryId); - if (serverType!=null) { - - //Choose a Runtime which is not a stub - IRuntime nonStubRuntime = null; - IRuntime[] runtimes = ServerUtil.getRuntimes(null, null); - String serverRuntimeTypeId = serverType.getRuntimeType().getId(); - for (int i = 0; i < runtimes.length; i++) { - IRuntime runtime = runtimes[i]; - String thisRuntimeTypeId = runtime.getRuntimeType().getId(); - if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) { - //Found an appropriate IRuntime that is not a stub - nonStubRuntime = runtime; - break; - } - } - - if (nonStubRuntime==null) - { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_STUB_ONLY",new String[]{serverFactoryId}) ); - return status; - } - - if (env!=null) - { - serverWC = serverType.createServer(null, null, nonStubRuntime, monitor ); - } - else - { - serverWC = serverType.createServer(null, null, nonStubRuntime, null); - } - - if (serverWC != null) { - if (env!=null) - server = serverWC.saveAll(true, monitor ); - else - server = serverWC.saveAll(true, null); - } - } - } catch (CoreException ce) { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_SERVER"), ce); - return status; - } - - // set serverInstanceId - if (server!=null) - serverInstanceId = server.getId(); - else { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_CREATE_SERVER") ); - } - - return status; - } - - public void setServerFactoryid(String serverFactoryId) - { - this.serverFactoryId = serverFactoryId; - } - - public String getServerInstanceId() - { - return serverInstanceId; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableBuildCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableBuildCommand.java deleted file mode 100644 index 95917961d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableBuildCommand.java +++ /dev/null @@ -1,69 +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.command.common; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; -import org.eclipse.wst.ws.internal.datamodel.Model; - - -public class DisableBuildCommand extends EnvironmentalOperation -{ - private MessageUtils msgUtils_; - private ValidationManager manager_; - /** - * CTOR; - */ - public DisableBuildCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - ProgressUtils.report( monitor, msgUtils_.getMessage("TASK_DESC_WEBSERVICE_DISABLE_BUILD")); - - if (manager_!=null) { - manager_.disableAutoBuild(); - } - return status; - } - - /** - * Set the model - * - * @param model - */ - public void setModel(Model model) { - } - - - /** - * @param manager_ The manager_ to set. - */ - public void setValidationManager(ValidationManager manager) { - this.manager_ = manager; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableValidationCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableValidationCommand.java deleted file mode 100644 index 32fd9c0a5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableValidationCommand.java +++ /dev/null @@ -1,66 +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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; - - -public class DisableValidationCommand extends EnvironmentalOperation -{ - - private MessageUtils msgUtils_; - private ValidationManager manager_; - private IProject serviceProject_; - - /** - * CTOR; - */ - public DisableValidationCommand() { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - ProgressUtils.report(monitor, msgUtils_.getMessage("TASK_DESC_WEBSERVICE_DISABLE_VALIDATION")); - - IProject project = serviceProject_; - if (project != null) manager_.disableValidationForProject(project); - - return status; - } - - /** - * @param manager_ - * The manager_ to set. - */ - public void setValidationManager(ValidationManager manager) { - this.manager_ = manager; - } - - public void setServiceProject(IProject serviceProject){ - this.serviceProject_ = serviceProject; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/GetMonitorCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/GetMonitorCommand.java deleted file mode 100644 index b455e51e1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/GetMonitorCommand.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.common; - -// TODO: Get rid of this. A replacement is in org.eclipse.wst.ws. - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.http.HTTPAddress; -import javax.wsdl.extensions.soap.SOAPAddress; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusException; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor; -import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy; -import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore; -import org.eclipse.wst.server.core.util.SocketUtil; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -public class GetMonitorCommand extends EnvironmentalOperation -{ - private boolean monitorService; - private boolean create; - private WebServicesParser webServicesParser; - private String wsdlURI; - private List endpoints; - - public GetMonitorCommand() - { - monitorService = true; - create = true; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - endpoints = new Vector(); - if (monitorService && webServicesParser != null && wsdlURI != null && wsdlURI.length() > 0) - { - Definition definition = webServicesParser.getWSDLDefinition(wsdlURI); - if (definition != null) - { - Map services = definition.getServices(); - for (Iterator servicesIt = services.values().iterator(); servicesIt.hasNext();) - { - Service service = (Service)servicesIt.next(); - Map ports = service.getPorts(); - for (Iterator portsIt = ports.values().iterator(); portsIt.hasNext();) - { - Port wsdlPort = (Port)portsIt.next(); - List extElements = wsdlPort.getExtensibilityElements(); - for (Iterator extElementsIt = extElements.iterator(); extElementsIt.hasNext();) - { - ExtensibilityElement extElement = (ExtensibilityElement)extElementsIt.next(); - String endpoint = null; - URL endpointURL = null; - if (extElement instanceof SOAPAddress) - endpoint = ((SOAPAddress)extElement).getLocationURI(); - else if (extElement instanceof HTTPAddress) - endpoint = ((HTTPAddress)extElement).getLocationURI(); - if (endpoint != null) - { - try - { - endpointURL = new URL(endpoint); - } - catch (MalformedURLException murle) - { - } - } - if (endpointURL != null) - { - String protocol = endpointURL.getProtocol(); - String host = endpointURL.getHost(); - int port = endpointURL.getPort(); - if (port == -1) - { - if ("http".equalsIgnoreCase(protocol)) - port = 80; - else if ("https".equalsIgnoreCase(protocol)) - port = 443; - } - if (protocol != null && protocol.startsWith("http") && host != null && host.length() > 0 && port != -1) - { - IMonitor m = null; - IMonitor[] monitors = MonitorCore.getMonitors(); - for (int i=0; i<monitors.length; i++) - { - if (host.equalsIgnoreCase(monitors[i].getRemoteHost()) && port == monitors[i].getRemotePort()) - { - m = monitors[i]; - break; - } - } - if (m == null && create) - { - int monitoredPort = SocketUtil.findUnusedPort(5000, 15000); - IMonitorWorkingCopy monitorWorkingCopy = MonitorCore.createMonitor(); - monitorWorkingCopy.setLocalPort(monitoredPort); - monitorWorkingCopy.setRemoteHost(host); - monitorWorkingCopy.setRemotePort(port); - monitorWorkingCopy.setProtocol("HTTP"); - try - { - m = monitorWorkingCopy.save(); - } - catch (Throwable t) - { - IStatus warning = StatusUtils.warningStatus( WebServiceConsumptionPlugin.getMessage("MSG_ERROR_UNABLE_TO_START_MONITOR", new Object[]{String.valueOf(port), endpoint}), t); - try - { - if (env != null) - env.getStatusHandler().report(warning); - } - catch (StatusException se) - { - } - } - } - if (m != null) - { - try - { - if (!m.isRunning()) - m.start(); - StringBuffer sb = new StringBuffer(endpointURL.getProtocol()); - sb.append("://localhost:"); - sb.append(String.valueOf(m.getLocalPort())); - sb.append(endpointURL.getFile()); - endpoints.add(sb.toString()); - } - catch (Throwable t) - { - IStatus warning = StatusUtils.warningStatus( WebServiceConsumptionPlugin.getMessage("MSG_ERROR_UNABLE_TO_START_MONITOR", new Object[]{String.valueOf(port), endpoint}), t); - try - { - if (env != null) - env.getStatusHandler().report(warning); - } - catch (StatusException se) - { - } - } - } - } - } - } - } - } - } - } - return Status.OK_STATUS; - } - - public void setMonitorService(boolean monitorService) - { - this.monitorService = monitorService; - } - - public void setDefinition(Definition definition) - { - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setCreate(boolean create) - { - this.create = create; - } - - public List getEndpoints() - { - return endpoints; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java deleted file mode 100644 index f79291c0e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java +++ /dev/null @@ -1,118 +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.command.common; - - -//core stuff -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jem.internal.plugin.JavaEMFNature; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -/** -* This class is to be used to Build the data model -* first we get the java class and then build the model -*/ -public class JavaMofReflectionCommand extends EnvironmentalOperation -{ - - public static String LABEL = "JavaMofReflectionCommand"; - public static String DESCRIPTION = "reflection for a given class"; - public static String OK_MESSAGE = "The model has been built "; - private static String JAVA_EXTENSION = ".java"; - private static String CLASS_EXTENSION = ".class"; - - private String clientProject; - private ResourceSet resourceSet; - private JavaHelpers javaClass; - private String qname; - private String proxyBean; - - /** - * Constructs a new JavaMofReflectionCommand with the given label and description - * - */ - public JavaMofReflectionCommand() - { - } - - // setters for this command - - - /** - * The end result of this whole process is to get the Java Class - */ - public JavaHelpers getJavaClass() - { - return javaClass; - } - - - private void processQName() - { - qname = proxyBean; - if (qname.toLowerCase().endsWith(JAVA_EXTENSION)) { - qname = qname.substring(0,(qname.length() -5)); - } - if (qname.toLowerCase().endsWith(CLASS_EXTENSION)) { - qname = qname.substring(0,(qname.length() -6)); - } - } - - /** - * Get the java model from the resource then - * build the model from the mof - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - //just make sure the project and qname are there - //they are essential for this operation - IStatus status = Status.OK_STATUS; - IProject clientIProject = (IProject)ResourceUtils.findResource(clientProject); - processQName(); - if(clientProject == null || qname == null) - return StatusUtils.warningStatus( WebServiceConsumptionPlugin.getMessage("%MSG_WARN_UNABLE_TO_FIND_PROXY") ); - - JavaEMFNature nature = (JavaEMFNature)JavaEMFNature.getRuntime(clientIProject); - if(nature == null){ - try{ - nature = (JavaEMFNature)JavaEMFNature.createRuntime(clientIProject); - }catch(CoreException exc){} - } - resourceSet = nature.getResourceSet(); - javaClass = JavaRefFactory.eINSTANCE.reflectType(qname,resourceSet); - - return status; - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - } diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ManageServerStartUpCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ManageServerStartUpCommand.java deleted file mode 100644 index 99a84d3b3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ManageServerStartUpCommand.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; -import org.eclipse.wst.server.core.IServer; - -/** - * @author sengpl - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class ManageServerStartUpCommand extends EnvironmentalOperation -{ - - private MessageUtils msgUtils_; - - private Boolean isStartServiceEnabled_; - private Boolean isTestServiceEnabled_; - - private IProject serviceProject_; - private String serviceServerTypeId_; - private IServer serviceExistingServer_; - - private IProject sampleProject_; - private String sampleServerTypeId_; - private IServer sampleExistingServer_; - - private boolean isWebProjectStartupRequested_; - private String moduleName_; - - /** - * Default CTOR; - */ - public ManageServerStartUpCommand( String moduleName ) { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - - moduleName_ = moduleName; - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - ProgressUtils.report(monitor, msgUtils_.getMessage("PROGRESS_INFO_START_WEB_PROJECT")); - - if (isStartServiceEnabled_.booleanValue() && serviceExistingServer_!=null){ - //System.out.println("Calling service server start: "+serviceProject_+" "+serviceServerTypeId_); - StartProjectCommand spc = new StartProjectCommand( moduleName_ ); - spc.setServiceProject(serviceProject_); - spc.setServiceServerTypeID(serviceServerTypeId_); - spc.setServiceExistingServer(serviceExistingServer_); - spc.setIsWebProjectStartupRequested(isWebProjectStartupRequested_); - spc.setEnvironment( env ); - spc.execute( null, null ); - } - - if(isTestServiceEnabled_.booleanValue()&& sampleExistingServer_!=null && serviceExistingServer_!=null && !sampleExistingServer_.equals(serviceExistingServer_)){ - //System.out.println("Calling client server start: "+sampleProject_+" "+sampleExistingServer__); - StartProjectCommand spc = new StartProjectCommand( moduleName_ ); - spc.setSampleProject(sampleProject_); - spc.setSampleServerTypeID(sampleServerTypeId_); - spc.setSampleExistingServer(sampleExistingServer_); - spc.setCreationScenario(new Boolean("false")); - spc.setEnvironment( env ); - spc.execute( null, null ); - } - - return status; - } - - /** - * @param isStartServiceEnabled The isStartServiceEnabled to set. - */ - public void setStartService(Boolean isStartServiceEnabled) { - this.isStartServiceEnabled_ = isStartServiceEnabled; - } - /** - * @param isTestServiceEnabled The isTestServiceEnabled to set. - */ - public void setTestService(Boolean isTestServiceEnabled) { - this.isTestServiceEnabled_ = isTestServiceEnabled; - } - /** - * @param serviceExistingServer The serviceExistingServer to set. - */ - public void setServiceExistingServer(IServer serviceExistingServer) { - this.serviceExistingServer_ = serviceExistingServer; - } - - /** - * @param serviceServerTypeId The serviceServerTypeId to set. - */ - public void setServiceServerTypeId(String serviceServerTypeId) { - this.serviceServerTypeId_ = serviceServerTypeId; - } - /** - * @param serviceProject The serviceProject to set. - */ - public void setServiceProject(IProject serviceProject) { - this.serviceProject_ = serviceProject; - } - - /** - * @param sampleExistingServer The sampleExistingServer to set. - */ - public void setSampleExistingServer(IServer sampleExistingServer) { - this.sampleExistingServer_ = sampleExistingServer; - } - /** - * @param sampleProject The sampleProject to set. - */ - public void setSampleProject(IProject sampleProject) { - this.sampleProject_ = sampleProject; - } - /** - * @param sampleServerTypeId The sampleServerTypeId to set. - */ - public void setSampleServerTypeId(String sampleServerTypeId) { - this.sampleServerTypeId_ = sampleServerTypeId; - } - - /** - * @param isRestartProjectNeeded The isRestartProjectNeeded to set. - */ - public void setIsWebProjectStartupRequested(boolean isRestartProjectNeeded) { - this.isWebProjectStartupRequested_ = isRestartProjectNeeded; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/PublishProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/PublishProjectCommand.java deleted file mode 100644 index 99434054a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/PublishProjectCommand.java +++ /dev/null @@ -1,108 +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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IServer; - -public class PublishProjectCommand extends EnvironmentalOperation -{ - -private MessageUtils msgUtils_; - -private String project; -private String serverTypeID; -private IServer existingServer; - - -/** - * Default CTOR; - */ -public PublishProjectCommand() { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - try - { - ProgressUtils.report( monitor, msgUtils_.getMessage( "PROGRESS_INFO_PUBLISH_WEB_PROJECT" ) ); - - if (project == null){ - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_PROJECT_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - - IProject iProject = (IProject)ResourceUtils.findResource(project); - IServer instance = ServerUtils.getServerForModule(ResourceUtils.getModule(iProject), serverTypeID, existingServer, true, monitor); - if (instance == null) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_INSTANCE_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - - IStatus returnedStatus = instance.publish(IServer.PUBLISH_INCREMENTAL, monitor); - status = returnedStatus; - - //getStatusMonitor().reportStatus (instance.publish(getProgressMonitor())); - env.getLog().log(Log.OK, 5026, this, "execute", new String("project="+project+" successfully published")); - //Log.write(PublishProjectCommand.class,"execute",Log.OK,"project="+project+" successfully published"); - return status; - } - catch (Exception e) { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_PUBLISH"), e); - env.getStatusHandler().reportError(status); - return status; - - } -} - - -public void setProject(String project) -{ - this.project = project; -} - -public void setServerTypeID(String serverTypeID) -{ - this.serverTypeID = serverTypeID; -} - -public void setExistingServer(IServer existingServer) -{ - this.existingServer = existingServer; -} - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreBuildStateCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreBuildStateCommand.java deleted file mode 100644 index dc605768a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreBuildStateCommand.java +++ /dev/null @@ -1,59 +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.command.common; - - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; - - -public class RestoreBuildStateCommand extends EnvironmentalOperation -{ - - private MessageUtils msgUtils_; - private ValidationManager manager_; - - /** - * Default CTOR; - */ - public RestoreBuildStateCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - ProgressUtils.report( monitor, msgUtils_.getMessage("TASK_DESC_WEBSERVICE_RESTORE_BUILD")); - - manager_.restoreAutoBuild(); - - return Status.OK_STATUS; - } - - /** - * @param manager_ The manager_ to set. - */ - public void setValidationManager(ValidationManager manager) { - this.manager_ = manager; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreValidationStateCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreValidationStateCommand.java deleted file mode 100644 index 91ecf689b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreValidationStateCommand.java +++ /dev/null @@ -1,62 +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.command.common; - - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; - - -public class RestoreValidationStateCommand extends EnvironmentalOperation -{ - private MessageUtils msgUtils_; - private ValidationManager manager_; - - private boolean runValidation_; - - /** - * Default CTOR; - */ - public RestoreValidationStateCommand( boolean runValidation ) - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - - runValidation_ = runValidation; - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - ProgressUtils.report( monitor, msgUtils_.getMessage("TASK_DESC_WEBSERVICE_RESTORE_VALIDATION")); - - manager_.restoreValidationForProjects( runValidation_ ); - - return Status.OK_STATUS; - } - - /** - * @param manager The validation manager to set. - */ - public void setValidationManager(ValidationManager manager) { - this.manager_ = manager; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartProjectCommand.java deleted file mode 100644 index e810cc5d8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartProjectCommand.java +++ /dev/null @@ -1,164 +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.command.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.common.WebServiceStartServerRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IServer; - -public class StartProjectCommand extends EnvironmentalOperation -{ - -private MessageUtils msgUtils_; - -private Boolean creationScenario_ = Boolean.TRUE; - -private boolean isWebProjectStartupRequested_; -private IProject serviceProject_; -private IProject sampleProject_; -private String serviceServerTypeID_; -private String sampleServerTypeID_; -private IServer serviceExistingServer_; -private IServer sampleExistingServer_; -private String moduleName_; - -// rm private Model model_; - -/** - * Default CTOR; - */ -public StartProjectCommand( String moduleName ) { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - moduleName_ = moduleName; -} - -/** - * Default CTOR; - */ -public StartProjectCommand(boolean creationScenario ) { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - creationScenario_ = new Boolean(creationScenario); -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - ProgressUtils.report( monitor, msgUtils_.getMessage("PROGRESS_INFO_START_WEB_PROJECT")); - - - IProject project = ((creationScenario_.booleanValue()) ? serviceProject_ : sampleProject_); - String serverTypeID = ((creationScenario_.booleanValue()) ? serviceServerTypeID_ : sampleServerTypeID_); - IServer server = ((creationScenario_.booleanValue()) ? serviceExistingServer_ : sampleExistingServer_); - if (serverTypeID == null && server!=null) { - serverTypeID = server.getServerType().getId(); - } - if (project == null) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_PROJECT_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - IServer instance = ServerUtils.getServerForModule(ServerUtils.getModule(project, moduleName_), serverTypeID, server, true, monitor ); - if (instance == null) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_INSTANCE_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - - try - { - AbstractStartServer startServerCommand = null; - WebServiceStartServerRegistry reg = WebServiceStartServerRegistry.getInstance(); - startServerCommand = (AbstractStartServer)reg.getServerStartByTypeId(instance.getServerType().getId()); - startServerCommand.StartServer(project, instance, monitor, isWebProjectStartupRequested_); - return status; - } - catch (CoreException ce ) - { - IStatus embeddedStatus = ce.getStatus(); - status = embeddedStatus; - env.getStatusHandler().reportError(status); - return status; - } - catch (Exception e) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SERVER"), e); - env.getStatusHandler().reportError(status); - return status; - } - -} - -public void setCreationScenario(Boolean creationScenario) -{ - creationScenario_ = creationScenario; -} - -public void setServiceProject(IProject serviceProject) -{ - serviceProject_ = serviceProject; -} - -public void setSampleProject(IProject sampleProject) -{ - sampleProject_ = sampleProject; -} - -public void setServiceServerTypeID(String serviceServerTypeID) -{ - serviceServerTypeID_ = serviceServerTypeID; -} - -public void setSampleServerTypeID(String sampleServerTypeID) -{ - sampleServerTypeID_ = sampleServerTypeID; -} - -public void setServiceExistingServer(IServer serviceExistingServer) -{ - serviceExistingServer_ = serviceExistingServer; - if (serviceExistingServer_ != null) - setServiceServerTypeID(serviceExistingServer_.getServerType().getId()); -} - -public void setSampleExistingServer(IServer sampleExistingServer) -{ - sampleExistingServer_ = sampleExistingServer; - if (sampleExistingServer_ != null) - setSampleServerTypeID(sampleExistingServer_.getServerType().getId()); -} - -public void setIsWebProjectStartupRequested(boolean webProjectStartupRequested) -{ - isWebProjectStartupRequested_ = webProjectStartupRequested; -} - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartServerCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartServerCommand.java deleted file mode 100644 index 1905d40d4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartServerCommand.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import java.lang.reflect.InvocationTargetException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.eclipse.EclipseLog; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -/** - * (Re)Starts and publishes the server specifed by the serverInstanceId attribute. - * - * - */ -public class StartServerCommand extends EnvironmentalOperation -{ - private MessageUtils msgUtils_; - private Log log; - private boolean forcePublish_; - private boolean doAsyncPublish_; - - private String serverInstanceId; - - - public StartServerCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - log = new EclipseLog(); - forcePublish_ = false; - doAsyncPublish_ = true; - } - - public StartServerCommand( boolean forcePublish, boolean doAsyncPublish ) - { - this(); - - forcePublish_ = forcePublish; - doAsyncPublish_ = doAsyncPublish; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - IServer server = ServerCore.findServer(serverInstanceId); - if (server == null) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_INSTANCE_NOT_FOUND") ); - env.getStatusHandler().reportError(status); - return status; - } - - int serverState = server.getServerState(); - int publishState = server.getServerPublishState(); - - //Publish if required - switch (publishState) - { - case IServer.PUBLISH_STATE_INCREMENTAL: - if (server.canPublish().getSeverity() == IStatus.OK) - { - status = publish(server, IServer.PUBLISH_INCREMENTAL, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - case IServer.PUBLISH_STATE_FULL: - if (server.canPublish().getSeverity() == IStatus.OK) - { - status = publish(server, IServer.PUBLISH_FULL, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - - case IServer.PUBLISH_STATE_UNKNOWN: - if (server.canPublish().getSeverity() == IStatus.OK) - { - status = publish(server, IServer.PUBLISH_INCREMENTAL, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - - //TODO: Reassess need for this, since Tomcat should know - // whether it needs to be published or not (or publish should - // simply always be driven by us. - case IServer.PUBLISH_STATE_NONE: - { - if( forcePublish_ ) - { - status = publish(server, IServer.PUBLISH_INCREMENTAL, monitor ); - - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - - break; - } - - default: - } - - - switch (serverState) - { - case IServer.STATE_STOPPED: - if (server.canStart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = start(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - case IServer.STATE_STARTED: - boolean shouldRestart = server.getServerRestartState(); - //TODO Ideally getServerRestartState() returning true should be a sufficient - //condition for us to restart. However, getServerRestartState() seems to - //sometimes pessimistically return true when it doesn't need to for Tomcat - //servers. In order to curb the number of restarts, we will only - //restart if a publish was required earlier in this execute method AND - //getServerRestartState() returns true. - //A publish is normally required when a module is added to the server. - - if (publishState != IServer.PUBLISH_STATE_NONE && shouldRestart && server.canRestart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = restart(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - } - - return status; - } - - private IStatus publish(final IServer server, final int kind, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - final IStatus[] istatus = new IStatus[1]; - monitor.subTask(msgUtils_.getMessage("PROGRESS_INFO_PUBLISHING_SERVER")); - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - istatus[0] = server.publish(kind, shellMonitor); - } - }; - - try - { - if( doAsyncPublish_ ) - { - PlatformUI.getWorkbench().getProgressService().run(true,false,runnable); - } - else - { - runnable.run( monitor ); - } - - } - catch(InvocationTargetException ite) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ite.getMessage(), ite ); - ite.printStackTrace(); - } - catch(InterruptedException ie) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ie.getMessage(), ie ); - ie.printStackTrace(); - } - - - if (istatus[0].getSeverity() != IStatus.OK) - { - status = istatus[0]; - return status; - } - - log.log(Log.INFO, 5051, this, "publishProject", "IServer=" + server + ", Publish command completed"); - return status; - } - - private IStatus restart(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(msgUtils_.getMessage("PROGRESS_INFO_STARTING_SERVER")); - server.synchronousRestart(ILaunchManager.RUN_MODE, monitor); - log.log(Log.INFO, 5052, this, "execute", "IServer=" + server + ", Restart command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SERVER"), e); - return status; - } - - } - - private IStatus start(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(msgUtils_.getMessage("PROGRESS_INFO_STARTING_SERVER")); - server.synchronousStart(ILaunchManager.RUN_MODE, monitor); - log.log(Log.INFO, 5053, this, "execute", "IServer=" + server + ", Start command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_SERVER"), e); - return status; - } - } - - public void setServerInstanceId(String serverInstanceId) - { - this.serverInstanceId = serverInstanceId; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FolderResourceFilter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FolderResourceFilter.java deleted file mode 100644 index ead065dc7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FolderResourceFilter.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.common; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.AnyFilter; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; - - -/** -* This is a kind of {@link Filter} that accepts only objects -* which indicate a Java resource. In particular, any -* {@link org.eclipse.core.resources.IResource} whose -* pathname, or any object whose string representation as -* returned by <code>toString()</code>, ends in -* "<code>.java</code>" or "<code>.class</code>" will be accepted. -* All other objects will be rejected. -*/ -public class FolderResourceFilter extends AnyFilter -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * Constructs a new <code>JavaResourceFilter</code> that filters - * "<code>.java</code>" and "<code>.class</code>" objects. - * Equivalent to <code>JavaResourceFilter(ALL_FILES)</code>. - */ - public FolderResourceFilter () { } - - /** - * Returns the locale-specific name of this filter. - * @return The locale-specific name of this filter. - */ - public String getName () - { - return WebServiceConsumptionPlugin.getMessage("%FOLDER_FILTER_NAME"); - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return WebServiceConsumptionPlugin.getMessage("%FOLDER_FILTER_DESC"); - } - - public IStatus statusOf ( Object object ) - { - if (object == null) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NULL_OBJECT"), - null - ); - } - - String name = null; - - if (object instanceof IResource) - { - IResource resource = (IResource)object; - name = resource.getFullPath().toString(); - if (resource.getType() != IResource.FOLDER) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NOT_FOLDER",new Object[] {name}), - null - ); - } - } - return new Status(IStatus.OK,WebServiceConsumptionPlugin.ID,0,"",null); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/IServerDefaulter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/IServerDefaulter.java deleted file mode 100644 index fc1f1d910..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/IServerDefaulter.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.common; - -import org.eclipse.core.resources.IProject; - - -/** - * Implement this interface to provide logic that can be plugged into - * the server defaulting algorithm. - * (See the org.eclipse.jst.ws.consumption.serverDefaulter extension point) - */ -public interface IServerDefaulter -{ - - /** - * @param project - * @return ServerInfo. - * If no existing server or server type is recommended, return null. - * If a server type is recommended, return an instance of ServerInfo with a non-null - * non-empty String for the serverFactoryId and null for the serverInstanceId. - * If a server instance is recommended, return an instance of ServerInfo with a non-null - * non-empty String for the serverFactoryId and the serverInstanceId. - */ - public ServerInfo recommendDefaultServer(IProject project); - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/JavaResourceFilter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/JavaResourceFilter.java deleted file mode 100644 index fc44f9161..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/JavaResourceFilter.java +++ /dev/null @@ -1,169 +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.common; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.AnyFilter; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; - - -/** -* This is a kind of {@link Filter} that accepts only objects -* which indicate a Java resource. In particular, any -* {@link org.eclipse.core.resources.IResource} whose -* pathname, or any object whose string representation as -* returned by <code>toString()</code>, ends in -* "<code>.java</code>" or "<code>.class</code>" will be accepted. -* All other objects will be rejected. -*/ -public class JavaResourceFilter extends AnyFilter -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * A <code>JavaResourceFilter</code> constructed with this value will - * accept "<code>.java</code>", but not "<code>.class</code>", objects. - */ - public static final byte JAVA_FILES = (byte)1; - - /** - * A <code>JavaResourceFilter</code> constructed with this value will - * accept "<code>.class</code>", but not "<code>.java</code>", objects. - */ - public static final byte CLASS_FILES = (byte)2; - - /** - * A <code>JavaResourceFilter</code> constructed with this value will - * accept both "<code>.java</code>" and "<code>.class</code>" objects. - */ - public static final byte ALL_FILES = (byte)255; - - private byte extensions_; - - /** - * Constructs a new <code>JavaResourceFilter</code> that filters - * "<code>.java</code>" and "<code>.class</code>" objects. - * Equivalent to <code>JavaResourceFilter(ALL_FILES)</code>. - */ - public JavaResourceFilter () - { - this(ALL_FILES); - } - - /** - * Constructs a new <code>JavaResourceFilter</code> that filters - * "<code>.java</code>" objects, "<code>.class</code>" objects, - * or both if the value of <code>extensions</code> is - * {@link #JAVA_FILES}, {@link #CLASS_FILES} or {@link #ALL_FILES} - * respectively. - * @param extensions One of - * {@link #JAVA_FILES}, {@link #CLASS_FILES} or {@link #ALL_FILES}. - */ - public JavaResourceFilter ( byte extensions ) - { - extensions_ = extensions; - } - - /** - * Returns the locale-specific name of this filter. - * @return The locale-specific name of this filter. - */ - public String getName () - { - return WebServiceConsumptionPlugin.getMessage("%JAVA_FILTER_NAME"); - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return WebServiceConsumptionPlugin.getMessage("%JAVA_FILTER_DESC"); - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * See {@link Filter#statusOf} for general comments. - * @param object The object to filter. - * @return An {@link org.eclipse.core.runtime.IStatus} - * indicating whether or not if the given <code>object</code> - * represents a Java resource. - */ - public IStatus statusOf ( Object object ) - { - if (object == null) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NULL_OBJECT"), - null - ); - } - - String name = null; - - if (object instanceof IResource) - { - IResource resource = (IResource)object; - name = resource.getFullPath().toString(); - if (resource.getType() != IResource.FILE) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NOT_FILE",new Object[] {name}), - null - ); - } - } - - if (name == null) - { - name = object.toString(); - } - - if (!acceptsName(name)) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%JAVA_FILTER_MSG_ERROR_WRONG_EXTENSION",new Object[] {name}), - null - ); - } - - return new Status(IStatus.OK,WebServiceConsumptionPlugin.ID,0,"",null); - } - - // - // Checks if the given name is acceptable based upon its extension - // and the value of the extensions_ bitmask. - // - private boolean acceptsName ( String name ) - { - return ( - (name.endsWith(".java") && ((extensions_ & JAVA_FILES) != 0)) || - (name.endsWith(".class") && ((extensions_ & CLASS_FILES) != 0)) - ); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/MappingUtils.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/MappingUtils.java deleted file mode 100644 index 10650e5d7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/MappingUtils.java +++ /dev/null @@ -1,84 +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.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.ws.internal.common.J2EEUtils; - - -/** -* This class contains useful methods for working with Server plugin functions -*/ -public final class MappingUtils -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private static final String DEFAULT_SERVICE_EXT = "Service.wsdl"; - private static final String DEFAULT_BINDING_EXT = "Binding.wsdl"; - private static final String DEFAULT_V4_SERVICE_EXT = "-service.wsdl"; - private static final String DEFAULT_V4_BINDING_EXT = "-binding.wsdl"; - private static final String WSDL_EXTENSION = ".wsdl"; - private static final String WSDL_FOLDER = "wsdl"; - public static final String DEFAULT_SKELETON_PACKAGENAME = "service"; - - /** - * Returns the WSDL folder path - * @param project the project - */ - public static IPath getWSDLFolderPath (IProject project, String componentName) - { - IPath wsdlFolder=null; -// IPath webModuleServerRoot = ResourceUtils.getWebModuleServerRoot( project ).getFullPath(); - IPath webModuleServerRoot = J2EEUtils.getWebContentPath(project, componentName); - if (webModuleServerRoot != null ) - wsdlFolder = webModuleServerRoot.append(WSDL_FOLDER); - return wsdlFolder; - } - - - /** - * Returns the base name based on WSDL file name - * @param wsdlName WSDL file name - */ - public static String getBaseName (String wsdlLocation ) - { - String wsdlName=wsdlLocation; - - int index = wsdlLocation.lastIndexOf('/'); - if (index!= -1) { - wsdlName = wsdlLocation.substring(index+1,wsdlName.length()); - } - - String baseName=wsdlName; - if ( wsdlName.endsWith(DEFAULT_SERVICE_EXT) ) { - baseName = wsdlName.substring(0,(wsdlName.length() - DEFAULT_SERVICE_EXT.length())); - } else if ( wsdlName.toLowerCase().endsWith(DEFAULT_V4_SERVICE_EXT) ) { - baseName = wsdlName.substring(0,(wsdlName.length() - DEFAULT_V4_SERVICE_EXT.length())); - } else if (wsdlName.endsWith(DEFAULT_BINDING_EXT)) { - baseName = wsdlName.substring(0,(wsdlName.length()-DEFAULT_BINDING_EXT.length())); - } else if (wsdlName.toLowerCase().endsWith(DEFAULT_V4_BINDING_EXT)) { - baseName = wsdlName.substring(0,(wsdlName.length()-DEFAULT_V4_BINDING_EXT.length())); - } else if (wsdlName.toLowerCase().endsWith(WSDL_EXTENSION)) { - baseName = wsdlName.substring(0,(wsdlName.length() - WSDL_EXTENSION.length())); - } else { - // no recognizable suffix, just remove extension, if any - int index4 = baseName.lastIndexOf('.'); - if (index4!=-1) - baseName = baseName.substring(0, index4); - } - return baseName; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/PropertiesResourceFilter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/PropertiesResourceFilter.java deleted file mode 100644 index 146b2f1c4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/PropertiesResourceFilter.java +++ /dev/null @@ -1,125 +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.common; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.AnyFilter; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; - - -/** -* This is a kind of {@link Filter} that accepts only objects -* which indicate a Java resource. In particular, any -* {@link org.eclipse.core.resources.IResource} whose -* pathname, or any object whose string representation as -* returned by <code>toString()</code>, ends in -* "<code>.java</code>" or "<code>.class</code>" will be accepted. -* All other objects will be rejected. -*/ -public class PropertiesResourceFilter extends AnyFilter -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructs a new <code>JavaResourceFilter</code> that filters - * "<code>.java</code>" and "<code>.class</code>" objects. - * Equivalent to <code>JavaResourceFilter(ALL_FILES)</code>. - */ - public PropertiesResourceFilter () - { - - } - - /** - * Returns the locale-specific name of this filter. - * @return The locale-specific name of this filter. - */ - public String getName () - { - return WebServiceConsumptionPlugin.getMessage("%PROPERTIES_FILTER_NAME"); - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return WebServiceConsumptionPlugin.getMessage("%PROPERTIES_FILTER_DESC"); - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * See {@link Filter#statusOf} for general comments. - * @param object The object to filter. - * @return An {@link org.eclipse.core.runtime.IStatus} - * indicating whether or not if the given <code>object</code> - * represents a Java resource. - */ - public IStatus statusOf ( Object object ) - { - if (object == null) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NULL_OBJECT"), - null - ); - } - - String name = null; - - if (object instanceof IResource) - { - IResource resource = (IResource)object; - name = resource.getFullPath().toString(); - if (resource.getType() != IResource.FILE) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NOT_FILE",new Object[] {name}), - null - ); - } - } - - if (name == null) - { - name = object.toString(); - } - - if (!name.endsWith(".properties")) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%PROPERTIES_FILTER_MSG_ERROR_WRONG_EXTENSION",new Object[] {name}), - null - ); - } - - return new Status(IStatus.OK,WebServiceConsumptionPlugin.ID,0,"",null); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ScenarioCleanupCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ScenarioCleanupCommand.java deleted file mode 100644 index 722ebb208..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ScenarioCleanupCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.common; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; - -/** - * This command is intended to clean up data after either the - * client or service wizards. Currently is just resets the - * parser factory. - * - */ -public class ScenarioCleanupCommand extends EnvironmentalOperation -{ - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - WSDLParserFactory.killParser(); - - return Status.OK_STATUS; - } - - - public IStatus undo( IProgressMonitor monitor, IAdaptable adaptable ) - { - // Even if the user cancels out of the wizard we want to - // kill the parser. - WSDLParserFactory.killParser(); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ServerInfo.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ServerInfo.java deleted file mode 100644 index 0625cb2e3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/ServerInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.common; - -/** - * - */ -public class ServerInfo -{ - String serverFactoryId; - String serverInstanceId; - /** - * @return Returns the serverFactoryId. - */ - public String getServerFactoryId() - { - return serverFactoryId; - } - /** - * @param serverFactoryId The serverFactoryId to set. - */ - public void setServerFactoryId(String serverFactoryId) - { - this.serverFactoryId = serverFactoryId; - } - /** - * @return Returns the serverInstanceId. - */ - public String getServerInstanceId() - { - return serverInstanceId; - } - /** - * @param serverInstanceId The serverInstanceId to set. - */ - public void setServerInstanceId(String serverInstanceId) - { - this.serverInstanceId = serverInstanceId; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLParserFactory.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLParserFactory.java deleted file mode 100644 index a6dd1815a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLParserFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.common; - -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -/** - * - * The factory class can be used to get at a single instance of the - * WSDL parser. Note: This class is temporary. We will probably come - * up with a better method of handling passing around the parser. - * - */ -//TODO We need to find a better way to pass around the parser than -// using this singleton factory. Hopefully, we can then delete -// this class. -public class WSDLParserFactory -{ - private static WebServicesParserExt parser_; - - private WSDLParserFactory() - { - } - - public static WebServicesParser getWSDLParser() - { - if( parser_ == null ) - { - parser_ = new WebServicesParserExt(); - } - - return parser_; - } - - public static void killParser() - { - parser_ = null; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLResourceFilter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLResourceFilter.java deleted file mode 100644 index 7872f6d3f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLResourceFilter.java +++ /dev/null @@ -1,120 +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.common; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.AnyFilter; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; - - -/** -* This is a kind of {@link Filter} that accepts only objects -* which indicate a WSDL resource. In particular, any -* {@link org.eclipse.core.resources.IResource} whose -* pathname, or any object whose string representation as -* returned by <code>toString()</code>, ends in -* "<code>.wsdl</code>" will be accepted. -* All other objects will be rejected. -*/ -public class WSDLResourceFilter extends AnyFilter -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * Constructs a new <code>WSDLResourceFilter</code>. - */ - public WSDLResourceFilter () - { - } - - /** - * Returns the locale-specific name of this filter. - * @return The locale-specific name of this filter. - */ - public String getName () - { - return WebServiceConsumptionPlugin.getMessage("%WSDL_FILTER_NAME"); - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return WebServiceConsumptionPlugin.getMessage("%WSDL_FILTER_DESC"); - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * See {@link Filter#statusOf} for general comments. - * @param object The object to filter. - * @return An {@link org.eclipse.core.runtime.IStatus} - * indicating whether or not if the given <code>object</code> - * represents a WSDL resource. - */ - public IStatus statusOf ( Object object ) - { - if (object == null) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NULL_OBJECT"), - null - ); - } - - String name = null; - - if (object instanceof IResource) - { - IResource resource = (IResource)object; - name = resource.getFullPath().toString(); - if (resource.getType() != IResource.FILE) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%FILTER_MSG_ERROR_NOT_FILE",new Object[] {name}), - null - ); - } - } - - if (name == null) - { - name = object.toString(); - } - - if (!name.endsWith(".wsdl")) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - WebServiceConsumptionPlugin.getMessage("%WSDL_FILTER_MSG_ERROR_WRONG_EXTENSION",new Object[] {name}), - null - ); - } - - return new Status(IStatus.OK,WebServiceConsumptionPlugin.ID,0,"",null); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WebServiceStartServerRegistry.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WebServiceStartServerRegistry.java deleted file mode 100644 index b03bf16f1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WebServiceStartServerRegistry.java +++ /dev/null @@ -1,101 +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.common; - -import java.util.Hashtable; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.command.internal.env.eclipse.EclipseLog; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; - - - -/** -* This is the registry of WebServiceStartServerType objects. -*/ -public class WebServiceStartServerRegistry -{ - - private static WebServiceStartServerRegistry instance_; - private Hashtable StartServerTypes; - - // - // Loads WebServiceStartServerType objects into this registry. - // See method getInstance(). - // - private void load () - { - StartServerTypes = new Hashtable(); - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption", - "webServiceStartServerType"); - - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - try - { - String factoryId_ = elem.getAttribute("factoryId"); - StartServerTypes.put(factoryId_, elem); - - } - catch (Exception e) - { - EclipseLog log = new EclipseLog(); - log.log(Log.ERROR, 5047, this, "load", e); - } - - } - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceStartServerRegistry object. - */ - public static WebServiceStartServerRegistry getInstance () - { - if (instance_ == null) - { - instance_ = new WebServiceStartServerRegistry(); - instance_.load(); - } - return instance_; - } - - public Object getServerStartByTypeId (String typeID) throws CoreException - { - if (typeID==null) - return null; - return ((IConfigurationElement)StartServerTypes.get(typeID)).createExecutableExtension("class"); - } - - public boolean isRemoveEARRequired(String typeId) throws CoreException { - if (typeId!=null) { - IConfigurationElement elem = (IConfigurationElement)StartServerTypes.get(typeId); - if (elem!=null){ - String value = elem.getAttribute("removeEAR"); - if (value!=null){ - return Boolean.valueOf(value).booleanValue(); - } - } - } - return true; - } -} - - - - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayElement.java deleted file mode 100644 index c07aa7287..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayElement.java +++ /dev/null @@ -1,99 +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.datamodel.beanmodel; - -import org.eclipse.wst.ws.internal.datamodel.BasicModel; -import org.eclipse.wst.ws.internal.datamodel.Model; - -/** -* Objects of this class represent a Java bean. -* Nearest moral equivalents: java.lang.Class, java.beans.BeanDescriptor. -*/ -public class ArrayElement extends TypeElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - public static String ARRAY_NAME = "10101010array10101010"; - public static String REL_METHODS = "relmethods"; - - /** - * Constructor - * @param projectElement The project this Bean belongs to. - */ - public ArrayElement (String name) - { - this(name,new BasicModel("Project"),true); - } - - /** - * Constructor - * @param parameterElement The parameter this Bean belongs to. - */ - public ArrayElement (String name, Model model,boolean isRoot) - { - super(name,model,TypeElement.ARRAY); - if(isRoot) model.setRootElement(this); - fOwnerType = TypeElement.ROOT; - } - - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param ParameterElement The Parameter that owns this bean type. - * @param String Name of the bean element. - */ - public ArrayElement ( ParameterElement parameterElement, String name) - { - super(name,parameterElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.ARRAY); - fOwnerType = TypeElement.PARAMETER_OWNER; - } - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param ParameterElement The Parameter that owns this bean type. - * @param String Name of the ParameterElement. - */ - public ArrayElement ( AttributeElement attributeElement, String name) - { - super(name,attributeElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.ARRAY); - fOwnerType = TypeElement.ATTRIBUTE_OWNER; - } - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param FieldElement The Parameter that owns this bean type. - * @param String Name of the ParameterElement. - */ - public ArrayElement ( FieldElement fieldElement, String name) - { - super(name,fieldElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.ARRAY); - fOwnerType = TypeElement.FIELD_OWNER; - } - - - /* - * determine wether this is an object array or - * primitive array - */ - public String getTypeName() - { - return ARRAY_NAME + getName(); - } - - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayType.java deleted file mode 100644 index 0c7ce9c62..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ArrayType.java +++ /dev/null @@ -1,62 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class ArrayType extends RecognizedReturnType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public ArrayType(String typeName) - { - this(TypeFactory.ARRAY_NAME,typeName); - } - - public ArrayType(String name,String typeName) - { - super(name); - } - - - /** - * This is basically the function that dictates how we want to display this type - * upon receiving it as a return from a proxy method - * @param String the name of the type - * @return String The display string - */ - public String TypeConversion(String name) - { - - String nonBean = Generator.DOUBLE_TAB + "java.util.List list" + getUniqueName() + "= java.util.Arrays.asList(" + name + ");" +StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "String temp"+ getUniqueName() +" = list" + getUniqueName() + ".toString();" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%=temp"+ getUniqueName() +"%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%"+ StringUtils.NEWLINE; - - return nonBean; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElement.java deleted file mode 100644 index 720679f42..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElement.java +++ /dev/null @@ -1,96 +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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -/** -* Objects of this class represent a Java bean method parameter. -* Nearest moral equivalents: java.beans.ParameterDescriptor. -*/ -public class AttributeElement extends BasicElement implements AttributeElementType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final String REL_TYPE = "type"; - public static final String REL_OWNING_BEAN = "owningbean"; - - private String fSetterMethod; - private String fGetterMethod; - - /** - * Constructor this takes the owning bean. - * @param name The name of the attribute. - * @param beanElement the bean that owns this attribute. - */ - public AttributeElement ( BeanElement beanElement, String name) - { - super(name,beanElement,REL_OWNING_BEAN,BeanElement.REL_ATTRIBUTES); - } - - public void setSetterMethod(String setterMethod) - { - fSetterMethod = setterMethod; - } - - public String getSetterMethod() - { - return fSetterMethod; - } - - public String getGetterMethod() - { - return fGetterMethod; - } - - public void setGetterMethod(String getterMethod) - { - fGetterMethod = getterMethod; - } - - public String getSetterSignature(String attribute) - { - int bracket = fSetterMethod.indexOf("("); - bracket++; - String setter = fSetterMethod.substring(0,bracket); - String fullSetter = setter + attribute + ");"; - - return fullSetter; - } - - /** - * Returns the Bean that owns this Attribute. - * @return BeanElement The bean that owns this attribute. - */ - public BeanElement getOwningBeanElement () - { - Enumeration e = getElements(REL_OWNING_BEAN); - return e.hasMoreElements() ? (BeanElement)e.nextElement() : null; - } - - /** - * Returns the type that is owned by this attributte. - * @return TypeElement The Type that of this attribute. - */ - public TypeElement getTypeElement () - { - Enumeration e = getElements(REL_TYPE); - return e.hasMoreElements() ? (TypeElement)e.nextElement() : null; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElementType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElementType.java deleted file mode 100644 index 0b0b6fc88..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElementType.java +++ /dev/null @@ -1,39 +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.datamodel.beanmodel; - - -/** -* Objects of this class represent a Java bean method parameter. -* Nearest moral equivalents: java.beans.ParameterDescriptor. -*/ -public interface AttributeElementType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public void setSetterMethod(String setterMethod); - public String getSetterMethod(); - public String getGetterMethod(); - public void setGetterMethod(String getterMethod); - public BeanElement getOwningBeanElement (); - public TypeElement getTypeElement (); - /** - * Return the signature with this value as the parmeter - * - */ - public String getSetterSignature(String attribute); - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanElement.java deleted file mode 100644 index 853da9cb8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanElement.java +++ /dev/null @@ -1,124 +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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicModel; -import org.eclipse.wst.ws.internal.datamodel.Model; - - -/** -* Objects of this class represent a Java bean. -* Nearest moral equivalents: java.lang.Class, java.beans.BeanDescriptor. -*/ -public class BeanElement extends TypeElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - public static String STATELESS_BEAN = "10101010statelessbean10101010"; - public static String REL_METHODS = "relmethods"; - - /** - * Constructor - * @param projectElement The project this Bean belongs to. - */ - public BeanElement (String name) - { - this(name,new BasicModel("Project"),true); - } - - /** - * Constructor - * @param parameterElement The parameter this Bean belongs to. - */ - public BeanElement (String name, Model model,boolean isRoot) - { - super(name,model,TypeElement.BEAN); - if(isRoot) model.setRootElement(this); - fOwnerType = TypeElement.ROOT; - } - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param ParameterElement The Parameter that owns this bean type. - * @param String Name of the bean element. - */ - public BeanElement ( ParameterElement parameterElement, String name) - { - super(name,parameterElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.BEAN); - fOwnerType = TypeElement.PARAMETER_OWNER; - } - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param ParameterElement The Parameter that owns this bean type. - * @param String Name of the ParameterElement. - */ - public BeanElement ( AttributeElement attributeElement, String name) - { - super(name,attributeElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.BEAN); - fOwnerType = TypeElement.ATTRIBUTE_OWNER; - - } - - /** - * Constructor for the case when this is not the root object - * here it represents complex types - * @param ParameterElement The Parameter that owns this bean type. - * @param String Name of the ParameterElement. - */ - public BeanElement ( FieldElement fieldElement, String name) - { - super(name,fieldElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.BEAN); - fOwnerType = TypeElement.FIELD_OWNER; - - } - - /** - * Returns an enumeration of all Method objects of this Bean. - * @return Enumeration All Method objects of this Bean. - */ - public Enumeration getMethods () - { - return getElements(REL_METHODS); - } - - /** - * Returns the number of Method objects of this Bean. - * @return int The number of Method objects of this Bean. - */ - public int getNumberOfMethodElements () - { - return getNumberOfElements(REL_METHODS); - } - - public String getTypeName() - { - if(isStateLess()) return STATELESS_BEAN + getName(); - return getName(); - } - - public boolean isStateLess() - { - Enumeration ea = getElements(TypeElement.REL_ATTRIBUTES); - Enumeration ef = getElements(TypeElement.REL_FIELDS); - if(ea.hasMoreElements() || ef.hasMoreElements()) return false; - else return true; - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanModelElementsFactory.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanModelElementsFactory.java deleted file mode 100644 index 1ed79927a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanModelElementsFactory.java +++ /dev/null @@ -1,168 +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.datamodel.beanmodel; - -import org.eclipse.jem.java.Field; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.consumption.sampleapp.common.SamplePropertyDescriptor; -import org.eclipse.wst.ws.internal.datamodel.Element; -import org.eclipse.wst.ws.internal.datamodel.Model; - -/** - * TypeFactory - * Creation date: (4/10/2001 12:41:48 PM) - * @author: Gilbert Andrews - */ -public class BeanModelElementsFactory -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - public static final String RETURN_PARAM_NAME="returnp"; - - private BeanModelElementsFactory(){} - - public static Element getBeanModelElement(Object object) - { - return BeanModelElementsFactory.getBeanModelElement(object,null,null); - } - - public static Element getBeanModelElement(Object object,Element parentElement) - { - return BeanModelElementsFactory.getBeanModelElement(object,parentElement,null); - } - - /* - * Take in an object and return an element depending on what - * type we are dealing with from the javamof - **/ - public static Element getBeanModelElement(Object object,Element parentElement, Model model) - { - Element returnElement = null; - - if (object instanceof JavaClass){ - JavaClass javaClass = (JavaClass)object; - String javaName = javaClass.getJavaName(); - if (!javaClass.isArray()){ - if(parentElement == null && model ==null) returnElement = new BeanElement(javaName); - else if(parentElement == null && model !=null) returnElement = new BeanElement(javaName,model,false); - else{ - if(parentElement instanceof ParameterElement){ - ParameterElement tempElement = (ParameterElement)parentElement; - returnElement = new BeanElement(tempElement,javaName); - } - else if(parentElement instanceof AttributeElement){ - AttributeElement tempElement = (AttributeElement)parentElement; - returnElement = new BeanElement(tempElement,javaName); - } - else if(parentElement instanceof FieldElement){ - FieldElement tempElement = (FieldElement)parentElement; - returnElement = new BeanElement(tempElement,javaName); - } - else if(parentElement instanceof MethodElement){ - returnElement = new ParameterElement((MethodElement)parentElement,RETURN_PARAM_NAME,MethodElement.REL_RETURN_PARAMETERS,true); - } - } - } - else{ - if(parentElement == null && model ==null) returnElement = new ArrayElement(javaName); - else if(parentElement == null && model !=null) returnElement = new ArrayElement(javaName,model,false); - else{ - if(parentElement instanceof ParameterElement){ - ParameterElement tempElement = (ParameterElement)parentElement; - returnElement = new ArrayElement(tempElement,javaName); - } - else if(parentElement instanceof AttributeElement){ - AttributeElement tempElement = (AttributeElement)parentElement; - returnElement = new ArrayElement(tempElement,javaName); - } - else if(parentElement instanceof FieldElement){ - FieldElement tempElement = (FieldElement)parentElement; - returnElement = new ArrayElement(tempElement,javaName); - } - else if(parentElement instanceof MethodElement){ - returnElement = new ParameterElement((MethodElement)parentElement,RETURN_PARAM_NAME,MethodElement.REL_RETURN_PARAMETERS,true); - } - - } - } - - } - else if(object instanceof SamplePropertyDescriptor){ - SamplePropertyDescriptor pd = (SamplePropertyDescriptor)object; - returnElement = new AttributeElement((BeanElement)parentElement,pd.getName()); - } - else if(object instanceof Field){ - Field field = (Field)object; - returnElement = new FieldElement((BeanElement)parentElement,field.getName()); - } - else if (object instanceof Method){ - Method method = (Method)object; - returnElement = new MethodElement((BeanElement)parentElement,method.getName(), method.getMethodElementSignature()); - } - //non beaninfo - else if (object instanceof String){ - String name = (String)object; - returnElement = new AttributeElement((BeanElement)parentElement,name); - } - else if (object instanceof JavaParameter){ - JavaParameter javaParameter = (JavaParameter)object; - - - if (javaParameter.isReturn()) - returnElement = new ParameterElement((MethodElement)parentElement,RETURN_PARAM_NAME,MethodElement.REL_RETURN_PARAMETERS,true); - else{ - //a java parameter gives us the qualified name we dont want this - String name = javaParameter.getQualifiedName(); - String shortName; - int index = name.lastIndexOf("."); - if (index != -1){ - index++; - shortName = name.substring(index); - } - else shortName = name; - - returnElement = new ParameterElement((MethodElement)parentElement,shortName,MethodElement.REL_PARAMETERS,false); - - } - - } - else if (object instanceof JavaHelpers){ - JavaHelpers javaHelper = (JavaHelpers)object; - String javaName; - if (javaHelper.isArray()) javaName = TypeFactory.ARRAY_NAME; - else javaName = javaHelper.getJavaName(); - if (parentElement instanceof ParameterElement){ - returnElement = new SimpleElement((ParameterElement)parentElement,javaName,javaHelper.isPrimitive()); - } - else if(parentElement instanceof AttributeElement){ - returnElement = new SimpleElement((AttributeElement)parentElement,javaName,javaHelper.isPrimitive()); - } - else if(parentElement instanceof FieldElement){ - returnElement = new SimpleElement((FieldElement)parentElement,javaName,javaHelper.isPrimitive()); - } - else if(parentElement instanceof MethodElement){ - returnElement = new ParameterElement((MethodElement)parentElement,RETURN_PARAM_NAME,MethodElement.REL_RETURN_PARAMETERS,true); - } - } - return returnElement; - } - - - - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigDecimalType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigDecimalType.java deleted file mode 100644 index 24da0c1c0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigDecimalType.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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public class BigDecimalType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public BigDecimalType() - { - super(TypeFactory.BIG_DECIMAL_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - return "new java.math.BigDecimal(" + name + ");"; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return name + ".toString()"; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigIntegerType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigIntegerType.java deleted file mode 100644 index acf6033cc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BigIntegerType.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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public class BigIntegerType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public BigIntegerType() - { - super(TypeFactory.BIG_INTEGER_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - return "new java.math.BigInteger(" + name + ");"; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return name + ".toString()"; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DataType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DataType.java deleted file mode 100644 index 4861a696f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DataType.java +++ /dev/null @@ -1,90 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* This class is used to simplify the codegen process -* Because codegen may be processed differently depending on the type -* we can handle how each type wants the code to look for a specific task -* by creating a datatype and calling generic methods that are -* to be specialized in subclasses -*/ -public interface DataType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_TYPE = "type"; - - /** - * This function hands back the code required to go from the - * string the user entered to the actual type of the element - * @param String typeName this is the actual name of the type ie int,boolean - * @param String nodeName The nodeName is just the attributename + Temp. - * @param String the attributeName - * @return String convert the string to type . - */ - public String stringConversion(String typeName, String nodeName, String attributeName); - - /** - * Often times in order to convert a type to string, string to type or just plain provide an input form - * A temporary variable is used. If we run into a sitution where two of the same types are used in the - * same method these temporary variables share the same name space. It isnt enough to use a name - * because of we may have a nested scenario. Therefore any temporary variable that is used in a dataType - * must use a unique name apeended to the end. This name must be passed in and it is up to the user of - * DataType to insure it is unique. - * @return Unique Name - */ - public void setUniqueName(String name); - - /** - * This is the name each temp variable will use - * - * - */ - public String getUniqueName(); - - /** - * This function dictates how you want to process the - * incoming string from the input jsp. You may or may not use the markup - * function depending on the type. The simple types use it. DomElement does not - * @param String the name of the attribute - * @return String the code to be generated - */ - public String getRequestCode(String name, String id); - - - /** - * Input form returns the user input html - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name); - - /** - * converts the type returned from the proxy - * back to a string - * @return String convert the type to string. - */ - public String TypeConversion(String name); - - /** - * return the type - * @return String the type(including package). - */ - public String getType(); -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DateType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DateType.java deleted file mode 100644 index 6a839891b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DateType.java +++ /dev/null @@ -1,125 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a type -* -*/ -public class DateType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public DateType() - { - super(TypeFactory.BIG_DECIMAL_NAME); - } - - - /** - * inputForm returns the user input html - * The simple form is just a text input box - * This has been specialized to show an example - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name) - { - String inputForm = "<TD ALIGN=\"left\"><INPUT TYPE=\"TEXT\" NAME=\"" - + name + "\" SIZE=20></TD>" + StringUtils.NEWLINE - + "<%" + StringUtils.NEWLINE - + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" + StringUtils.NEWLINE - + "java.util.GregorianCalendar gcExamp" + getUniqueName()+ " = new java.util.GregorianCalendar();" + StringUtils.NEWLINE - + "java.util.Date date" + getUniqueName()+ " = gcExamp" + getUniqueName()+ ".getTime();" + StringUtils.NEWLINE - + "String tempResult" + getUniqueName()+ " = dateFormat" + getUniqueName()+ ".format(date" + getUniqueName()+ ");" + StringUtils.NEWLINE - + "%>" + StringUtils.NEWLINE - + "<TD ALIGN=\"left\">" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE - + "<TR>" + StringUtils.NEWLINE - + "<TD> </TD>" + StringUtils.NEWLINE - + "<TD ALIGN=\"left\"> eg. <%= tempResult" + getUniqueName()+ " %> </TD>" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE; - - - - return inputForm; - } - - - /* - * This function needs to be specialized - * We must use the date function to help - * us convert back and forth - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - String conversion = Generator.DOUBLE_TAB + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" - + StringUtils.NEWLINE + Generator.DOUBLE_TAB + "java.util.Date " + nodeName + "= dateFormat" + getUniqueName()+ ".parse(" + attributeName + ");" - + "" + StringUtils.NEWLINE; - return conversion; - } - - /** - * this is needed for most case - * but it is peripheral as the stringconversion needed - * to be overridden - */ - public String StringToType(String name) - { - return ""; - } - - - - /** - * converts the type returned from the proxy - * back to a string - * @return String convert the type to string. - */ - public String TypeConversion(String name) - { - - String conversion = Generator.DOUBLE_TAB + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "String tempResult" + getUniqueName()+ " = org.eclipse.jst.ws.util.JspUtils.markup(dateFormat" + getUniqueName()+ ".format(" + name +"));" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%= tempResult" + getUniqueName()+ " %>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE; - - return conversion; - } - - - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return ""; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DomElementType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DomElementType.java deleted file mode 100644 index c0406ac6b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/DomElementType.java +++ /dev/null @@ -1,123 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a type -* -*/ -public class DomElementType implements DataType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected String fType; - protected String fUniqueName; - - /** - *Constructor - * - */ - public DomElementType() - { - fType = "org.w3c.dom.Element"; - fUniqueName = ""; - } - - /** - * inputForm returns the user input html - * The DomElement form is a text box - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name) - { - String inputForm = "<TD ALIGN=\"left\"><TEXTAREA Rows=7 Cols=45 NAME=\"" - + name + "\"></TEXTAREA></TD>" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE; - return inputForm; - } - - /** - * This function dictates how you want to process the - * incoming string from the input jsp. You may or may not use the markup - * function depending on the type. The simple types use it. DomElement does not - * @param String the name of the attribute - * @return String the code to be generated - */ - public String getRequestCode(String name, String id) - { - String requestCode = Generator.DOUBLE_TAB + "String" + Generator.SPACE - + id + "= request.getParameter(\"" - + name +"\");" + StringUtils.NEWLINE; - return requestCode; - } - - /** - * This function hands back the code required to go from the - * string the user entered to the actual type of the element - * @param String typeName this is the actual name of the type ie int,boolean - * @param String nodeName The nodeName is just the attributename + Temp. - * @param String the attributeName - * @return String convert the string to type . - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - String conversion = Generator.DOUBLE_TAB - + "org.w3c.dom.Element " + nodeName + "= org.eclipse.jst.ws.util.DomElementHelper.createDomElementFromXMLString(" + attributeName + ");" - + StringUtils.NEWLINE; - return conversion; - } - - /** - * This is basically the function that dictates how we want to display this type - * upon receiving it as a return from a proxy method - * @param String the name of the type - * @return String The display string - */ - public String TypeConversion(String name) - { - String typeToString = Generator.DOUBLE_TAB + "String tempResult" + getUniqueName()+ " = org.eclipse.jst.ws.util.DomElementHelper.domWriter(" + name + ", new java.lang.StringBuffer()" + ");" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%= tempResult" + getUniqueName()+ " %>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE; - - return typeToString; - } - - /** - * return the name of this type - * @return String the name(including package). - */ - public String getType() - { - return fType; - } - - public String getUniqueName() - { - return fUniqueName; - } - - public void setUniqueName(String name) - { - fUniqueName = name; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/FieldElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/FieldElement.java deleted file mode 100644 index b468fa935..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/FieldElement.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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -/** -* Objects of this class represent a Java bean method parameter. -* Nearest moral equivalents: java.beans.ParameterDescriptor. -*/ -public class FieldElement extends BasicElement implements AttributeElementType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private String fSetterMethod; - private String fGetterMethod; - - - public static final String REL_TYPE = "type"; - public static final String REL_OWNING_BEAN = "owningbean"; - - /** - * Constructor this takes the owning bean. - * @param name The name of the attribute. - * @param beanElement the bean that owns this attribute. - */ - public FieldElement ( BeanElement beanElement, String name) - { - super(name,beanElement,REL_OWNING_BEAN,BeanElement.REL_FIELDS); - fSetterMethod = name; - fGetterMethod = name; - } - - public void setSetterMethod(String setterMethod) - { - fSetterMethod = setterMethod; - } - - public String getSetterMethod() - { - return fSetterMethod; - } - - public String getGetterMethod() - { - return fGetterMethod; - } - - public void setGetterMethod(String getterMethod) - { - fGetterMethod = getterMethod; - } - - public String getSetterSignature(String attribute) - { - return fSetterMethod + " = " + attribute + ";"; - } - - /** - * Returns the Bean that owns this Attribute. - * @return BeanElement The bean that owns this attribute. - */ - public BeanElement getOwningBeanElement () - { - Enumeration e = getElements(REL_OWNING_BEAN); - return e.hasMoreElements() ? (BeanElement)e.nextElement() : null; - } - - /** - * Returns the type that is owned by this attributte. - * @return TypeElement The Type that of this attribute. - */ - public TypeElement getTypeElement () - { - Enumeration e = getElements(REL_TYPE); - return e.hasMoreElements() ? (TypeElement)e.nextElement() : null; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/GregorianCalendarType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/GregorianCalendarType.java deleted file mode 100644 index d7cfbf9c4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/GregorianCalendarType.java +++ /dev/null @@ -1,127 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - -/** -* objects of this class represent a type -* -*/ -public class GregorianCalendarType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public GregorianCalendarType() - { - super(TypeFactory.GREGORIAN_CALENDAR_NAME); - } - - - /** - * inputForm returns the user input html - * The simple form is just a text input box - * This has been specialized to show an example - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name) - { - String inputForm = "<TD ALIGN=\"left\"><INPUT TYPE=\"TEXT\" NAME=\"" - + name + "\" SIZE=20></TD>" + StringUtils.NEWLINE - + "<%" + StringUtils.NEWLINE - + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" + StringUtils.NEWLINE - + "java.util.GregorianCalendar gcExamp" + getUniqueName()+ " = new java.util.GregorianCalendar();" + StringUtils.NEWLINE - + "java.util.Date date" + getUniqueName()+ " = gcExamp" + getUniqueName()+ ".getTime();" + StringUtils.NEWLINE - + "String tempResult" + getUniqueName()+ " = dateFormat" + getUniqueName()+ ".format(date" + getUniqueName()+ ");" + StringUtils.NEWLINE - + "%>" + StringUtils.NEWLINE - - - + "<TD ALIGN=\"left\">" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE - + "<TR>" + StringUtils.NEWLINE - + "<TD> </TD>" + StringUtils.NEWLINE - + "<TD ALIGN=\"left\"> eg. <%= tempResult" + getUniqueName()+ " %> </TD>" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE; - - - - return inputForm; - } - - - /* - * This function needs to be specialized - * We must use the date function to help - * us convert back and forth - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - String conversion = Generator.DOUBLE_TAB + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" - + StringUtils.NEWLINE + Generator.DOUBLE_TAB + "java.util.Date dateTemp" + getUniqueName()+ " = dateFormat" + getUniqueName()+ ".parse(" + attributeName + ");" - + StringUtils.NEWLINE + Generator.DOUBLE_TAB + "java.util.GregorianCalendar" + Generator.SPACE + nodeName + " = " + "new java.util.GregorianCalendar();" - + StringUtils.NEWLINE + Generator.DOUBLE_TAB + nodeName + ".setTime(dateTemp" + getUniqueName()+ ");" - + "" + StringUtils.NEWLINE; - return conversion; - } - - /** - * this is needed for most case - * but it is peripheral as the stringconversion needed - * to be overridden - */ - public String StringToType(String name) - { - return ""; - } - - /** - * converts the type returned from the proxy - * back to a string - * @return String convert the type to string. - */ - public String TypeConversion(String name) - { - - String conversion = Generator.DOUBLE_TAB + "java.text.DateFormat dateFormat" + getUniqueName()+ " = java.text.DateFormat.getDateInstance();" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "java.util.Date date" + getUniqueName()+ " = " + name + ".getTime();" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "String tempResult" + getUniqueName()+ " = org.eclipse.jst.ws.util.JspUtils.markup(dateFormat" + getUniqueName()+ ".format(date" + getUniqueName() + "));" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%= tempResult" + getUniqueName()+ " %>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE; - - return conversion; - } - - - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return ""; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/HashtableType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/HashtableType.java deleted file mode 100644 index a1ff2cf46..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/HashtableType.java +++ /dev/null @@ -1,37 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class HashtableType extends RecognizedReturnType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public HashtableType() - { - super(TypeFactory.HASHTABLE_NAME); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MapType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MapType.java deleted file mode 100644 index 0035bfbe8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MapType.java +++ /dev/null @@ -1,37 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class MapType extends RecognizedReturnType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public MapType() - { - super(TypeFactory.MAP_NAME); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MethodElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MethodElement.java deleted file mode 100644 index d2892ffb5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MethodElement.java +++ /dev/null @@ -1,130 +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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -/** -* Objects of this class represent a Java bean method. -* Nearest moral equivalents: java.lang.reflect.Method, java.beans.MethodDescriptor. -*/ -public class MethodElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final String REL_BEAN = "bean"; - public static final String REL_PARAMETERS = "parameters"; - public static final String REL_RETURN_PARAMETERS = "returnparameters"; - private String fDisplayName; - private String fName; - private boolean fMethodOmitted; - - /** - * Constructor. - * @param bean The Bean that owns this method. - * @param name The name of the method. - * @param type The type of the method. - */ - public MethodElement ( BeanElement beanElement, String name, String displayName) - { - super(name,beanElement,REL_BEAN,BeanElement.REL_METHODS); - fDisplayName = displayName; - fName = name; - fMethodOmitted = false; - - } - - /* - * In the event that there is an unsupported type - * we will set the ommission boolean variable - * @return boolean true if this method is to be ommited - */ - public boolean getMethodOmmission() - { - return fMethodOmitted; - } - - /* - * In the event that there is an unsupported type - * we will get the ommission boolean variable - * @param boolean true if this method is to be ommited - */ - public void setMethodOmmission(boolean bool) - { - fMethodOmitted = bool; - } - - - public String getName() - { - return fName; - } - - public String getDisplayName() - { - return fDisplayName; - } - - /** - * Returns the Bean that owns this method. - * @return Bean The Bean that owns this method. - */ - public BeanElement getBeanElement () - { - Enumeration e = getElements(REL_BEAN); - return e.hasMoreElements() ? (BeanElement)e.nextElement() : null; - } - - /** - * Returns an enumeration of the return parameter of this method. - * @return Enumeration holds the return parameter of this method. - */ - public Enumeration getReturnParameterEnum () - { - return getElements(REL_RETURN_PARAMETERS); - } - - /** - * Returns an enumeration of the return parameter of this method. - * @return Enumeration holds the return parameter of this method. - */ - public ParameterElement getReturnParameterElement () - { - Enumeration e = getReturnParameterEnum(); - return e.hasMoreElements() ? (ParameterElement)e.nextElement() : null; - } - - /** - * Returns an enumeration of all Parameter objects of this method. - * @return Enumeration All Parameter objects of this method. - */ - public Enumeration getParameterElements () - { - return getElements(REL_PARAMETERS); - } - - /** - * Returns the number of Parameter objects of this method. - * @return int The number of Parameter objects of this method. - */ - public int getNumberOfParameterElements () - { - return getNumberOfElements(REL_PARAMETERS); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ParameterElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ParameterElement.java deleted file mode 100644 index 02b0678d5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ParameterElement.java +++ /dev/null @@ -1,84 +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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -/** -* Objects of this class represent a Java bean method parameter. -* Nearest moral equivalents: java.beans.ParameterDescriptor. -*/ -public class ParameterElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final String REL_METHOD = "method"; - public static final String REL_TYPE = "type"; - - public boolean fReturnParameter=false; - - /** - * Constructor. - * @param method The Method that owns this parameter. - * @param name The name of the parameter. - * @param type The type of the parameter. - */ - public ParameterElement ( MethodElement methodElement, String name, String relType,boolean returnParameter ) - { - this(name,methodElement,REL_METHOD,relType); - fReturnParameter = returnParameter; - } - - /** - * Constructor. - * @param method The Method that owns this parameter. - * @param name The name of the parameter. - * @param type The type of the parameter. - */ - public ParameterElement (String name, MethodElement methodElement, String outRel,String inRel) - { - super(name,methodElement,outRel,inRel); - } - - /** - * Returns the Method that owns this parameter. - * @return Method The Method that owns this parameter. - */ - public MethodElement getMethodElement () - { - Enumeration e = getElements(REL_METHOD); - return e.hasMoreElements() ? (MethodElement)e.nextElement() : null; - } - - /** - * Returns the Method that owns this parameter. - * @return Method The Method that owns this parameter. - */ - public TypeElement getTypeElement () - { - Enumeration e = getElements(REL_TYPE); - return e.hasMoreElements() ? (TypeElement)e.nextElement() : null; - } - - public boolean isReturn() - { - return fReturnParameter; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveArrayType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveArrayType.java deleted file mode 100644 index 387306178..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveArrayType.java +++ /dev/null @@ -1,65 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class PrimitiveArrayType extends ArrayType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveArrayType(String typeName) - { - super(TypeFactory.PRIMITIVE_ARRAY_NAME, typeName); - } - - /** - * This is basically the function that dictates how we want to display this type - * upon receiving it as a return from a proxy method - * @param String the name of the type - * @return String The display string - */ - public String TypeConversion(String name) - { - String trippleTab = Generator.DOUBLE_TAB + Generator.TAB; - - String nonBean = Generator.DOUBLE_TAB + "String temp" + getUniqueName() + " = \"[\";" - + Generator.DOUBLE_TAB + "for(int i" + getUniqueName() + "=0;i" +getUniqueName() + "< " + name - + ".length;i" + getUniqueName() + "++){" + StringUtils.NEWLINE - + trippleTab + "temp"+ getUniqueName() +" = temp"+getUniqueName() + " + " + name + "[i" + getUniqueName() - + "] + \",\";" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "}" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "int length" + getUniqueName() + " = temp" + getUniqueName() + ".length();" - + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "temp" + getUniqueName() + " = temp"+getUniqueName()+".substring(0,(length"+getUniqueName()+" - 1)) + \"]\";" - + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%=temp"+ getUniqueName() +"%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%"+ StringUtils.NEWLINE; - - return nonBean; - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveBooleanType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveBooleanType.java deleted file mode 100644 index f58ad9d80..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveBooleanType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveBooleanType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveBooleanType() - { - super(TypeFactory.PRIM_BOOLEAN_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Boolean.valueOf(" + name + ").booleanValue();"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveByteType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveByteType.java deleted file mode 100644 index 5045d26dd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveByteType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveByteType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveByteType() - { - super(TypeFactory.PRIM_BYTE_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Byte.parseByte(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveCharType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveCharType.java deleted file mode 100644 index d52f90393..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveCharType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveCharType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveCharType() - { - super(TypeFactory.PRIM_CHAR_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "" + name + ".charAt(0);"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveDoubleType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveDoubleType.java deleted file mode 100644 index 7b362e718..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveDoubleType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveDoubleType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveDoubleType() - { - super(TypeFactory.PRIM_DOUBLE_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Double.parseDouble(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveFloatType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveFloatType.java deleted file mode 100644 index 200f9d7ca..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveFloatType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveFloatType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveFloatType() - { - super(TypeFactory.PRIM_FLOAT_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Float.parseFloat(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveIntType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveIntType.java deleted file mode 100644 index 2f33dd929..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveIntType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveIntType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveIntType() - { - super(TypeFactory.PRIM_INTEGER_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Integer.parseInt(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveJavaTypes.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveJavaTypes.java deleted file mode 100644 index f71523669..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveJavaTypes.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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveJavaTypes extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveJavaTypes(String type) - { - super(type); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - String conversion = fType + ".valueOf(" + name + ");"; - return conversion; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return "String.valueOf(" + name + ")"; - } - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveLongType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveLongType.java deleted file mode 100644 index ef0c82698..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveLongType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveLongType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveLongType() - { - super(TypeFactory.PRIM_LONG_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Long.parseLong(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveShortType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveShortType.java deleted file mode 100644 index 8f91ce6ac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveShortType.java +++ /dev/null @@ -1,48 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class PrimitiveShortType extends PrimitiveType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveShortType() - { - super(TypeFactory.PRIM_SHORT_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type. - */ - public String StringToType(String name) - { - String conversion = "Short.parseShort(" + name + ");"; - return conversion; - } - - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveType.java deleted file mode 100644 index 4b5176766..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/PrimitiveType.java +++ /dev/null @@ -1,47 +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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public abstract class PrimitiveType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public PrimitiveType(String type) - { - super(type); - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return "String.valueOf(" + name + ")"; - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/RecognizedReturnType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/RecognizedReturnType.java deleted file mode 100644 index fc721a809..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/RecognizedReturnType.java +++ /dev/null @@ -1,108 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class RecognizedReturnType implements DataType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected String fType; - protected String fUniqueName; - - /** - *Constructor - * - */ - public RecognizedReturnType(String type) - { - fType = type; - fUniqueName = ""; - } - - /** - * not relevant at this point - */ - public String inputForm(String name) - { - return ""; - } - - /** - * again not relevant - */ - public String getRequestCode(String name, String id) - { - return ""; - } - - /** - * This function hands back the code required to go from the - * string the user entered to the actual type of the element - * @param String typeName this is the actual name of the type ie int,boolean - * @param String nodeName The nodeName is just the attributename + Temp. - * @param String the attributeName - * @return String convert the string to type . - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - return ""; - } - - /** - * This is basically the function that dictates how we want to display this type - * upon receiving it as a return from a proxy method - * @param String the name of the type - * @return String The display string - */ - public String TypeConversion(String name) - { - String nonBean = Generator.DOUBLE_TAB + "if(" + name + "!= null){" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "String temp" + getUniqueName()+" = " + name + ".toString();" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%=temp" + getUniqueName() +"%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "}"; - return nonBean; - } - - /** - * return the name of this type - * @return String the name(including package). - */ - public String getType() - { - return fType; - } - - public String getUniqueName() - { - return fUniqueName; - } - - public void setUniqueName(String name) - { - fUniqueName = name; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SOAPElementType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SOAPElementType.java deleted file mode 100644 index 289e009e5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SOAPElementType.java +++ /dev/null @@ -1,123 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a type -* -*/ -public class SOAPElementType implements DataType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected String fType; - protected String fUniqueName; - - /** - *Constructor - * - */ - public SOAPElementType() - { - fType = "javax.xml.soap.SOAPElement"; - fUniqueName = ""; - } - - /** - * inputForm returns the user input html - * The DomElement form is a text box - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name) - { - String inputForm = "<TD ALIGN=\"left\"><TEXTAREA Rows=7 Cols=45 NAME=\"" - + name + "\"></TEXTAREA></TD>" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE; - return inputForm; - } - - /** - * This function dictates how you want to process the - * incoming string from the input jsp. You may or may not use the markup - * function depending on the type. The simple types use it. DomElement does not - * @param String the name of the attribute - * @return String the code to be generated - */ - public String getRequestCode(String name, String id) - { - String requestCode = Generator.DOUBLE_TAB + "String" + Generator.SPACE - + id + "= request.getParameter(\"" - + name +"\");" + StringUtils.NEWLINE; - return requestCode; - } - - /** - * This function hands back the code required to go from the - * string the user entered to the actual type of the element - * @param String typeName this is the actual name of the type ie int,boolean - * @param String nodeName The nodeName is just the attributename + Temp. - * @param String the attributeName - * @return String convert the string to type . - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - String conversion = Generator.DOUBLE_TAB - + "javax.xml.soap.SOAPElement " + nodeName + "= org.eclipse.jst.ws.util.SoapElementHelper.createSOAPElementFromXMLString(" + attributeName + ");" - + StringUtils.NEWLINE; - return conversion; - } - - /** - * This is basically the function that dictates how we want to display this type - * upon receiving it as a return from a proxy method - * @param String the name of the type - * @return String The display string - */ - public String TypeConversion(String name) - { - String typeToString = Generator.DOUBLE_TAB + "String tempResult" + getUniqueName()+ " = org.eclipse.jst.ws.util.SoapElementHelper.soapElementWriter(" + name + ", new java.lang.StringBuffer()" + ");" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%= tempResult" + getUniqueName()+ " %>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE; - - return typeToString; - } - - /** - * return the name of this type - * @return String the name(including package). - */ - public String getType() - { - return fType; - } - - public String getUniqueName() - { - return fUniqueName; - } - - public void setUniqueName(String name) - { - fUniqueName = name; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleElement.java deleted file mode 100644 index f478345d1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleElement.java +++ /dev/null @@ -1,62 +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.datamodel.beanmodel; - - -/** -* 1 of three type elements represents primitives -*/ -public class SimpleElement extends TypeElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - * Constructor - * @param ParameterElement The Parameter that owns this simple type. - * @param String Name of the simple element. - */ - public SimpleElement ( ParameterElement parameterElement, String name, boolean prim) - { - super(name,parameterElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.SIMPLE); - fOwnerType = TypeElement.PARAMETER_OWNER; - setPrimitive(prim); - } - - /** - * Constructor - * @param ParameterElement The Attribute that owns this simple type. - * @param String Name of the AttributeElement. - */ - public SimpleElement ( AttributeElement attributeElement, String name, boolean prim) - { - super(name,attributeElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.SIMPLE); - fOwnerType = TypeElement.ATTRIBUTE_OWNER; - setPrimitive(prim); - } - - /** - * Constructor - * @param ParameterElement The Attribute that owns this simple type. - * @param String Name of the AttributeElement. - */ - public SimpleElement ( FieldElement fieldElement, String name, boolean prim) - { - super(name,fieldElement,TypeElement.REL_OWNER,TypeElement.REL_TYPE,TypeElement.SIMPLE); - fOwnerType = TypeElement.FIELD_OWNER; - setPrimitive(prim); - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleType.java deleted file mode 100644 index e81948248..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/SimpleType.java +++ /dev/null @@ -1,140 +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.datamodel.beanmodel; - -import org.eclipse.jst.ws.internal.common.StringUtils; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; - - -/** -* objects of this class represent a type -* -*/ -public abstract class SimpleType implements DataType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected String fType; - protected String fUniqueName; - - /** - *Constructor - * - */ - public SimpleType(String type) - { - fType = type; - } - - /** - * inputForm returns the user input html - * The simple form is just a text input box - * @param String name The name of the input element - * @return String The form used to collect the data - */ - public String inputForm(String name) - { - String inputForm = "<TD ALIGN=\"left\"><INPUT TYPE=\"TEXT\" NAME=\"" - + name + "\" SIZE=20></TD>" + StringUtils.NEWLINE - + "</TR>" + StringUtils.NEWLINE; - return inputForm; - } - - /** - * This function dictates how you want to process the - * incoming string from the input jsp. You may or may not use the markup - * function depending on the type. The simple types use it. DomElement does not - * @param String the name of the attribute - * @return String the code to be generated - */ - public String getRequestCode(String name, String id) - { - String requestCode = Generator.DOUBLE_TAB + "String" + Generator.SPACE - + id + "= request.getParameter(\"" - + name +"\");" + StringUtils.NEWLINE; - return requestCode; - } - - /** - * This function hands back the code required to go from the - * string the user entered to the actual type of the element - * it uses another function that all subclasses of SimpleType are required to implement - * The StringToType function - * @param String typeName this is the actual name of the type ie int,boolean - * @param String nodeName The nodeName is just the attributename + Temp. - * @param String the attributeName - * @return String convert the string to type . - */ - public String stringConversion(String typeName, String nodeName, String attributeName) - { - String conversion = Generator.DOUBLE_TAB + typeName + Generator.SPACE + nodeName - + Generator.SPACE + " = " + StringToType(attributeName) - + "" + StringUtils.NEWLINE; - return conversion; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public abstract String StringToType(String name); - - /** - * converts the type returned from the proxy - * back to a string - * @return String convert the type to string. - */ - public String TypeConversion(String name) - { - - String conversion = Generator.DOUBLE_TAB + "String tempResult" + getUniqueName()+ " = org.eclipse.jst.ws.util.JspUtils.markup(" + TypeToString(name) + ");" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "%>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%= tempResult" + getUniqueName()+ " %>" + StringUtils.NEWLINE - + Generator.DOUBLE_TAB + "<%" + StringUtils.NEWLINE; - - return conversion; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public abstract String TypeToString(String name); - - /** - * return the name of this type - * @return String the name(including package). - */ - public String getType() - { - return fType; - } - - public String getUniqueName() - { - return fUniqueName; - } - - public void setUniqueName(String name) - { - fUniqueName = name; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StateLessBeanType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StateLessBeanType.java deleted file mode 100644 index 50cb4cfbe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StateLessBeanType.java +++ /dev/null @@ -1,38 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class StateLessBeanType extends RecognizedReturnType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - - public StateLessBeanType(String name) - { - super(TypeFactory.STATELESS_BEAN); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StringType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StringType.java deleted file mode 100644 index 1b99c746e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/StringType.java +++ /dev/null @@ -1,57 +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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public class StringType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public StringType() - { - super(TypeFactory.STRING_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - String conversion = name + ";"; - return conversion; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return "String.valueOf(" + name + ")"; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeElement.java deleted file mode 100644 index a8f22cd61..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeElement.java +++ /dev/null @@ -1,193 +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.datamodel.beanmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; -import org.eclipse.wst.ws.internal.datamodel.Element; -import org.eclipse.wst.ws.internal.datamodel.Model; - -/** -* TypeElement is the base class for Java bean features that have types. -*/ -public abstract class TypeElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static int BEAN = 0; - public static int SIMPLE = 1; - public static int ARRAY = 2; - - private int fType; - protected int fOwnerType; - private boolean fPrimitive = false; - - /** - * Constructor. Automatically adds this object to the given model. - * @param name The name of the element - * @param model The model to own this object. - * @param type The type represented by this object, one of - * <code>BEAN</code>, <code>SIMPLE</code> or <code>ARRAY</code>. - */ - protected TypeElement ( String name, Model model, int type ) - { - super(name,model); - fType = type; - } - - /** - */ - protected TypeElement ( String name, Element element, String outboundRelName, String inboundRelName, int type ) - { - super(name,element,outboundRelName,inboundRelName); - fType = type; - } - - /* - *This will tell you wether the type is a bean - *@param Boolean returns true if this is bean - **/ - public boolean isBean() - { - if (fType == BEAN) return true; - return false; - } - - /* - *This will tell you wether the type is a bean - *@param Boolean returns true if this is bean - **/ - public boolean isPrimitive() - { - return fPrimitive; - } - - /* - *This will tell you wether the type is a bean - *@param Boolean returns true if this is bean - **/ - protected void setPrimitive(boolean prim) - { - fPrimitive = prim; - } - - - /* - * This is mainly needed for arrays as with all types the - * names come out as java.util.type, but with an array it - * isnt explicit in telling us its an array - */ - public String getTypeName() - { - return getName(); - } - - /* - *This will tell you wether the type is a simple - *@param Boolean returns true if this is simple - **/ - public boolean isSimple() - { - if (fType == SIMPLE) return true; - return false; - } - - /* - *This will tell you wether the type is a array - *@param Boolean returns true if this is array - **/ - public boolean isArray() - { - if (fType == ARRAY) return true; - return false; - } - - public static String REL_ATTRIBUTES = "attributes"; - public static String REL_FIELDS = "fields"; - public static final String REL_TYPE = "type"; - public static final String REL_OWNER = "owner"; - - public static int PARAMETER_OWNER = 0; - public static int ATTRIBUTE_OWNER = 1; - public static int FIELD_OWNER = 2; - public static int ROOT = 3; - - /* - * This could be The root test bean - * @return boolean true if this is root bean - */ - public boolean isRoot() - { - if(fOwnerType == ROOT) return true; - return false; - } - - /* - * This Type could be owned by a Parameter or an attribute - * @return boolean true if this is owned by a parameter - */ - public boolean isOwnerParameter() - { - if(fOwnerType == PARAMETER_OWNER) return true; - return false; - } - - /* - * This Type could be owned by a Parameter or an attribute - * @return boolean true if this is owned by an attribute - */ - public boolean isOwnerAttribute() - { - if(fOwnerType == ATTRIBUTE_OWNER) return true; - return false; - } - - /* - * This Type could be owned by a Parameter or an attribute - * @return boolean true if this is owned by an attribute - */ - public boolean isOwnerField() - { - if(fOwnerType == FIELD_OWNER) return true; - return false; - } - - /** - * This Type may be owned by a parameter or an attribute - * Use this method in conjunction with isOwnerParamter, isOwner - * @return BasicElement the element that owns this attribute. - */ - public BasicElement getOwningElement () - { - if (isOwnerParameter()){ - Enumeration e = getElements(REL_OWNER); - return e.hasMoreElements() ? (BasicElement)e.nextElement() : null; - } - else if(isOwnerAttribute()){ - Enumeration e = getElements(REL_OWNER); - return e.hasMoreElements() ? (BasicElement)e.nextElement() : null; - } - else if(isOwnerField()){ - Enumeration e = getElements(REL_OWNER); - return e.hasMoreElements() ? (BasicElement)e.nextElement() : null; - } - - return null; - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeFactory.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeFactory.java deleted file mode 100644 index 4f9822aec..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeFactory.java +++ /dev/null @@ -1,249 +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.datamodel.beanmodel; - -import java.util.Hashtable; - -import org.eclipse.jem.java.JavaHelpers; -/** - * TypeFactory - * Creation date: (4/10/2001 12:41:48 PM) - * @author: Gilbert Andrews - */ -public class TypeFactory -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static final String URL_NAME = "java.net.URL"; - public static final String STRING_NAME = "java.lang.String"; - public static final String BIG_DECIMAL_NAME = "java.math.BigDecimal"; - public static final String BIG_INTEGER_NAME = "java.math.BigInteger"; - public static final String DATE_NAME = "java.util.Date"; - public static final String GREGORIAN_CALENDAR_NAME = "java.util.GregorianCalendar"; - public static final String CALENDAR_NAME = "java.util.Calendar"; - public static final String BOOLEAN_NAME = "java.lang.Boolean"; - public static final String BYTE_NAME = "java.lang.Byte"; - public static final String DOUBLE_NAME = "java.lang.Double"; - public static final String FLOAT_NAME = "java.lang.Float"; - public static final String INTEGER_NAME = "java.lang.Integer"; - public static final String LONG_NAME = "java.lang.Long"; - public static final String SHORT_NAME = "java.lang.Short"; - public static final String CHARACTER_NAME = "java.lang.Character"; - public static final String PRIM_BOOLEAN_NAME = "boolean"; - public static final String PRIM_BYTE_NAME = "byte"; - public static final String PRIM_DOUBLE_NAME = "double"; - public static final String PRIM_FLOAT_NAME = "float"; - public static final String PRIM_INTEGER_NAME = "int"; - public static final String PRIM_LONG_NAME = "long"; - public static final String PRIM_SHORT_NAME = "short"; - public static final String PRIM_CHAR_NAME = "char"; - public static final String VOID_NAME = "void"; - - //some special complex - public static final String DOM_ELEMENT_NAME = "org.w3c.dom.Element"; - public static final String SOAP_ELEMENT_NAME = "javax.xml.soap.SOAPElement"; - public static final String STATELESS_BEAN = BeanElement.STATELESS_BEAN; - - - - public static Hashtable javaTypes = new Hashtable(); - - public TypeFactory(){} - - static{ - javaTypes.put(BOOLEAN_NAME,new PrimitiveJavaTypes(BOOLEAN_NAME)); - javaTypes.put(BYTE_NAME, new PrimitiveJavaTypes(BYTE_NAME)); - javaTypes.put(DOUBLE_NAME, new PrimitiveJavaTypes(DOUBLE_NAME)); - javaTypes.put(FLOAT_NAME, new PrimitiveJavaTypes(FLOAT_NAME)); - javaTypes.put(INTEGER_NAME,new PrimitiveJavaTypes(INTEGER_NAME)); - javaTypes.put(LONG_NAME, new PrimitiveJavaTypes(LONG_NAME)); - javaTypes.put(SHORT_NAME, new PrimitiveJavaTypes(SHORT_NAME)); - javaTypes.put(CHARACTER_NAME, new PrimitiveJavaTypes(CHARACTER_NAME)); - } - - - /* - * This function allows us to handle recognized beans - * in displaying and generating code for them instead of - * treating them as complex types - */ - public static boolean recognizedBean(String type) - { - - // - //current recognized beans (mostly java.lang) - if (type.equals(BOOLEAN_NAME) || - type.equals(BYTE_NAME) || - type.equals(DOUBLE_NAME) || - type.equals(FLOAT_NAME) || - type.equals(INTEGER_NAME) || - type.equals(LONG_NAME) || - type.equals(SHORT_NAME) || - type.equals(CHARACTER_NAME) || - type.equals(DOM_ELEMENT_NAME) || - type.equals(SOAP_ELEMENT_NAME) || - type.equals(BIG_DECIMAL_NAME) || - type.equals(BIG_INTEGER_NAME) || - type.equals(DATE_NAME) || - type.equals(GREGORIAN_CALENDAR_NAME) || - type.equals(CALENDAR_NAME) || - type.equals(URL_NAME) || - type.equals(STRING_NAME)) return true; - return false; - - } - - /* - * This function allows us to handle unsupported types - * if we dont want to support a type and we want to omitt this - * method from the samples - * @param javaHelpers this is the type to be evaluated - * @return boolean true if the type is not supported - */ - public static boolean isUnSupportedType(JavaHelpers javaHelpers) - { - //we also dont support arrays - if (javaHelpers.isArray()|| - javaHelpers.getJavaName().equals(MAP_NAME)|| - javaHelpers.getJavaName().equals(VECTOR_NAME)|| - javaHelpers.getJavaName().equals("java.lang.class") ) return true; - - return false; - } - - public static String HASHTABLE_NAME = "java.util.Hashtable"; - public static String MAP_NAME = "java.util.Map"; - public static String VECTOR_NAME = "java.util.Vector"; - public static String ARRAY_NAME = ArrayElement.ARRAY_NAME; - public static String PRIMITIVE_ARRAY_NAME = "primitivearray"; - - public static boolean isRecognizedReturnType(JavaHelpers javaHelpers) - { - //arrays - //Hashtable - //Vectors - if (javaHelpers.isArray()) return true; - else if (javaHelpers.getJavaName().equals(HASHTABLE_NAME))return true; - else if (javaHelpers.getJavaName().equals(VECTOR_NAME))return true; - else if (javaHelpers.getJavaName().equals(MAP_NAME))return true; - else return false; - } - - public static boolean isRecognizedReturnType(String type) - { - //arrays - //Hashtable - //Vectors - if (type.startsWith(ARRAY_NAME)) return true; - else if (type.equals(HASHTABLE_NAME))return true; - else if (type.equals(VECTOR_NAME))return true; - else if (type.equals(MAP_NAME))return true; - else return false; - } - - public static boolean isStateLessBean(String type) - { - if(type.startsWith(STATELESS_BEAN)) return true; - return false; - } - - - /** - * Creates a type based on the JavaHelper then sets this type in the element - * @params JavaHelpers this holds the type - * @param TypeElement The element which will hold the type created - * @param String Uniquename to be used when naming temp variables - */ - - public static DataType createType(String type, String UniqueName) - { - //this guy might be both stateless and one of the below elements - //we would like to be as specific as we can, stateless is the worst case - boolean stateless = false; - if(type.startsWith(STATELESS_BEAN)) { - stateless = true; - type = type.substring(29); - } - - DataType datatype = null; - if (type.equals(PRIM_BOOLEAN_NAME)) datatype = new PrimitiveBooleanType(); - else if (type.equals(PRIM_BYTE_NAME)) datatype = new PrimitiveByteType(); - else if (type.equals(PRIM_DOUBLE_NAME)) datatype = new PrimitiveDoubleType(); - else if (type.equals(PRIM_FLOAT_NAME)) datatype = new PrimitiveFloatType(); - else if (type.equals(PRIM_LONG_NAME)) datatype = new PrimitiveLongType(); - else if (type.equals(PRIM_INTEGER_NAME)) datatype = new PrimitiveIntType(); - else if (type.equals(PRIM_CHAR_NAME)) datatype = new PrimitiveCharType(); - else if (type.equals(PRIM_SHORT_NAME)) datatype = new PrimitiveShortType(); - - - //see if this critter is a javatype - else if (type.equals(BOOLEAN_NAME) || - type.equals(BYTE_NAME) || - type.equals(DOUBLE_NAME) || - type.equals(FLOAT_NAME) || - type.equals(INTEGER_NAME) || - type.equals(LONG_NAME) || - type.equals(CHARACTER_NAME) || - type.equals(SHORT_NAME)) datatype = (DataType)javaTypes.get(type); - - //see if its a case we handle - else if (type.equals(STRING_NAME)) datatype = new StringType(); - else if (type.equals(VOID_NAME)) datatype = new VoidType(); - else if (type.equals(DOM_ELEMENT_NAME)) datatype = new DomElementType(); - else if (type.equals(SOAP_ELEMENT_NAME)) datatype = new SOAPElementType(); - else if (type.equals(BIG_DECIMAL_NAME)) datatype = new BigDecimalType(); - else if (type.equals(BIG_INTEGER_NAME)) datatype = new BigIntegerType(); - else if (type.equals(DATE_NAME)) datatype = new DateType(); - else if (type.equals(URL_NAME)) datatype = new URLType(); - else if (type.equals(GREGORIAN_CALENDAR_NAME)) datatype = new GregorianCalendarType(); - else if (type.equals(CALENDAR_NAME)) datatype = new GregorianCalendarType(); - - //it could be a return type we support - else if (type.equals(HASHTABLE_NAME)) datatype = new HashtableType(); - else if (type.equals(VECTOR_NAME)) datatype = new VectorType(); - else if (type.equals(MAP_NAME)) datatype = new MapType(); - - // need to see if it is an object array - //or a primitive - else if (type.startsWith(ARRAY_NAME)){ - String name = type.substring(21); - if(name.startsWith(PRIM_BOOLEAN_NAME) || - name.startsWith(PRIM_BYTE_NAME) || - name.startsWith(PRIM_DOUBLE_NAME) || - name.startsWith(PRIM_FLOAT_NAME) || - name.startsWith(PRIM_LONG_NAME) || - name.startsWith(PRIM_INTEGER_NAME) || - name.startsWith(PRIM_CHAR_NAME) || - name.startsWith(PRIM_SHORT_NAME)) - datatype = new PrimitiveArrayType(name); - else - datatype = new ArrayType(name); - - } - else if (stateless){ - datatype = new StateLessBeanType(type); - - } - - - datatype.setUniqueName(UniqueName); - return datatype; - - } - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/URLType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/URLType.java deleted file mode 100644 index 9c0fb28c8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/URLType.java +++ /dev/null @@ -1,57 +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.datamodel.beanmodel; - -/** -* objects of this class represent a type -* -*/ -public class URLType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public URLType() - { - super(TypeFactory.URL_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - String conversion = "new java.net.URL(" + name + ");"; - return conversion; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return name + ".toString()"; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VectorType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VectorType.java deleted file mode 100644 index 5a0718ddc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VectorType.java +++ /dev/null @@ -1,37 +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.datamodel.beanmodel; - - -/** -* objects of this class represent a recognized return type -* -*/ -public class VectorType extends RecognizedReturnType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public VectorType() - { - super(TypeFactory.VECTOR_NAME); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VoidType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VoidType.java deleted file mode 100644 index 5fde91e13..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/VoidType.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.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class VoidType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public VoidType() - { - super("void"); - } - - /** - * for a void there is no need to return - * @return String convert the string to type . - */ - public String StringToType(String name) - { - return ""; - } - - /** - * The stringConversion function nails out specific conversion methods used among simple types - * This method is to be implemented by SimpleType subclasses - * @param String the name of string after the request call - * @return String the actual conversion string containing the name. - */ - public String TypeToString(String name) - { - return "String.valueOf(" + name + ")"; - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/validate/ValidationManager.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/validate/ValidationManager.java deleted file mode 100644 index 1e8647fd2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/validate/ValidationManager.java +++ /dev/null @@ -1,112 +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.datamodel.validate; - -import java.util.HashSet; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceDescription; -import org.eclipse.core.resources.ResourcesPlugin; - -/** - * This class manages the validation state of projects that some tasks may want - * to disable. The manager can then be used to restore the validation state. -**/ -public class ValidationManager -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * This set contains a set of IProjects that need to be validated. - **/ - private HashSet projects = null; - - /** - * This object contains a reference to the j2ee validator. - **/ - //pgm private ValidatorManager j2eeManager = null; - - /** - * This boolean contains the auto build setting under preferrence - **/ - private boolean isAutoBuild_; - private boolean autoBuildDisabled_; - - public ValidationManager() - { - projects = new HashSet(); - //pgm j2eeManager = ValidatorManager.getManager(); - setAutoBuildPreference(); - autoBuildDisabled_ = false; - } - - /** - * Disables the validation for a project if required. - **/ - public void disableValidationForProject( IProject project ) - { - // We need to remember that this project needs have validation turned back on. - projects.add( project ); - - //pgm j2eeManager.suspendAllValidation( true ); - } - - /** - * Restores the validation state for all needed projects. - **/ - public void restoreValidationForProjects( boolean runValidation ) - { - } - - public void modifyAutoBuild(boolean isAutoBuild) { - try { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceDescription workspaceDesc = workspace.getDescription(); - workspaceDesc.setAutoBuilding(isAutoBuild); - workspace.setDescription(workspaceDesc); - } - catch (Exception e) {} - } - - public void disableAutoBuild() { - if (!autoBuildDisabled_) { - setAutoBuildPreference(); - modifyAutoBuild(false); - autoBuildDisabled_ = true; - } - } - - public void restoreAutoBuild() { - if (autoBuildDisabled_) { - modifyAutoBuild(getAutoBuildPreference()); - autoBuildDisabled_ = false; - } - } - - public boolean setAutoBuildPreference() { - isAutoBuild_ = getWorkspaceAutoBuildPreference(); - return isAutoBuild_; - } - - public boolean getAutoBuildPreference() { - return isAutoBuild_; - } - - public boolean getWorkspaceAutoBuildPreference() { - IWorkspaceDescription workspaceDesc = ResourcesPlugin.getWorkspace().getDescription(); - return workspaceDesc.isAutoBuilding(); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/BindingElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/BindingElement.java deleted file mode 100644 index 684fb6607..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/BindingElement.java +++ /dev/null @@ -1,55 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class BindingElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_PORT = "port"; - public static String REL_OPERATIONS = "operations"; - public static String REL_PORT_TYPE = "porttype"; - - public BindingElement (PortElement portElement,String name) - { - super(name,portElement,REL_PORT,PortElement.REL_BINDING); - } - - public Enumeration getPort() - { - return getElements(REL_PORT); - } - - public Enumeration getPortType() - { - return getElements(REL_PORT_TYPE); - } - - public Enumeration getOperations() - { - return getElements(REL_OPERATIONS); - } - - public int getNumberOfOperations() - { - return getNumberOfElements(REL_OPERATIONS); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/DefinitionElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/DefinitionElement.java deleted file mode 100644 index d5815648c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/DefinitionElement.java +++ /dev/null @@ -1,49 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class DefinitionElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_SERVICES = "services"; - public static String REL_WSDL = "wsdl"; - - public DefinitionElement (WSDLElement wsdlElement,String name) - { - super(name,wsdlElement,REL_WSDL,WSDLElement.REL_DEFINITIONS); - } - - public Enumeration getWSDL() - { - return getElements(REL_WSDL); - } - - public Enumeration getServices() - { - return getElements(REL_SERVICES); - } - - public int getNumberOfServices() - { - return getNumberOfElements(REL_SERVICES); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/MessageElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/MessageElement.java deleted file mode 100644 index ed6bb1372..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/MessageElement.java +++ /dev/null @@ -1,49 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class MessageElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_OPERATION = "operation"; - public static String REL_PARTS = "parts"; - - public MessageElement (OperationElement operationElement,String name) - { - super(name,operationElement,REL_OPERATION,OperationElement.REL_MESSAGES); - } - - public Enumeration getOperation() - { - return getElements(REL_OPERATION); - } - - public Enumeration getParts() - { - return getElements(REL_PARTS); - } - - public int getNumberOfParts() - { - return getNumberOfElements(REL_PARTS); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/OperationElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/OperationElement.java deleted file mode 100644 index 890af4756..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/OperationElement.java +++ /dev/null @@ -1,49 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class OperationElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_BINDING = "binding"; - public static String REL_MESSAGES = "messages"; - - public OperationElement (BindingElement bindingElement,String name) - { - super(name,bindingElement,REL_BINDING,BindingElement.REL_OPERATIONS); - } - - public Enumeration getBinding() - { - return getElements(REL_BINDING); - } - - public Enumeration getMessages() - { - return getElements(REL_MESSAGES); - } - - public int getNumberOfMessages() - { - return getNumberOfElements(REL_MESSAGES); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PartElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PartElement.java deleted file mode 100644 index 26df67aac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PartElement.java +++ /dev/null @@ -1,40 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class PartElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_MESSAGE = "message"; - - public PartElement (MessageElement messageElement,String name) - { - super(name,messageElement,REL_MESSAGE,MessageElement.REL_PARTS); - } - - public Enumeration getMessage() - { - return getElements(REL_MESSAGE); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortElement.java deleted file mode 100644 index 4ea80e072..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortElement.java +++ /dev/null @@ -1,45 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class PortElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_BINDING = "binding"; - public static String REL_SERVICE = "service"; - - public PortElement (ServiceElement serviceElement,String name) - { - super(name,serviceElement,REL_SERVICE,ServiceElement.REL_PORTS); - } - - public Enumeration getService() - { - return getElements(REL_SERVICE); - } - - public Enumeration getBinding() - { - return getElements(REL_BINDING); - } - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortTypeElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortTypeElement.java deleted file mode 100644 index fdacceddc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortTypeElement.java +++ /dev/null @@ -1,40 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class PortTypeElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_BINDING = "binding"; - - public PortTypeElement (BindingElement bindingElement,String name) - { - super(name,bindingElement,REL_BINDING,BindingElement.REL_PORT_TYPE); - } - - public Enumeration getBinding() - { - return getElements(REL_BINDING); - } - - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/ServiceElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/ServiceElement.java deleted file mode 100644 index ece863406..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/ServiceElement.java +++ /dev/null @@ -1,49 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; - - -public class ServiceElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_PORTS = "ports"; - public static String REL_DEFINITION = "definition"; - - public ServiceElement (DefinitionElement definitionElement,String name) - { - super(name,definitionElement,REL_DEFINITION,DefinitionElement.REL_SERVICES); - } - - public Enumeration getDefinition() - { - return getElements(REL_DEFINITION); - } - - public Enumeration getPorts() - { - return getElements(REL_PORTS); - } - - public int getNumberOfPorts() - { - return getNumberOfElements(REL_PORTS); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/StubbedWSDLModel.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/StubbedWSDLModel.java deleted file mode 100644 index 64611e868..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/StubbedWSDLModel.java +++ /dev/null @@ -1,69 +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.datamodel.wsdlmodel; - -import org.eclipse.wst.ws.internal.datamodel.Model; - -public class StubbedWSDLModel -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - protected Model fModel; - public StubbedWSDLModel() - { - WSDLElement wsdlElement = new WSDLElement("WSDLFiles"); - fModel = wsdlElement.getModel(); - } - - public Model getWSDLModel() - { - return fModel; - } - - public void buildModel() - { - DefinitionElement def1 = new DefinitionElement((WSDLElement)fModel.getRootElement(),"StockQuote"); - ServiceElement ser1 = new ServiceElement(def1,"getQuote"); - ServiceElement ser2 = new ServiceElement(def1,"setQuote"); - PortElement port1 = new PortElement(ser1,"port1"); - PortElement port2 = new PortElement(ser1,"port2"); - PortElement port3 = new PortElement(ser2,"port1"); - PortElement port4 = new PortElement(ser2,"port2"); - BindingElement bind1 = new BindingElement(port1,"bind1"); - BindingElement bind2 = new BindingElement(port2,"bind1"); - BindingElement bind3 = new BindingElement(port3,"bind1"); - BindingElement bind4 = new BindingElement(port4,"bind1"); - OperationElement op1 = new OperationElement(bind1,"op1"); - new OperationElement(bind2,"op1"); - new OperationElement(bind3,"op1"); - new OperationElement(bind4,"op1"); - MessageElement me1 = new MessageElement(op1,"me1"); - MessageElement me2 = new MessageElement(op1,"me2"); - new PartElement(me1,"pe1"); - new PartElement(me2,"pe2"); - - DefinitionElement def2 = new DefinitionElement((WSDLElement)fModel.getRootElement(),"TempConversion"); - ServiceElement ser3 = new ServiceElement(def2,"getTemp"); - ServiceElement ser4 = new ServiceElement(def2,"setTemp"); - PortElement port5 = new PortElement(ser3,"port1"); - PortElement port6 = new PortElement(ser4,"port1"); - BindingElement bind5 = new BindingElement(port5,"bind1"); - BindingElement bind6 = new BindingElement(port6,"bind1"); - new OperationElement(bind5,"op1"); - new OperationElement(bind6,"op1"); - - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/WSDLElement.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/WSDLElement.java deleted file mode 100644 index f1aa78acc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/WSDLElement.java +++ /dev/null @@ -1,54 +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.datamodel.wsdlmodel; - -import java.util.Enumeration; - -import org.eclipse.wst.ws.internal.datamodel.BasicElement; -import org.eclipse.wst.ws.internal.datamodel.BasicModel; -import org.eclipse.wst.ws.internal.datamodel.Model; - - -public class WSDLElement extends BasicElement -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public static String REL_DEFINITIONS = "definitions"; - - /* - * - **/ - public WSDLElement (String name) - { - this(name,new BasicModel("WSDLModel")); - } - - public WSDLElement (String name, Model model) - { - super(name,model); - model.setRootElement(this); - } - - public Enumeration getDefinitions() - { - return getElements(REL_DEFINITIONS); - } - - public int getNumberOfDefinitions() - { - return getNumberOfElements(REL_DEFINITIONS); - } -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreAssemblyFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreAssemblyFragment.java deleted file mode 100644 index 65cab80e0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreAssemblyFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ClientPreAssemblyFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDeployFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDeployFragment.java deleted file mode 100644 index 0b09cf2a8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDeployFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ClientPreDeployFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDevelopFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDevelopFragment.java deleted file mode 100644 index 6a3f5cf25..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreDevelopFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ClientPreDevelopFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreInstallFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreInstallFragment.java deleted file mode 100644 index a3da3d86d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ClientPreInstallFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ClientPreInstallFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreAssemblyFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreAssemblyFragment.java deleted file mode 100644 index 7cd1b4c2f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreAssemblyFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ServicePreAssemblyFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDeployFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDeployFragment.java deleted file mode 100644 index 5c1db7301..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDeployFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ServicePreDeployFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDevelopFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDevelopFragment.java deleted file mode 100644 index a0e9c21ec..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreDevelopFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ServicePreDevelopFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreInstallFragment.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreInstallFragment.java deleted file mode 100644 index af8268a89..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/fragments/ServicePreInstallFragment.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.fragments; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - -public class ServicePreInstallFragment extends SequenceFragment -{ -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/plugin/WebServiceConsumptionPlugin.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/plugin/WebServiceConsumptionPlugin.java deleted file mode 100644 index 42e11d018..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/plugin/WebServiceConsumptionPlugin.java +++ /dev/null @@ -1,90 +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.plugin; - -import java.text.MessageFormat; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - -/** -* This is the plugin class for the Web Services plugin. -* <p> -* This plugin contains the bulk of the Web Services runtime. -* Only the graphical user interface portion of the runtime is -* found elsewhere - in the org.eclipse.jst.ws.ui plugin. -*/ -public class WebServiceConsumptionPlugin extends Plugin -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * The identifier of the descriptor of this plugin in plugin.xml. - */ - public static final String ID = "org.eclipse.jst.ws.consumption"; - - /** - * The reference to the singleton instance of this plugin. - */ - private static WebServiceConsumptionPlugin instance_; - - /** - * Constructs a runtime plugin object for this plugin. - */ - public WebServiceConsumptionPlugin () - { - super(); - instance_ = this; - } - - /** - * Returns the singleton instance of this plugin. Equivalent to calling - * (WebServiceConsumptionPlugin)Platform.getPlugin("org.eclipse.jst.ws"); - * @return The WebServiceConsumptionPlugin singleton. - */ - public static WebServiceConsumptionPlugin getInstance () - { - return instance_; - } - - /** - * Returns the message string identified by the given key from - * plugin.properties. - * @return The String message. - */ - public static String getMessage ( String key ) - { - MessageUtils msgUtils = new MessageUtils( "org.eclipse.jst.ws.consumption.plugin", instance_ ); - - if( key.startsWith("%")) - { - key = key.substring( 1, key.length() ); - } - - return msgUtils.getMessage(key); - } - - /** - * Returns the message string identified by the given key from - * plugin.properties. Substitution sequences in the message string - * are replaced by the given array of substitution objects (which - * are most frequently strings). See the JDK's - * {@link java.text.MessageFormat java.text.MessageFormat} - * class for further details on substitution. - * @return The String message. - */ - public static String getMessage ( String key, Object[] args ) - { - return MessageFormat.format(getMessage(key),args); - } - -} 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; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/GeneratePageCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/GeneratePageCommand.java deleted file mode 100644 index 37610b076..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/GeneratePageCommand.java +++ /dev/null @@ -1,104 +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.command; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.codegen.Generator; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.ws.internal.datamodel.Element; -import org.eclipse.wst.ws.internal.datamodel.Model; - - -/** - * MofToBeanModelCommand - * Creation date: (4/10/2001 12:41:48 PM) - * @author: Gilbert Andrews - */ -public class GeneratePageCommand extends EnvironmentalOperation -{ - -private Model model_; -private Generator fGenerator; -private IFile fIFile; -private ResourceContext resourceContext_; -private StringBuffer fStringBuffer; - -/** - * Build constructor comment. - */ -public GeneratePageCommand() -{ -} - -/** -* Constructor -* This command will generate code from a Model -* @param model The model to be traversed -* @param generator The code generator to be used -* @param resource the resource to place the finished product -*/ -public GeneratePageCommand(ResourceContext context, Model model, Generator generator, IFile file) -{ - model_ = model; - fGenerator = generator; - fIFile = file; - resourceContext_ = context; -} - -public Model getJavaDataModel() -{ - return model_; -} - -/** - * - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - try { - fGenerator.visit(model_.getRootElement()); - fStringBuffer = fGenerator.getStringBuffer(); - String tempString = fStringBuffer.toString(); - OutputStream fileResource = FileResourceUtils.newFileOutputStream(resourceContext_, fIFile.getFullPath(), monitor, env.getStatusHandler()); - //PrintStream ps = new PrintStream(fileResource); - //ps.print(tempString); - OutputStreamWriter osw = new OutputStreamWriter(fileResource,"UTF-8"); - osw.write(tempString,0,fStringBuffer.length()); - osw.close(); - fileResource.close(); - return status; - } catch (IOException ioexc) { - status = StatusUtils.errorStatus( ioexc ); - return status; - } -} - -public void setRootElement(Element rootElement) -{ -} - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/JavaToModelCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/JavaToModelCommand.java deleted file mode 100644 index ee26fb0f1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/JavaToModelCommand.java +++ /dev/null @@ -1,229 +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.command; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitoractions.JavaMofBeanVisitorAction; -import org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors.JavaMofBeanVisitor; -import org.eclipse.jst.ws.internal.consumption.command.common.JavaMofReflectionCommand; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.ws.internal.datamodel.Element; -import org.eclipse.wst.ws.internal.datamodel.Model; - -/** -* This is the base class for commands that need to report progress -* and status during and after their execution. This class extends -* {@link org.eclipse.emf.common.command.AbstractCommand AbstractCommand} - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - -* with methods to {@link #setProgressMonitor set} -* and {@link #getProgressMonitor get} a progress monitor, -* and to get a status object {@link #getReadyStatus before} -* or {@link #getResultStatus after} execution. -* <p> -* Note that the responsibility of providing an -* {@link org.eclipse.core.runtime.IProgressMonitor IProgressMonitor} -* rests with frameworks that construct or run ProgressCommand objects, -* whereas the responsibility of providing an -* {@link org.eclipse.core.runtime.IStatus IStatus} -* object lies with the subclasses of ProgressCommand. -* Subclasses must follow the rules described for -* {@link org.eclipse.emf.common.command.AbstractCommand AbstractCommand}. -*/ -public class JavaToModelCommand extends EnvironmentalOperation -{ - private MessageUtils msgUtils; - private String clientProject; - private BooleanSelection[] methods; - private String proxyBean; - private JavaClass javaClass; - private Model model; - private Element parentElement; - - public JavaToModelCommand () - { - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - - private IStatus createJavaReflection(Environment env, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - JavaMofReflectionCommand javaMofReflectionCommand = new JavaMofReflectionCommand(); - javaMofReflectionCommand.setClientProject(clientProject); - javaMofReflectionCommand.setProxyBean(proxyBean); - javaMofReflectionCommand.setEnvironment( env ); - //javaMofReflectionCommand.setStatusMonitor(getStatusMonitor()); - status = javaMofReflectionCommand.execute( monitor, null); - javaClass = (JavaClass)javaMofReflectionCommand.getJavaClass(); - return status; - } - - /** - * The Model that was created from this javamof - * @return Model The data model that was created - **/ - public Model getJavaDataModel() - { - return model; - } - - /** - * Build the datamodel from the mof - */ - public IStatus buildModelFromMof (Environment env) throws CoreException - { - - Choice OKChoice = new Choice('O', msgUtils.getMessage("LABEL_OK"), msgUtils.getMessage("DESCRIPTION_OK")); - Choice CancelChoice = new Choice('C', msgUtils.getMessage("LABEL_CANCEL"), msgUtils.getMessage("DESCRIPTION_CANCEL")); - - // we could have one of three cases: - //1. The model is null meaning we want and the parent element is null, meaning we want to - // create a brand new model and make this bean its root - //2. The model is null but the parentElement is not, meaning we want to add the Bean to the - // given parent element - //3. The model is not null however the parentElement is, meaning we want to add this Bean to - // This model but dont attach it to anything - IStatus status = Status.OK_STATUS; - - if(model == null && parentElement == null){ - JavaMofBeanVisitorAction beanVisitorAction = new JavaMofBeanVisitorAction(clientProject,methods, env); - //beanVisitorAction.setStatusMonitor(getStatusMonitor()); - JavaMofBeanVisitor beanVisitor = new JavaMofBeanVisitor(); - status = beanVisitor.run(javaClass,beanVisitorAction); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - model = beanVisitorAction.getModel(); - - } - else if (model == null && parentElement != null){ - JavaMofBeanVisitorAction beanVisitorAction = new JavaMofBeanVisitorAction(parentElement,clientProject, env); - //beanVisitorAction.setStatusMonitor(getStatusMonitor()); - JavaMofBeanVisitor beanVisitor = new JavaMofBeanVisitor(); - status = beanVisitor.run(javaClass,beanVisitorAction); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - model = beanVisitorAction.getModel(); - } - else { - JavaMofBeanVisitorAction beanVisitorAction = new JavaMofBeanVisitorAction(model,clientProject, env); - //beanVisitorAction.setStatusMonitor(getStatusMonitor()); - JavaMofBeanVisitor beanVisitor = new JavaMofBeanVisitor(); - status = beanVisitor.run(javaClass,beanVisitorAction); - // - int severity = status.getSeverity(); - if (severity==Status.ERROR) - return status; - - if (severity==Status.WARNING) - { - Choice result = env.getStatusHandler().report(status, new Choice[]{OKChoice, CancelChoice}); - if (result.getLabel().equals(CancelChoice.getLabel())) - { - //return an error status since the user canceled - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_SAMPLE_CREATION_CANCELED") ); - } - - } - // - model = beanVisitorAction.getModel(); - } - - return status; - } - - /** - * Get the java model from the resource then - * build the model from the mof - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - if(clientProject == null) return status; - - status = createJavaReflection(env, monitor); - if (status.getSeverity()==Status.ERROR) return status; - try{ - status = buildModelFromMof(env); - return status; - }catch(CoreException exc){ - IStatus embeddedStatus = exc.getStatus(); - status = embeddedStatus; - return status; - } - - } - - public void setMethods(BooleanSelection[] methods) - { - this.methods = methods; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - public void setParentElement(Element parentElement) - { - this.parentElement = parentElement; - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/common/SamplePropertyDescriptor.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/common/SamplePropertyDescriptor.java deleted file mode 100644 index 74f4b0115..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/common/SamplePropertyDescriptor.java +++ /dev/null @@ -1,115 +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.common; - -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.Method; - - -/** -* Objects of this class represent a PropertyDescriptor. -* */ -public class SamplePropertyDescriptor -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - private Method fReadMethod; - private Method fWriteMethod; - private String fPropertyName; - private JavaHelpers fPropertyType; - private boolean fStatic; - - /* - * Constructor - **/ - public SamplePropertyDescriptor(String name) - { - fPropertyName = name; - } - - /* - * set the ReadMethod - */ - public void setReadMethod(Method readMethod) - { - fReadMethod = readMethod; - } - - /* - * get the ReadMethod - */ - public Method getReadMethod() - { - return fReadMethod; - } - - /* - * set the writeMethod - */ - public void setWriteMethod(Method writeMethod) - { - fWriteMethod = writeMethod; - } - - /* - * get the writeMethod - */ - public Method getWriteMethod() - { - return fWriteMethod; - } - - /* - * set the propertyName - */ - public void setName(String name) - { - fPropertyName= name; - } - - /* - * get the propertyName - */ - public String getName() - { - return fPropertyName; - } - - /* - * set the PropertyType - */ - public void setPropertyType(JavaHelpers propertyType) - { - fPropertyType = propertyType; - } - - /* - * get the PropertyType - */ - public JavaHelpers getPropertyType() - { - return fPropertyType; - } - - public boolean isfStatic() - { - return fStatic; - } - - public void setfStatic(boolean fStatic) - { - this.fStatic = fStatic; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/IWSFinder.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/IWSFinder.java deleted file mode 100644 index 7ea7ff5f7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/IWSFinder.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.wsfinder; - -import java.util.List; - -public interface IWSFinder -{ - public String getID(); - public void setID(String id); - - public String getName(); - public void setName(String name); - - public String getDescription(); - public void setDescription(String desc); - - public List find(); -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/LiveWSDLFilter.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/LiveWSDLFilter.java deleted file mode 100644 index 18b1f2e69..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/LiveWSDLFilter.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.wsfinder; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.http.HTTPAddress; -import javax.wsdl.extensions.soap.SOAPAddress; - -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WWWAuthenticationException; - -public class LiveWSDLFilter extends Thread -{ - private String wsdlURL_; - private boolean finish_; - private boolean live_; - - public LiveWSDLFilter(String wsdlURL) - { - wsdlURL_ = wsdlURL; - finish_ = false; - live_ = false; - } - - public String getWSDLURL() - { - return wsdlURL_; - } - - public boolean isFinish() - { - return finish_; - } - - public boolean isWSDLLive() - { - return live_; - } - - public void run() - { - try - { - live_ = validateWSDL(); - } - catch (Throwable t) - { - live_ = false; - } - finally - { - finish_ = true; - } - } - - private boolean validateWSDL() throws WSDLException, MalformedURLException, IOException, WWWAuthenticationException - { - WebServicesParserExt parser = new WebServicesParserExt(); - Definition definition = parser.getWSDLDefinitionVerbose(wsdlURL_); - Map services = definition.getServices(); - Iterator serviceIterator = services.values().iterator(); - while (serviceIterator.hasNext()) - { - Service service = (Service)serviceIterator.next(); - Map ports = service.getPorts(); - Iterator portIterator = ports.values().iterator(); - while (portIterator.hasNext()) - { - Port port = (Port)portIterator.next(); - List extensibilityElements = port.getExtensibilityElements(); - Iterator extensibilityElementsIterator = extensibilityElements.iterator(); - while (extensibilityElementsIterator.hasNext()) - { - ExtensibilityElement extensibilityElement = (ExtensibilityElement)extensibilityElementsIterator.next(); - if ((extensibilityElement instanceof SOAPAddress) || (extensibilityElement instanceof HTTPAddress)) - return true; - } - } - } - return false; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/WSFinderRegistry.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/WSFinderRegistry.java deleted file mode 100644 index 04d7c9292..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/WSFinderRegistry.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 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.wsfinder; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; - -public class WSFinderRegistry -{ - private static WSFinderRegistry instance_; - private Vector wsfinders_; - - private WSFinderRegistry() - { - wsfinders_ = new Vector(); - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WSFinderRegistry object. - */ - public static WSFinderRegistry getInstance() - { - if (instance_ == null) - { - instance_ = new WSFinderRegistry(); - instance_.init(); - } - return instance_; - } - - private void init() - { - IExtensionRegistry pluginReg = Platform.getExtensionRegistry(); - IConfigurationElement[] configElements = pluginReg.getConfigurationElementsFor("org.eclipse.jst.ws.consumption", "wsfinder"); - for (int i = 0; i < configElements.length; i++) - { - try - { - Object object = configElements[i].createExecutableExtension("class"); - if (object instanceof IWSFinder) - { - IWSFinder wsfinder = (IWSFinder)object; - wsfinder.setID(configElements[i].getAttribute("id")); - wsfinder.setName(configElements[i].getAttribute("name")); - wsfinder.setDescription(configElements[i].getAttribute("description")); - wsfinders_.add(wsfinder); - } - } - catch (CoreException ce) - { - } - } - } - - public List getWSFinders() - { - return wsfinders_; - } - - public List getWebServices() - { - List ws = new Vector(); - List wsFinders = getWSFinders(); - for (Iterator it = wsFinders.iterator(); it.hasNext();) - { - IWSFinder wsFinder = (IWSFinder)it.next(); - ws.addAll(wsFinder.find()); - } - return ws; - } -} |