diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption')
159 files changed, 0 insertions, 16361 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption/.classpath b/bundles/org.eclipse.jst.ws.consumption/.classpath deleted file mode 100644 index 7c69b4f1a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="webserviceutils"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.jst.ws.consumption/.cvsignore b/bundles/org.eclipse.jst.ws.consumption/.cvsignore deleted file mode 100644 index ad09d9c9c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -bin -build.xml -temp.folder -webserviceutils.jar -wsc.jar -webserviceutilssrc.zip -wscsrc.zip -javaCompiler.webserviceutils.jar.args -javaCompiler.wsc.jar.args diff --git a/bundles/org.eclipse.jst.ws.consumption/.project b/bundles/org.eclipse.jst.ws.consumption/.project deleted file mode 100644 index 0758941dc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jst.ws.consumption</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1426bed8a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Mon Jan 30 10:35:51 EST 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 813550758..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Mon Jan 30 10:41:25 EST 2006 -compilers.p.deprecated=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=1 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=1 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.jst.ws.consumption/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.consumption/META-INF/MANIFEST.MF deleted file mode 100644 index f536f32ff..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/META-INF/MANIFEST.MF +++ /dev/null @@ -1,61 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %PLUGIN_NAME -Bundle-SymbolicName: org.eclipse.jst.ws.consumption; singleton:=true -Bundle-Version: 1.0.102.qualifier -Bundle-ClassPath: wsc.jar, - webserviceutils.jar -Bundle-Activator: org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin -Bundle-Vendor: %PLUGIN_PROVIDER -Bundle-Localization: plugin -Export-Package: org.eclipse.jst.ws.internal.consumption;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.codegen;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.codegen.bean;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitoractions;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.codegen.javamofvisitors;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.command.common;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.common;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.datamodel.validate;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.datamodel.wsdlmodel;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.fragments;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.plugin;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.sampleapp.codegen;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.sampleapp.command;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.sampleapp.common;x-internal:=true, - org.eclipse.jst.ws.internal.consumption.wsfinder;x-internal:=true, - org.eclipse.jst.ws.util -Require-Bundle: org.eclipse.jem;bundle-version="[1.2.0,1.3.0)", - org.eclipse.jem.workbench;bundle-version="[1.2.0,1.3.0)", - org.eclipse.emf.common;bundle-version="[2.2.0,2.3.0)", - org.eclipse.emf.ecore;bundle-version="[2.2.0,2.3.0)", - org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.2.0,3.3.0)", - org.eclipse.core.resources;bundle-version="[3.2.0,3.3.0)", - org.eclipse.xsd;bundle-version="[2.2.0,2.3.0)", - org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.jst.ws;bundle-version="[1.0.101,1.1.0)", - org.eclipse.jdt.launching;bundle-version="[3.2.0,3.3.0)", - org.eclipse.wst.command.env.core;bundle-version="[1.0.101,1.1.0)", - org.eclipse.wst.command.env;bundle-version="[1.0.101,1.1.0)", - org.eclipse.jem.workbench;bundle-version="[1.2.0,1.3.0)", - org.eclipse.jface;bundle-version="[3.2.0,4.0.0)", - org.eclipse.wst.ws;bundle-version="[1.0.100,1.1.0)", - org.eclipse.wst.ws.parser;bundle-version="[1.0.100,1.1.0)", - org.eclipse.wst.server.core;bundle-version="[1.0.102,1.1.0)", - org.eclipse.wst.wsdl;bundle-version="[1.0.100,1.1.0)", - org.eclipse.wst.internet.monitor.core;bundle-version="[1.0.102,1.1.0)", - org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jst.j2ee.ejb;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jst.j2ee.web;bundle-version="[1.1.0,1.2.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.1.0,1.2.0)", - org.wsdl4j;bundle-version="[1.4.0,1.5.0)", - org.eclipse.jem.util;bundle-version="[1.2.0,1.3.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)", - org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,1.2.0)", - org.eclipse.jst.server.core;bundle-version="[1.0.102,1.1.0)", - com.ibm.icu;bundle-version="[3.4.4,3.5.0)", - org.eclipse.ui;bundle-version="[3.2.0,4.0.0)" -Eclipse-LazyStart: true diff --git a/bundles/org.eclipse.jst.ws.consumption/about.html b/bundles/org.eclipse.jst.ws.consumption/about.html deleted file mode 100644 index 4ec598958..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>May 2, 2006</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor’s license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/bundles/org.eclipse.jst.ws.consumption/build.properties b/bundles/org.eclipse.jst.ws.consumption/build.properties deleted file mode 100644 index 31b6245e1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -source.wsc.jar = src/ -source.webserviceutils.jar = webserviceutils/ -jars.compile.order = wsc.jar,\ - webserviceutils.jar -bin.includes = plugin.properties,\ - plugin.xml,\ - wsc.jar,\ - webserviceutils.jar,\ - META-INF/,\ - about.html -jars.extra.classpath = ../org.apache.axis/lib/saaj.jar diff --git a/bundles/org.eclipse.jst.ws.consumption/plugin.properties b/bundles/org.eclipse.jst.ws.consumption/plugin.properties deleted file mode 100644 index f484e2606..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/plugin.properties +++ /dev/null @@ -1,19 +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 -############################################################################### - -# -# Messages in plugin.xml. -# -PLUGIN_NAME=Web Services Consumption -PLUGIN_PROVIDER=Eclipse.org -XP_WSFINDER=org.eclipse.jst.ws.internal.consumption.wsfinder -XP_WEB_SERVICE_START_SERVER_TYPE=WebServiceStartServerType -XP_SERVER_DEFAULTER=Server Defaulter diff --git a/bundles/org.eclipse.jst.ws.consumption/plugin.xml b/bundles/org.eclipse.jst.ws.consumption/plugin.xml deleted file mode 100644 index f6640aacf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/plugin.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> - -<plugin> - - <!-- The following extension point is internal and likely to be removed in a future release. --> - <extension-point - id="wsfinder" - name="%XP_WSFINDER"/> - - <!-- The following extension point is internal and likely to be removed in a future release. --> - <extension-point - id="webServiceStartServerType" - name="%XP_WEB_SERVICE_START_SERVER_TYPE"/> - - <!-- The following extension point is internal and likely to be removed in a future release. --> - <extension-point - id="serverDefaulter" - name="%XP_SERVER_DEFAULTER"/> - - - <extension - point="org.eclipse.jst.ws.consumption.webServiceStartServerType"> - <webServiceStartServerType - factoryId="org.eclipse.jst.server.tomcat.32" - class="org.eclipse.jst.ws.internal.consumption.command.common.StartTomcatServer" - id="SERVER_ID_TOMCAT32_LOCAL"> - </webServiceStartServerType> - <webServiceStartServerType - factoryId="org.eclipse.jst.server.tomcat.40" - class="org.eclipse.jst.ws.internal.consumption.command.common.StartTomcatServer" - id="SERVER_ID_TOMCAT40_LOCAL"> - </webServiceStartServerType> - <webServiceStartServerType - factoryId="org.eclipse.jst.server.tomcat.41" - class="org.eclipse.jst.ws.internal.consumption.command.common.StartTomcatServer" - id="SERVER_ID_TOMCAT41_LOCAL"> - </webServiceStartServerType> - <webServiceStartServerType - factoryId="org.eclipse.jst.server.tomcat.50" - class="org.eclipse.jst.ws.internal.consumption.command.common.StartTomcatServer" - id="SERVER_ID_TOMCAT50_LOCAL"> - </webServiceStartServerType> - <webServiceStartServerType - factoryId="org.eclipse.jst.server.geronimo.10" - class="org.eclipse.jst.ws.internal.consumption.command.common.StartTomcatServer" - id="SERVER_ID_GERONIMO10_LOCAL"> - </webServiceStartServerType> - </extension> - - -</plugin> diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/Consumption.properties b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/Consumption.properties deleted file mode 100644 index 36754615e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/Consumption.properties +++ /dev/null @@ -1,193 +0,0 @@ -############################################################################### -# Copyright (c) 2004, 2006 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 -# yyyymmdd bug Email and other contact information -# -------- -------- ----------------------------------------------------------- -# 20060217 126757 rsinha@ca.ibm.com - Rupam Kuehner -# 20060401 128827 kathy@ca.ibm.com - Kathy Chan -############################################################################### - -# -# 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_JTS_JSP_GEN=Error in generating sample JSP - -# Not used -#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". - -PROPERTIES_FILTER_NAME=Properties files -PROPERTIES_FILTER_DESC=Files with names ending in ".properties" -PROPERTIES_FILTER_MSG_ERROR_WRONG_EXTENSION= The file "{0}" does not end in ".properties". - -FOLDER_FILTER_NAME=Folders -FOLDER_FILTER_DESC=Folders. - -# -# 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_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 -# 4 unused messages in jst.ws and wst.ws -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}. - -# -# 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. - -# -# MISC -# -MSG_ERROR_WEB_PROJECT_CREATE=IWAB0310E An error occurred during creation of the Web Project. - -# -# CheckProjectOKCommand -# -MSG_ERROR_SERVER_VIEW_OPEN=IWAB0126E The server configuration editor is open for {0}. Close it and restart the wizard. - - -# -# 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. - -WARN_BEAN_NAME_STARTS_WITH_LOWER_CASE - -# -# 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_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_COMPONENT_CREATION=Unable to create project {0} and/or component {1}. - - -# -# CreateFacetedProjectCommand -# -MSG_ERROR_PROJECT_CREATION=Unable to create project {0}. - - -# -# PreServiceDevelopCommand -# -MSG_ERROR_PROJECT_DOES_NOT_EXIST=The project {0} does not exist. -MSG_ERROR_PROJECT_IS_NOT_OPEN=The project {0} is not open. - -# -# SPECIAL NOTE TO TRANSLATORS: Substitution {1} in MSG_ERROR_ADDING_FACETS_TO_PROJECT and -# MSG_ERROR_FIXED_FACETS will be a delimited list of translated labels. The list is formed -# through repeated use of MSG_FACETS. -# -MSG_ERROR_ADDING_FACETS_TO_PROJECT=Unable to add the follwing facets to project {0}: {1}. -MSG_ERROR_FIXED_FACETS=Unable to set the following facets as fixed on project {0}: {1}. -MSG_FACETS={0}, {1} - -MSG_ERROR_SETTING_RUNTIME=Unable to bind project {0} to the {1} runtime. - -# -# SkeletonMergeCommand Messages -# -MSG_ERROR_FILE_MERGE=Error in merging file {0}. diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/ConsumptionMessages.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/ConsumptionMessages.java deleted file mode 100644 index aad43c21f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/ConsumptionMessages.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060217 126757 rsinha@ca.ibm.com - Rupam Kuehner - * 20060401 128827 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption; - -import org.eclipse.osgi.util.NLS; - -public final class ConsumptionMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.jst.ws.internal.consumption.Consumption";//$NON-NLS-1$ - - private ConsumptionMessages() { - // Do not instantiate - } - - public static String MSG_ERROR_JTS_PROXY_HAS_NO_METHODS; - public static String MSG_ERROR_JTS_PROXY_HAS_NO_DEFAULT; - public static String MSG_ERROR_JTS_NO_PROXY_METHODS_PROCESSED; - public static String MSG_WARN_JTS_UNSUPPORTED_TYPE; - public static String MSG_WARN_JTS_UNSUPPORTED_INDEXED_PROPERTIES; - public static String MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS; - public static String MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_INPUTS; - public static String MSG_ERROR_JTS_CYCLIC_BEAN; - public static String MSG_WARN_JTS_PROXY_METHODS_OMITTED; - public static String MSG_ERROR_SAMPLE_CREATION_CANCELED; - public static String MSG_WARN_UNABLE_TO_FIND_PROXY; - public static String MSG_ERROR_JTS_JSP_GEN; - public static String FILTER_MSG_ERROR_NULL_OBJECT; - public static String FILTER_MSG_ERROR_NOT_FILE; - public static String FILTER_MSG_ERROR_NOT_FOLDER; - public static String JAVA_FILTER_NAME; - public static String JAVA_FILTER_DESC; - public static String JAVA_FILTER_MSG_ERROR_WRONG_EXTENSION; - public static String WSDL_FILTER_NAME; - public static String WSDL_FILTER_DESC; - public static String WSDL_FILTER_MSG_ERROR_WRONG_EXTENSION; - public static String ISD_FILTER_NAME; - public static String ISD_FILTER_DESC; - public static String ISD_FILTER_MSG_ERROR_WRONG_EXTENSION; - public static String PROPERTIES_FILTER_NAME; - public static String PROPERTIES_FILTER_DESC; - public static String PROPERTIES_FILTER_MSG_ERROR_WRONG_EXTENSION; - public static String FOLDER_FILTER_NAME; - public static String FOLDER_FILTER_DESC; - public static String PROGRESS_INFO_COPY_WEBSERVICE_UTILS; - public static String PROGRESS_INFO_COPYING_FILE; - public static String PROGRESS_INFO_START_WEB_PROJECT; - public static String PROGRESS_INFO_PUBLISHING_SERVER; - public static String PROGRESS_INFO_STARTING_SERVER; - public static String PROGRESS_INFO_PUBLISH_WEB_PROJECT; - public static String MSG_ERROR_PROJECT_NOT_FOUND; - public static String MSG_ERROR_FILECOPY_WEBSERVICE_UTILS; - public static String MSG_ERROR_INSTANCE_NOT_FOUND; - public static String MSG_ERROR_SERVER; - public static String MSG_ERROR_PUBLISH; - public static String MSG_ERROR_ADD_MODULE; - public static String MSG_ERROR_CREATE_SERVER; - public static String MSG_ERROR_STUB_ONLY; - public static String TASK_LABEL_CREATE_EJB_PROJECT; - public static String TASK_DESC_CREATE_EJB_PROJECT; - public static String MSG_ERROR_CANNOT_CREATE_EJB_PROJECT; - public static String MSG_ERROR_CANNOT_CREATE_APP_CLIENT_PROJECT; - public static String MSG_ERROR_CANNOT_CREATE_JAVA_PROJECT; - public static String MSG_ERROR_CANNOT_CREATE_EAR_PROJECT; - public static String TASK_LABEL_WEBSERVICE_DISABLE_VALIDATION; - public static String TASK_DESC_WEBSERVICE_DISABLE_VALIDATION; - public static String TASK_LABEL_WEBSERVICE_RESTORE_VALIDATION; - public static String TASK_DESC_WEBSERVICE_RESTORE_VALIDATION; - public static String TASK_LABEL_WEBSERVICE_DISABLE_BUILD; - public static String TASK_DESC_WEBSERVICE_DISABLE_BUILD; - public static String TASK_LABEL_WEBSERVICE_RESTORE_BUILD; - public static String TASK_DESC_WEBSERVICE_RESTORE_BUILD; - public static String MSG_ERROR_WEB_PROJECT_CREATE; - public static String MSG_ERROR_SERVER_VIEW_OPEN; - public static String MSG_WARN_JAVA_METHOD_START_WITH_UPPER_CASE; - public static String MSG_WARN_METHOD_NAME_INVALID; - public static String MSG_WARN_BOOLEAN_PROPERTY_ACCESSORS; - public static String MSG_WARN_PACKAGE_NAME_HAS_UPPER_CASE; - public static String WARN_BEAN_NAME_STARTS_WITH_LOWER_CASE; - public static String LABEL_OK; - public static String DESCRIPTION_OK; - public static String LABEL_CANCEL; - public static String DESCRIPTION_CANCEL; - public static String MSG_ERROR_UNABLE_TO_START_MONITOR; - public static String MSG_INFO_MONITORING_NOT_SUPPORTED; - public static String COMMAND_LABEL_COPY_WSDL; - public static String COMMAND_DESC_COPY_WSDL; - public static String MSG_ERROR_COPY_WSDL; - public static String MSG_ERROR_UNABLE_TO_ASSOCIATE; - public static String MSG_ERROR_CREATE_FLEX_PROJET; - public static String MSG_ERROR_CREATE_EJB_COMPONENT; - public static String MSG_ERROR_CREATE_APPCLIENT_COMPONENT; - public static String MSG_ERROR_COMPONENT_CREATION; - public static String MSG_ERROR_PROJECT_CREATION; - public static String MSG_ERROR_PROJECT_DOES_NOT_EXIST; - public static String MSG_ERROR_PROJECT_IS_NOT_OPEN; - public static String MSG_ERROR_ADDING_FACETS_TO_PROJECT; - public static String MSG_ERROR_FIXED_FACETS; - public static String MSG_FACETS; - public static String MSG_ERROR_SETTING_RUNTIME; - public static String MSG_ERROR_FILE_MERGE; - - - static { - NLS.initializeMessages(BUNDLE_NAME, ConsumptionMessages.class); - } -} 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 8a2774bf1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/Generator.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060811 153482 mahutch@ca.ibm.com - Mark Hutchinson - *******************************************************************************/ - -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 UNDERSCORE = '_'; - public String getSessionBeanId() - { - String name = getClientFolderPath(); - int index = name.lastIndexOf("/"); - index++; - StringBuffer newName = new StringBuffer(name.substring(index)); - - //We need to make this a valid java identifier - //To do this we will replace any character that is not valid with an underscore - for (int i = 0; i < newName.length(); i++) - { - char c = newName.charAt(i); - if (i == 0 && !Character.isJavaIdentifierStart(c) || !Character.isJavaIdentifierPart(c)) - { - newName.setCharAt(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 a01a64112..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/AttributeVisitor.java +++ /dev/null @@ -1,77 +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 5a9ad690a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/bean/FieldVisitor.java +++ /dev/null @@ -1,71 +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 730077693..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsBeanVisitorAction.java +++ /dev/null @@ -1,91 +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.ConsumptionMessages; -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(ConsumptionMessages.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(ConsumptionMessages.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(ConsumptionMessages.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 16bca06e6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/DetectNonJavaCharsMethodVisitorAction.java +++ /dev/null @@ -1,116 +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.ConsumptionMessages; -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(ConsumptionMessages.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(ConsumptionMessages.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(ConsumptionMessages.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(ConsumptionMessages.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 1a9ac05d2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofAttributeVisitorAction.java +++ /dev/null @@ -1,129 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -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 -{ - - /* - *Constructor - **/ - public JavaMofAttributeVisitorAction(Element parentElement, String project, IEnvironment env) - { - super(parentElement,project, env); - } - - 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( ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_TYPE + ((JavaHelpers)pd.getPropertyType()).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //ConsumptionMessages.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( ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_INDEXED_PROPERTIES + getMethod.getName() ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // ConsumptionMessages.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(ILog.WARNING, 5054, this, "visit", e); - status = StatusUtils.warningStatus( ConsumptionMessages.MSG_ERROR_JTS_JSP_GEN, e); - try { - env_.getStatusHandler().report(status); - } catch (StatusException e1) { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_JTS_JSP_GEN); - } - return status; - } - //env.Log.write(this,"visit",ILog.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 9af115278..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofBeanVisitorAction.java +++ /dev/null @@ -1,425 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; -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 -{ - - protected IEnvironment env_; - 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, IEnvironment env) - { - this.clientProject = clientProject; - fMethodsSelected = methods; - 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, IEnvironment env) - { - this.clientProject = clientProject; - fModel = model; - 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, IEnvironment env ) - { - fParentElement = parentElement; - this.clientProject = clientProject; - 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', ConsumptionMessages.LABEL_OK, ConsumptionMessages.DESCRIPTION_OK); - Choice CancelChoice = new Choice('C', ConsumptionMessages.LABEL_CANCEL, ConsumptionMessages.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( ConsumptionMessages.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(ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.MSG_WARN_JTS_PROXY_METHODS_OMITTED ); - return status; - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // ConsumptionMessages.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( ConsumptionMessages.MSG_ERROR_JTS_PROXY_HAS_NO_METHODS ); - //getStatusMonitor().reportStatus( new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0, - // ConsumptionMessages.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( ConsumptionMessages.MSG_ERROR_JTS_PROXY_HAS_NO_DEFAULT ); - //getStatusMonitor().reportStatus( new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0, - //ConsumptionMessages.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(IEnvironment 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 143774f22..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofFieldVisitorAction.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.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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -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 -{ - - /* - *Constructor - **/ - public JavaMofFieldVisitorAction(Element parentElement, String project, IEnvironment env) - { - super(parentElement,project, env); - } - - - 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( ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_TYPE + ((JavaHelpers)field.getJavaClass()).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //ConsumptionMessages.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(ILog.WARNING, 5055, this, "visit", e); - status = StatusUtils.warningStatus( ConsumptionMessages.MSG_ERROR_JTS_JSP_GEN, e); - try { - env_.getStatusHandler().report(status); - } - catch (StatusException e1) - { - status = StatusUtils.errorStatus(ConsumptionMessages.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 abe72790a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofMethodVisitorAction.java +++ /dev/null @@ -1,219 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -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 -{ - - 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, IEnvironment env) - { - super(parentElement,project, env); - 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(ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS + fUnsupportedParameterName ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_ARRAYS + fUnsupportedParameterName,null)); - fMethodsOmitted.addElement(method.getMethodElementSignature()); - return status; - } - if(!nullConstructor(method)){ - status = StatusUtils.warningStatus( ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_PARAMETERS_INPUTS + fUnsupportedParameterName ); - //getStatusMonitor().reportStatus (new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - // ConsumptionMessages.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 2a1fb4547..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofParameterVisitorAction.java +++ /dev/null @@ -1,80 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; -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 -{ - - - /* - *Constructor - **/ - public JavaMofParameterVisitorAction(Element parentElement,String project, IEnvironment env) - { - super(parentElement,project, env); - } - - /** - * 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',ConsumptionMessages.LABEL_OK, ConsumptionMessages.DESCRIPTION_OK); - Choice CancelChoice = new Choice('C', ConsumptionMessages.LABEL_CANCEL, ConsumptionMessages.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( ConsumptionMessages.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 88aa4591b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/JavaMofTypeVisitorAction.java +++ /dev/null @@ -1,114 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; -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 -{ - - /* - *Constructor - **/ - public JavaMofTypeVisitorAction(Element parentElement,String project, IEnvironment env) - { - super(parentElement,project, env); - } - - /** - * 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', ConsumptionMessages.LABEL_OK, ConsumptionMessages.DESCRIPTION_OK); - Choice CancelChoice = new Choice('C', ConsumptionMessages.LABEL_CANCEL, ConsumptionMessages.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( ConsumptionMessages.MSG_WARN_JTS_UNSUPPORTED_TYPE + ((JavaHelpers)typeNavigator).getJavaName() ); - //getStatusMonitor().reportStatus( new Status(IStatus.WARNING,WebServiceConsumptionPlugin.ID,0, - //ConsumptionMessages.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( ConsumptionMessages.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 35833fbd4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitoractions/VisitorActionImpl.java +++ /dev/null @@ -1,94 +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.osgi.util.NLS; - - - - - -/** -* 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; - - public VisitorActionImpl( Vector messages, Vector beansVisited) - { - this.messages = messages; - this.beansVisited = beansVisited; - } - - 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(key); - } - - protected void addMessage ( String key, Object[] args ) - { - getMessages().add(NLS.bind(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 6d2d6a044..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofAttributeVisitor.java +++ /dev/null @@ -1,217 +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.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.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.common.environment.IEnvironment; - - -/** -* 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 IEnvironment env; - - - public void setEnvironment(IEnvironment 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); - - Field field = javaClass.getFieldNamed(propertyName); - JavaHelpers propertyType = null; - if(field != null){ - propertyType = (JavaHelpers)field.getEType(); - 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 f693dfab0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofFieldVisitor.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.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.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaVisibilityKind; -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.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(field)) - status = vAction.visit(field); - } - } - } - - return status; - } - private boolean fieldCheck(Field field) - { - // so its a bean make sure it has a default constructor - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setProxyBean(((JavaHelpers)field.getEType()).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 3e37c717a..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.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 f297c3d7f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofParameterVisitor.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.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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.codegen.Visitor; -import org.eclipse.jst.ws.internal.consumption.codegen.VisitorAction; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; - - -/** -* Objects of this class represent a visitor. -* */ -public class JavaMofParameterVisitor implements Visitor -{ - private IEnvironment env_; - - /* - * Constructor - **/ - public JavaMofParameterVisitor(IEnvironment env) - { - 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', ConsumptionMessages.LABEL_OK, ConsumptionMessages.DESCRIPTION_OK); - Choice CancelChoice = new Choice('C', ConsumptionMessages.LABEL_CANCEL, ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.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 db1f25571..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/codegen/javamofvisitors/JavaMofTypeVisitor.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.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.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.common.environment.IEnvironment; - - - -/** -* 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 IEnvironment env_; - - private String clientProject; - - /* - * Constructor - **/ - public JavaMofTypeVisitor(IEnvironment 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){ - Field field = (Field)typeNavigator; - JavaMofReflectionCommand javaMofRef = new JavaMofReflectionCommand(); - javaMofRef.setClientProject(clientProject); - javaMofRef.setProxyBean(((JavaHelpers)field.getEType()).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 2cd7ffc62..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AbstractStartServer.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.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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.server.core.IServer; - -public abstract class AbstractStartServer { - -protected IProgressMonitor monitor; -private ILog log_; - -public AbstractStartServer() -{ - log_ = EnvironmentService.getEclipseLog(); -} - -/** - * 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(ILog.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,ConsumptionMessages.MSG_ERROR_SERVER,e)); - } -} - -protected void publishProject(IServer server) throws CoreException -{ - monitor.subTask( ConsumptionMessages.PROGRESS_INFO_PUBLISHING_SERVER ); - IStatus status = server.publish(IServer.PUBLISH_INCREMENTAL, monitor); - if (status.getSeverity() != IStatus.OK) - throw new CoreException(status); - log_.log(ILog.INFO, 5051, this, "publishProject", "IServer="+server+", Publish command completed"); - } - -protected void startProject(IServer server) throws CoreException -{ - try - { - monitor.subTask( ConsumptionMessages.PROGRESS_INFO_STARTING_SERVER ); - server.synchronousStart(ILaunchManager.RUN_MODE, monitor); - log_.log(ILog.INFO, 5052, this, "startProject", "IServer="+server+", Start command completed"); - - } - catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR,WebServiceConsumptionPlugin.ID,0,ConsumptionMessages.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 d25b4ec0b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AddModuleToServerCommand.java +++ /dev/null @@ -1,118 +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.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.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - - private String serverInstanceId; - private String project; - private String module; - - public AddModuleToServerCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - IServer server = ServerCore.findServer(serverInstanceId); - if (server == null) - { - status = StatusUtils.errorStatus( ConsumptionMessages.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)) - { - IModule imodule = ServerUtils.getModule(iproject); - 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( NLS.bind(ConsumptionMessages.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( NLS.bind(ConsumptionMessages.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 82ab8a312..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/AssociateModuleWithEARCommand.java +++ /dev/null @@ -1,89 +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.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.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class AssociateModuleWithEARCommand extends AbstractDataModelOperation -{ - private String project_; - private String module_; - private String earProject_; - private String ear_; - - - public AssociateModuleWithEARCommand(){ - - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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, moduleProject)) - J2EEUtils.associateComponentToEAR(moduleProject, earProject); - } - - // ensure modules are associated otherwise report error - if (!J2EEUtils.isComponentAssociated(earProject, moduleProject)){ - status = StatusUtils.errorStatus( NLS.bind(ConsumptionMessages.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 90c6ff9b3..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.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class BuildProjectCommand extends AbstractDataModelOperation -{ - 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 c5274a5ef..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CheckProjectOKCommand.java +++ /dev/null @@ -1,76 +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.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -public class CheckProjectOKCommand extends AbstractDataModelOperation -{ - - private String serviceServerTypeId_; - - - /** - * Default CTOR - */ - public CheckProjectOKCommand() { - } - - 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 = NLS.bind(ConsumptionMessages.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 329a3e5d9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeEndpointCommand.java +++ /dev/null @@ -1,137 +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.core.commands.ExecutionException; -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.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -public class ComputeEndpointCommand extends AbstractDataModelOperation -{ - 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; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeProxyEndpointCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeProxyEndpointCommand.java deleted file mode 100644 index fd014e829..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ComputeProxyEndpointCommand.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060728 145426 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.commands.ExecutionException; -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.common.frameworks.datamodel.AbstractDataModelOperation; - -public class ComputeProxyEndpointCommand extends AbstractDataModelOperation -{ - private Boolean monitorService; - private Integer monitoredPort; - private String proxyEndpoint; - private String endpoint; - - public ComputeProxyEndpointCommand() - { - } - - /** - * @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; - } - - public String getEndpoint() - { - if (monitorService != null && monitorService.booleanValue() && monitoredPort != null) - { - // Use the endpoint that matches with the proxy the extension passes to us if it is set - if (proxyEndpoint != null) { - String location = proxyEndpoint; - 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(); - } - } - } else { - return endpoint; - } - } - return null; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - - /** - * @param proxyEndpoint The proxyEndpoint to set. - */ - public void setProxyEndpoint(String proxyEndpoint) { - this.proxyEndpoint = proxyEndpoint; - } - /** - * @param endpoint The endpoint to set. - */ - public void setEndpoint(String endpoint) { - this.endpoint = endpoint; - } -} 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 c50a2a4b8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CopyWSDLCommand.java +++ /dev/null @@ -1,333 +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.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.uri.URIException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - 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 ) - { - IEnvironment 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( NLS.bind(ConsumptionMessages.MSG_ERROR_COPY_WSDL, new String[]{wsdlURI, destinationURI}), t); - env.getStatusHandler().reportError(status); - return status; - } - } - - private void copyWSDL(IEnvironment 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(IEnvironment 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(IEnvironment 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(IEnvironment 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 1d10ea922..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.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - private String earProjectName_; - private String serverFactoryId_; - private String j2eeVersion_; - - /** - * Constructor - */ - public CreateEARProjectCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - 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( NLS.bind(ConsumptionMessages.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/CreateFacetedProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java deleted file mode 100644 index 5e41b8fba..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner - * 20060217 126757 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - * 20060517 126965 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.command.common; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -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.server.core.FacetUtil; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher; -import org.eclipse.jst.ws.internal.consumption.common.FacetSetsByTemplateCache; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -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.ServerCore; - -public class CreateFacetedProjectCommand extends AbstractDataModelOperation -{ - - //name of the project to be created - private String projectName; - - //id of the IFacetedProjectTemplate to be used to create this project. - private String templateId; - - //required facet versions that must be satisfied when creating the project (this comes from - //the selected serverRuntime or clientRuntime in the calling scenario) - private RequiredFacetVersion[] requiredFacetVersions; - - //server type id - used to determine the facet runtime the created project will be bound to - //if serverInstanceId is null or empty - private String serverFactoryId; - - //server id - used to determine the facet runtime the created project will be bound to. May - //be null or empty. - private String serverInstanceId; - - //facet runtime determined from the serverInstanceId or serverFactoryId - private org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime; - - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - { - IStatus status = Status.OK_STATUS; - - // check if data ready - status = checkDataReady(); - if (status.getSeverity()==Status.ERROR) - { - return status; - } - - IProject project = ProjectUtilities.getProject(projectName); - if (!project.exists()) - { - try - { - status = FacetUtils.createNewFacetedProject(projectName); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - IProject createdProject = ProjectUtilities.getProject(projectName); - IFacetedProject fproject = ProjectFacetsManager.create(createdProject); - - //Get the facet versions to install. - Set facetsToAdd = getFacetsToAdd(); - - //Install the facet versions - status = FacetUtils.addFacetsToProject(fproject, facetsToAdd); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - //Set the installed facet versions as fixed. - Set newFacetVersions = fproject.getProjectFacets(); - Set fixedFacets = new HashSet(); - for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) { - IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next(); - fixedFacets.add(facetVersion.getProjectFacet()); - } - status = FacetUtils.setFixedFacetsOnProject(fproject, fixedFacets); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - - //Set the runtime - if (facetRuntime != null) - { - status = FacetUtils.setFacetRuntimeOnProject(fproject, facetRuntime); - } - - // add facets required by Web service runtime - if (requiredFacetVersions.length != 0) { - status = FacetUtils.addRequiredFacetsToProject(project, requiredFacetVersions, monitor); - if (status.getSeverity() == Status.ERROR) - { - return status; - } - } - - // add the default facets that's not in conflict with the existing facets - Set projectFacetVersionSet = fproject.getProjectFacets(); - Set projectFacetSet = new HashSet(); - // get the project facet from the project facet version we calculated - for (Iterator iter = projectFacetVersionSet.iterator(); iter.hasNext();) { - IProjectFacetVersion pfv = (IProjectFacetVersion) iter.next(); - projectFacetSet.add(pfv.getProjectFacet()); - } - try { - Set defaultProjectFacetVersionSet = facetRuntime.getDefaultFacets(projectFacetSet); - // The returned defaultFacetSet contains the original projectFacetSet passed into getDefaultFacets - // plus any default facets that are not in conflict with the original projectFacetSet. - // Add to facetsToAdd if the the default facet is not in the original set. - Set defaultFacetsToAdd = new HashSet(); - for (Iterator iter = defaultProjectFacetVersionSet.iterator(); iter.hasNext();) { - IProjectFacetVersion defaultProjFacetVersion = (IProjectFacetVersion) iter.next(); - if( ! projectFacetSet.contains( defaultProjFacetVersion.getProjectFacet() ) ) - { - defaultFacetsToAdd.add(defaultProjFacetVersion); - } - } - if (!defaultFacetsToAdd.isEmpty()) { - status = FacetUtils.addFacetsToProject(fproject, defaultFacetsToAdd); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - } - } catch (CoreException e) { - // If there's any exception when trying to get the default facet, just ignore the default facet - // and return the original facetsToAdd. - } - // end of adding default facets - - } catch (CoreException ce) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName })); - } - } - return status; - } - - private IStatus checkDataReady() - { - - if (projectName == null) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] {projectName})); - } - - return Status.OK_STATUS; - } - - /** - * Returns the set of facets to install on the new project. The set will consist - * of the highest version of each of the template's fixed facets that satifies - * both the required facet versions and the facet runtime. - * @return Set a Set containing elements of type IProjectFacetVersion. - */ - private Set getFacetsToAdd() - { - Set facets = null; - - //Set the facet runtime. - setFacetRuntime(); - //Get all facet version combinations for the template in order of ascending version numbers. - Set[] allCombinations = FacetSetsByTemplateCache.getInstance().getFacetVersionCombinationsFromTemplate(templateId); - int n = allCombinations.length; - if (facetRuntime != null) - { - //Walk the facet version combinations in order of descending version numbers. - for (int i=n-1; i>=0; i--) - { - //Check this template combination to see if it is compatible with both the - //required facet versions and the server runtime. If it is, choose it. - Set combination = allCombinations[i]; - FacetMatcher fm = FacetUtils.match(requiredFacetVersions, combination); - if (fm.isMatch()) - { - //Check against Runtime - if (FacetUtils.doesRuntimeSupportFacets(facetRuntime, combination)) - { - //We have a match. Use this combination of facet versions for project creation. - facets = combination; - break; - } - } - } - - } - else - { - for (int i=n-1; i>=0; i--) - { - //Check this template combination to see if it is compatible with both the - //service/client runtime and the server runtime. If it is, choose it. - Set combination = allCombinations[i]; - FacetMatcher fm = FacetUtils.match(requiredFacetVersions, combination); - if (fm.isMatch()) - { - //We have a match. Use this combination of facet versions for project creation. - facets = combination; - break; - } - } - } - - //Unlikely to get to this point in the code, but if we do, choose the highest version - //of each fixed facet in the template. - if (facets == null) - { - facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - } - - return facets; - } - - /** - * Sets the facetRuntime attribute based on the serverInstanceId or serverFactoryId - * Preference is given to non-stub facet runtimes. - */ - private void setFacetRuntime() - { - - if (serverInstanceId != null && serverInstanceId.length()>0) - { - IServer server = ServerCore.findServer(serverInstanceId); - IRuntime sRuntime = server.getRuntime(); - facetRuntime = FacetUtil.getRuntime(sRuntime); - } - else - { - if (serverFactoryId != null && serverFactoryId.length() > 0) - { - //Find a non Stub runtime that matches this server type - IRuntime serverRuntime = ServerUtils.getNonStubRuntime(serverFactoryId); - if (serverRuntime != null) - { - facetRuntime = FacetUtil.getRuntime(serverRuntime); - } - else - { - //Accept stub runtime. - IServerType st = ServerCore.findServerType(serverFactoryId); - String runtimeTypeId = st.getRuntimeType().getId(); - //Find the facet runtime - IRuntime[] runtimes = ServerCore.getRuntimes(); - for (int i=0; i<runtimes.length; i++) - { - IRuntime sRuntime = runtimes[i]; - if (sRuntime.getRuntimeType().getId().equals(runtimeTypeId)) - { - facetRuntime = FacetUtil.getRuntime(sRuntime); - } - } - } - } - } - } - - public void setProjectName(String projectName) - { - this.projectName = projectName; - } - - public void setTemplateId(String templateId) - { - this.templateId = templateId; - } - - public void setRequiredFacetVersions(RequiredFacetVersion[] requiredFacetVersions) - { - this.requiredFacetVersions = requiredFacetVersions; - } - - public void setServerFactoryId(String serverFactoryId) - { - this.serverFactoryId = serverFactoryId; - } - - 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/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 b17308122..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateJavaProjectCommand.java +++ /dev/null @@ -1,82 +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.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - - -public class CreateJavaProjectCommand extends AbstractDataModelOperation -{ - private String projectName_; - - /** - * Default CTOR - */ - public CreateJavaProjectCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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( NLS.bind(ConsumptionMessages.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 e0cce92cd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java +++ /dev/null @@ -1,734 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner * - * 20060217 126757 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.command.common; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -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.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.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties; -import org.eclipse.jst.server.core.FacetUtil; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.VersionFormatException; -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.ServerCore; - -public class CreateModuleCommand extends AbstractDataModelOperation -{ - - 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; - - //Templates - //TODO Remove these template constants once J2EE tools defines constants (bug 117531) - public final static String WEB_TEMPLATE = "template.jst.web"; - public final static String EJB_TEMPLATE = "template.jst.ejb"; - public final static String APPCLIENT_TEMPLATE = "template.jst.appclient"; - public final static String EAR_TEMPLATE = "template.jst.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 IEnvironment env; - private IProgressMonitor monitor_; - - private org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime; - - public CreateModuleCommand(){ - } - - 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; - } - - //ensure the project does not exist - IProject project = ProjectUtilities.getProject(projectName); - if (!project.exists()) - { - // 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( NLS.bind(ConsumptionMessages.MSG_ERROR_COMPONENT_CREATION, new String[]{moduleName}) ); - } - } - - - // check if flexible project exists - /* - 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(NLS.bind(ConsumptionMessages.MSG_ERROR_COMPONENT_CREATION, new String[]{projectName, moduleName}) ); - } - */ - - - - - return status; - } - - private IStatus checkDataReady(){ - - if (projectName==null || serverFactoryId==null){ - return StatusUtils.errorStatus( NLS.bind(ConsumptionMessages.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 - { - status = FacetUtils.createNewFacetedProject(projectName); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - IProject createdProject = ProjectUtilities.getProject(projectName); - IFacetedProject fproject = ProjectFacetsManager.create(createdProject); - - //Decide which facets to install based on the templateId and the selected server. - Set facetsToAdd = getFacetsToAdd(WEB_TEMPLATE); - Set facetsToAddModified = facetsToAdd; - //If the J2EE level has been set, modify the Web facet version to be consistent. - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - String webVersion = getWebVersionFromJ2EELevel(j2eeLevel); - facetsToAddModified = new HashSet(); - Iterator itr = facetsToAdd.iterator(); - while (itr.hasNext()) - { - //If this is the web facet, get the right version. - IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next(); - IProjectFacet pf = pfv.getProjectFacet(); - if (pf.getId().equals(IModuleConstants.JST_WEB_MODULE)) - { - IProjectFacetVersion webfv = pf.getVersion(webVersion); - facetsToAddModified.add(webfv); - } - else - { - facetsToAddModified.add(pfv); - } - } - } - - status = FacetUtils.addFacetsToProject(fproject, facetsToAddModified); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - Set newFacetVersions = fproject.getProjectFacets(); - Set fixedFacets = new HashSet(); - for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) { - IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next(); - fixedFacets.add(facetVersion.getProjectFacet()); - } - - status = FacetUtils.setFixedFacetsOnProject(fproject, fixedFacets); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - //Set the runtime - if (facetRuntime != null) - { - status = FacetUtils.setFacetRuntimeOnProject(fproject, facetRuntime); - } - - } catch (CoreException ce) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), ce); - } - - return status; - - } - - /** - * Create an EAR component - * @return - */ - public IStatus createEARComponent(){ - IStatus status = Status.OK_STATUS; - - try - { - status = FacetUtils.createNewFacetedProject(projectName); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - IProject createdProject = ProjectUtilities.getProject(projectName); - IFacetedProject fproject = ProjectFacetsManager.create(createdProject); - - //Decide which facets to install based on the templateId and the selected server. - Set facetsToAdd = getFacetsToAdd(EAR_TEMPLATE); - Set facetsToAddModified = facetsToAdd; - //If the J2EE level has been set, modify the Web facet version to be consistent. - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - String webVersion = getEARVersionFromJ2EELevel(j2eeLevel); - facetsToAddModified = new HashSet(); - Iterator itr = facetsToAdd.iterator(); - while (itr.hasNext()) - { - //If this is the ear facet, get the right version. - IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next(); - IProjectFacet pf = pfv.getProjectFacet(); - if (pf.getId().equals(IModuleConstants.JST_EAR_MODULE)) - { - IProjectFacetVersion webfv = pf.getVersion(webVersion); - facetsToAddModified.add(webfv); - } - else - { - facetsToAddModified.add(pfv); - } - } - } - - status = FacetUtils.addFacetsToProject(fproject, facetsToAddModified); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - Set newFacetVersions = fproject.getProjectFacets(); - Set fixedFacets = new HashSet(); - for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) { - IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next(); - fixedFacets.add(facetVersion.getProjectFacet()); - } - - status = FacetUtils.setFixedFacetsOnProject(fproject, fixedFacets); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - //Set the runtime - if (facetRuntime != null) - { - status = FacetUtils.setFacetRuntimeOnProject(fproject, facetRuntime); - } - - } catch (CoreException ce) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), ce); - } - - return status; - } - - /** - * Create an EJB Component - * @return - */ - public IStatus createEJBComponent(){ - IStatus status = Status.OK_STATUS; - - try - { - status = FacetUtils.createNewFacetedProject(projectName); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - IProject createdProject = ProjectUtilities.getProject(projectName); - IFacetedProject fproject = ProjectFacetsManager.create(createdProject); - - //Decide which facets to install based on the templateId and the selected server. - Set facetsToAdd = getFacetsToAdd(EJB_TEMPLATE); - Set facetsToAddModified = facetsToAdd; - //If the J2EE level has been set, modify the Web facet version to be consistent. - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - String webVersion = getEJBVersionFromJ2EELevel(j2eeLevel); - facetsToAddModified = new HashSet(); - Iterator itr = facetsToAdd.iterator(); - while (itr.hasNext()) - { - //If this is the web facet, get the right version. - IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next(); - IProjectFacet pf = pfv.getProjectFacet(); - if (pf.getId().equals(IModuleConstants.JST_EJB_MODULE)) - { - IProjectFacetVersion webfv = pf.getVersion(webVersion); - facetsToAddModified.add(webfv); - } - else - { - facetsToAddModified.add(pfv); - } - } - } - - status = FacetUtils.addFacetsToProject(fproject, facetsToAddModified); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - Set newFacetVersions = fproject.getProjectFacets(); - Set fixedFacets = new HashSet(); - for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) { - IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next(); - fixedFacets.add(facetVersion.getProjectFacet()); - } - - status = FacetUtils.setFixedFacetsOnProject(fproject, fixedFacets); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - //Set the runtime - if (facetRuntime != null) - { - status = FacetUtils.setFacetRuntimeOnProject(fproject, facetRuntime); - } - - } catch (CoreException ce) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_CREATE_EJB_COMPONENT, new String[] { projectName }), ce); - } - - return status; - - } - - /** - * Create an Application Client component - * @return - */ - public IStatus createAppClientComponent() - { - IStatus status = Status.OK_STATUS; - - try - { - status = FacetUtils.createNewFacetedProject(projectName); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - IProject createdProject = ProjectUtilities.getProject(projectName); - IFacetedProject fproject = ProjectFacetsManager.create(createdProject); - - //Decide which facets to install based on the templateId and the selected server. - Set facetsToAdd = getFacetsToAdd(APPCLIENT_TEMPLATE); - Set facetsToAddModified = facetsToAdd; - //If the J2EE level has been set, modify the Web facet version to be consistent. - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - String webVersion = getAppClientVersionFromJ2EELevel(j2eeLevel); - facetsToAddModified = new HashSet(); - Iterator itr = facetsToAdd.iterator(); - while (itr.hasNext()) - { - //If this is the web facet, get the right version. - IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next(); - IProjectFacet pf = pfv.getProjectFacet(); - if (pf.getId().equals(IModuleConstants.JST_APPCLIENT_MODULE)) - { - IProjectFacetVersion webfv = pf.getVersion(webVersion); - facetsToAddModified.add(webfv); - } - else - { - facetsToAddModified.add(pfv); - } - } - } - - status = FacetUtils.addFacetsToProject(fproject, facetsToAddModified); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - Set newFacetVersions = fproject.getProjectFacets(); - Set fixedFacets = new HashSet(); - for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) { - IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next(); - fixedFacets.add(facetVersion.getProjectFacet()); - } - - status = FacetUtils.setFixedFacetsOnProject(fproject, fixedFacets); - if (status.getSeverity() == IStatus.ERROR) - { - return status; - } - - //Set the runtime - if (facetRuntime != null) - { - status = FacetUtils.setFacetRuntimeOnProject(fproject, facetRuntime); - } - - } catch (CoreException ce) - { - return StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_CREATE_APPCLIENT_COMPONENT, new String[] { projectName }), ce); - } - - 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( NLS.bind(ConsumptionMessages.MSG_ERROR_CREATE_FLEX_PROJET, new String[]{projectName}), e); - } - return status; - } - - /* - * @return Set Returns the Set of facets to add to the new project, - * choosing the highest level of each facet that works on the selected server. - */ - private Set getFacetsToAdd(String templateId) - { - Set facets = new HashSet(); - - //Set the facet runtime. - setFacetRuntime(); - if (facetRuntime != null) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId); - Set templateFacets = template.getFixedProjectFacets(); - Iterator templateFacetsItr = templateFacets.iterator(); - while (templateFacetsItr.hasNext()) - { - IProjectFacet fixedFacet = (IProjectFacet)templateFacetsItr.next(); - List versions = null; - try { - versions = fixedFacet.getSortedVersions(false); - } catch (VersionFormatException e) { - Set versionSet = fixedFacet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } catch (CoreException e) { - Set versionSet = fixedFacet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } - Iterator versionsItr = versions.iterator(); - while(versionsItr.hasNext()) - { - IProjectFacetVersion pfv = (IProjectFacetVersion)versionsItr.next(); - Set pfvs = new HashSet(); - pfvs.add(pfv); - - //Check against Runtime - if (FacetUtils.doesRuntimeSupportFacets(facetRuntime, pfvs)) - { - //We have a match. Add this one to the master set. - facets.add(pfv); - break; - } - } - } - } - else - { - facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - } - - - return facets; - } - - private void setFacetRuntime() - { - - if (serverInstanceId_ != null && serverInstanceId_.length()>0) - { - IServer server = ServerCore.findServer(serverInstanceId_); - IRuntime sRuntime = server.getRuntime(); - facetRuntime = FacetUtil.getRuntime(sRuntime); - } - else - { - //Find a non Stub runtime that matches this server type - IRuntime serverRuntime = ServerUtils.getNonStubRuntime(serverFactoryId); - if (serverRuntime != null) - { - facetRuntime = FacetUtil.getRuntime(serverRuntime); - } - else - { - //Accept stub runtime. - IServerType st = ServerCore.findServerType(serverFactoryId); - String runtimeTypeId = st.getRuntimeType().getId(); - //Find the facet runtime - IRuntime[] runtimes = ServerCore.getRuntimes(); - for (int i=0; i<runtimes.length; i++) - { - IRuntime sRuntime = runtimes[i]; - if (sRuntime.getRuntimeType().getId().equals(runtimeTypeId)) - { - facetRuntime = FacetUtil.getRuntime(sRuntime); - } - } - } - } - } - - private String getWebVersionFromJ2EELevel(String j2eeVersion) - { - int aVersion = Integer.valueOf(j2eeLevel).intValue(); - switch (aVersion) { - case J2EEVersionConstants.J2EE_1_2_ID: - return "2.2"; - - case J2EEVersionConstants.J2EE_1_3_ID: - return "2.3"; - - case J2EEVersionConstants.J2EE_1_4_ID: - return "2.4"; - - default: - return "2.4"; - } - } - - private String getEJBVersionFromJ2EELevel(String j2eeVersion) - { - int aVersion = Integer.valueOf(j2eeLevel).intValue(); - switch (aVersion) { - case J2EEVersionConstants.J2EE_1_2_ID: - return "1.1"; - - case J2EEVersionConstants.J2EE_1_3_ID: - return "2.0"; - - case J2EEVersionConstants.J2EE_1_4_ID: - return "2.1"; - - default: - return "2.1"; - } - } - - private String getAppClientVersionFromJ2EELevel(String j2eeVersion) - { - int aVersion = Integer.valueOf(j2eeLevel).intValue(); - switch (aVersion) { - case J2EEVersionConstants.J2EE_1_2_ID: - return "1.2"; - - case J2EEVersionConstants.J2EE_1_3_ID: - return "1.3"; - - case J2EEVersionConstants.J2EE_1_4_ID: - return "1.4"; - - default: - return "1.4"; - } - } - - private String getEARVersionFromJ2EELevel(String j2eeVersion) - { - int aVersion = Integer.valueOf(j2eeLevel).intValue(); - switch (aVersion) { - case J2EEVersionConstants.J2EE_1_2_ID: - return "1.2"; - - case J2EEVersionConstants.J2EE_1_3_ID: - return "1.3"; - - case J2EEVersionConstants.J2EE_1_4_ID: - return "1.4"; - - default: - return "1.4"; - } - } - - 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 ce05bff11..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateMonitorCommand.java +++ /dev/null @@ -1,137 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - - 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 ) - { - IEnvironment 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) { - IStatus error = StatusUtils.errorStatus( NLS.bind(ConsumptionMessages.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) { - IStatus error = StatusUtils.errorStatus( NLS.bind(ConsumptionMessages.MSG_ERROR_UNABLE_TO_START_MONITOR, new Object[] { - String.valueOf(port.getPort()), server.getName()}), ce); - env.getStatusHandler().reportError(error); - return error; - } - } - - else { - IStatus info = StatusUtils.infoStatus( NLS.bind(ConsumptionMessages.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 fe31e83af..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateServerCommand.java +++ /dev/null @@ -1,123 +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.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.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - private String serverFactoryId; - private String serverInstanceId; - - /** - * 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(){ - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - if (serverFactoryId==null){ - status = StatusUtils.errorStatus(ConsumptionMessages.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( NLS.bind(ConsumptionMessages.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( ConsumptionMessages.MSG_ERROR_CREATE_SERVER, ce); - return status; - } - - // set serverInstanceId - if (server!=null) - serverInstanceId = server.getId(); - else { - status = StatusUtils.errorStatus( ConsumptionMessages.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 f10d2c35c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableBuildCommand.java +++ /dev/null @@ -1,68 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.datamodel.Model; - - -public class DisableBuildCommand extends AbstractDataModelOperation -{ - - private ValidationManager manager_; - /** - * CTOR; - */ - public DisableBuildCommand() - { - - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - ProgressUtils.report( monitor, ConsumptionMessages.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 c513db90b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/DisableValidationCommand.java +++ /dev/null @@ -1,63 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class DisableValidationCommand extends AbstractDataModelOperation -{ - - private ValidationManager manager_; - private IProject serviceProject_; - - /** - * CTOR; - */ - public DisableValidationCommand() { - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - ProgressUtils.report(monitor, ConsumptionMessages.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 840cd647f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/GetMonitorCommand.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060612 146564 kathy@ca.ibm.com - Kathy Chan - * 20060728 145426 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.common.WSDLParserFactory; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - private boolean monitorService; - private boolean create; - private WebServicesParser webServicesParser; - private String wsdlURI; - private List endpoints; - private String proxyEndpoint; - - public GetMonitorCommand() - { - monitorService = true; - create = true; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - endpoints = new Vector(); - if (monitorService && wsdlURI != null && wsdlURI.length() > 0) - { - webServicesParser = WSDLParserFactory.getWSDLParser(); - 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( NLS.bind(ConsumptionMessages.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(); - // Use the endpoint that matches with the proxy the extension passes to us if it is set - if (proxyEndpoint != null) { - try { - endpointURL = new URL(proxyEndpoint); - } catch (MalformedURLException murle) - { - // ignore proxy endpoint - } - } - 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( NLS.bind(ConsumptionMessages.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; - } - - /** - * @param proxyEndpoint The proxyEndpoint to set. - */ - public void setProxyEndpoint(String proxyEndpoint) { - this.proxyEndpoint = proxyEndpoint; - } -} 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 b0ad9da58..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java +++ /dev/null @@ -1,114 +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.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jem.util.emf.workbench.nature.EMFNature; -import org.eclipse.jem.workbench.utility.JemProjectUtilities; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** -* 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 AbstractDataModelOperation -{ - - 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 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( ConsumptionMessages.MSG_WARN_UNABLE_TO_FIND_PROXY ); - - try { - EMFNature nature = JemProjectUtilities.getJEM_EMF_Nature(clientIProject, true); - javaClass = JavaRefFactory.eINSTANCE.reflectType(qname, nature.getResourceSet()); - } catch (CoreException e) { - } - - 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 5ca1c3224..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/ManageServerStartUpCommand.java +++ /dev/null @@ -1,139 +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.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; - -public class ManageServerStartUpCommand extends AbstractDataModelOperation -{ - - 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_; - - /** - * Default CTOR; - */ - public ManageServerStartUpCommand( ) { - - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - ProgressUtils.report(monitor, ConsumptionMessages.PROGRESS_INFO_START_WEB_PROJECT); - - if (isStartServiceEnabled_.booleanValue() && serviceExistingServer_!=null){ - //System.out.println("Calling service server start: "+serviceProject_+" "+serviceServerTypeId_); - StartProjectCommand spc = new StartProjectCommand( ); - 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( ); - 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/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 f663b4846..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreBuildStateCommand.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.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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class RestoreBuildStateCommand extends AbstractDataModelOperation -{ - - private ValidationManager manager_; - - /** - * Default CTOR; - */ - public RestoreBuildStateCommand() - { - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - ProgressUtils.report( monitor, ConsumptionMessages.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 6ae6317ea..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/RestoreValidationStateCommand.java +++ /dev/null @@ -1,58 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.datamodel.validate.ValidationManager; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class RestoreValidationStateCommand extends AbstractDataModelOperation -{ - private ValidationManager manager_; - - private boolean runValidation_; - - /** - * Default CTOR; - */ - public RestoreValidationStateCommand( boolean runValidation ) - { - runValidation_ = runValidation; - } - - /** - * Execute the command - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - ProgressUtils.report( monitor, ConsumptionMessages.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/SkeletonMergeCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/SkeletonMergeCommand.java deleted file mode 100644 index 30f1da3f2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/SkeletonMergeCommand.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060330 128827 kathy@ca.ibm.com - Kathy Chan - * 20060403 128827 kathy@ca.ibm.com - Kathy Chan - * 20060524 141925 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.command.common; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -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.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.common.MergeUtils; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; -import org.eclipse.wst.ws.internal.preferences.PersistentMergeContext; - -public class SkeletonMergeCommand extends AbstractDataModelOperation -{ - private String[] urls_; - private String projectName_; - - public SkeletonMergeCommand(String projectName) - { - projectName_ = projectName; - } - - public void setUrls(String[] urls) - { - this.urls_ = urls; - } - - // Merge the content of the skeleton files (represented by urls_ with the previous version stored. - // The Web service extensions triggers the storing of the content of the old skeleton file by - // calling WebServiceInfo.setImplURLs() before the new skeleton is generated in the extension's - // develop() method. - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - { - - IStatus status = Status.OK_STATUS; - IEnvironment environment = getEnvironment(); - ResourceContext context = WebServicePlugin.getInstance().getResourceContext(); - PersistentMergeContext mergeContext = WSPlugin.getInstance().getMergeContext(); - if (mergeContext.isSkeletonMergeEnabled()) { - // merge the skeleton implementation file with the model stored earlier - - String mergedContent; - String filename; - InputStream inStream = null; - if (urls_ != null) { - for (int i = 0; i < urls_.length; i++) { - filename = MergeUtils.getFileFromURL(urls_[i]); - if (filename != null) { - mergedContent = MergeUtils.mergeFile(filename); - if (mergedContent != null) { - // write the merged content back into the file, respecting file overwrite preference - IPath targetPath = new Path(filename); - IProject project = ProjectUtilities.getProject(projectName_); - byte[] buf = null; - if (project != null) { - try { - buf = mergedContent.getBytes(project.getDefaultCharset()); - } catch (Throwable e) { - buf = mergedContent.getBytes(); - } - } else { - buf = mergedContent.getBytes(); - } - inStream = new ByteArrayInputStream(buf); - - if (inStream != null) { - try { - FileResourceUtils.createFileAtLocation(context, targetPath.makeAbsolute(), inStream, - monitor, environment.getStatusHandler()); - } catch (CoreException e) { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_FILE_MERGE, urls_), e); - environment.getStatusHandler().reportError( status ); - } - } - } - } - } - } - } - - return status; - } -} 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 ef01e27a5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/StartProjectCommand.java +++ /dev/null @@ -1,156 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.common.WebServiceStartServerRegistry; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; - -public class StartProjectCommand extends AbstractDataModelOperation -{ - -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_; - - -/** - * Default CTOR; - */ -public StartProjectCommand( ) { - -} - -/** - * Default CTOR; - */ -public StartProjectCommand(boolean creationScenario ) { - creationScenario_ = new Boolean(creationScenario); -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - ProgressUtils.report( monitor, ConsumptionMessages.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( ConsumptionMessages.MSG_ERROR_PROJECT_NOT_FOUND ); - env.getStatusHandler().reportError(status); - return status; - } - IServer instance = ServerUtils.getServerForModule(ServerUtils.getModule(project), serverTypeID, server, true, monitor ); - if (instance == null) - { - status = StatusUtils.errorStatus( ConsumptionMessages.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( ConsumptionMessages.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/common/FacetMatcher.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetMatcher.java deleted file mode 100644 index 5fac372d0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetMatcher.java +++ /dev/null @@ -1,61 +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 java.util.Set; - -public class FacetMatcher -{ - private boolean match; - private Set facetsTested; - private Set facetsThatMatched; - private Set facetsToAdd; - - public Set getFacetsThatMatched() - { - return facetsThatMatched; - } - public void setFacetsThatMatched(Set facetsThatMatched) - { - this.facetsThatMatched = facetsThatMatched; - } - public Set getFacetsToAdd() - { - return facetsToAdd; - } - public void setFacetsToAdd(Set facetsToAdd) - { - this.facetsToAdd = facetsToAdd; - } - public boolean isMatch() - { - return match; - } - public void setMatch(boolean match) - { - this.match = match; - } - public Set getFacetsTested() - { - return facetsTested; - } - public void setFacetsTested(Set facetsTested) - { - this.facetsTested = facetsTested; - } - - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetSetsByTemplateCache.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetSetsByTemplateCache.java deleted file mode 100644 index 7922db8ec..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetSetsByTemplateCache.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner (creation) - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.common; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.VersionFormatException; - - -/** - * FacetSetsByTemplateCache caches the sets of facet version combinations for templates. - */ -public class FacetSetsByTemplateCache -{ - // single instance per workbench - private static FacetSetsByTemplateCache instance_; - - //facetSetsByTemplateId_: - //key: Object of type String. String id of an IFacetedProjectTemplate. - //value: Object of Set[]. An array of Sets where each set contains elements of type IProjectFacetVersion. - private Hashtable facetSetsByTemplateId_; - /** - * Returns a singleton instance of this class. - * - * @return A singleton FacetSetsByTemplateCache object. - */ - public static synchronized FacetSetsByTemplateCache getInstance() - { - if (instance_ == null) - { - instance_ = new FacetSetsByTemplateCache(); - instance_.load(); - } - return instance_; - } - - private void load() - { - facetSetsByTemplateId_ = new Hashtable(); - } - - /** - * Returns all the valid facet version combinations that can be derived from the fixed facets - * of the given template. For example, if the template has two fixed facets, A and B, - * and A has versions 1.0 and 2.0, B has versions 1.1, 2.1, - * the following array of Sets will be returned (assuming for the sake of the example - * that all the combinations are valid):<br/> - * {Set1, Set2, Set3, Set4}, where<br/> - * Set1 = [A1.0, B1.1]<br/> - * Set2 = [A2.0, B1.1]<br/> - * Set3 = [A1.0, B2.1]<br/> - * Set4 = [A2.0, B2.1]<br/> - * <br/> - * @param templateId id of an {@link IFacetedProjectTemplate} - * @return Set[] An array of Sets where each set contains elements of type {@link IProjectFacetVersion}. - */ - public synchronized Set[] getFacetVersionCombinationsFromTemplate(String templateId) - { - //Return the cached combinations if present. - Set[] cachedCombinations = (Set[])facetSetsByTemplateId_.get(templateId); - if (cachedCombinations != null) - { - return cachedCombinations; - } - else - { - //Combinations have not yet been cached for the given template. - //Determine the combinations and cache them. - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId); - Set fixedFacets = template.getFixedProjectFacets(); - - //Create an array of arrays. Each element of the array will contain the array - //of IProjectFacetVersions for each IProjectFacet in the set of fixed facets. - Iterator itr = fixedFacets.iterator(); - ArrayList projectFacetVersionArrays = new ArrayList(); - - while (itr.hasNext()) - { - IProjectFacet facet = (IProjectFacet) itr.next(); - List versions = null; - try - { - // Get the facet versions in ascending order. - versions = facet.getSortedVersions(true); - } catch (VersionFormatException e) { - Set versionSet = facet.getVersions(); - Iterator versionSetItr = versionSet.iterator(); - versions = new ArrayList(); - while (versionSetItr.hasNext()) - { - versions.add(itr.next()); - } - } catch (CoreException e) { - Set versionSet = facet.getVersions(); - Iterator versionSetItr = versionSet.iterator(); - versions = new ArrayList(); - while (versionSetItr.hasNext()) - { - versions.add(itr.next()); - } - } - if (versions.size() > 0) - { - //Create an array of IProjectFacetVersions from versions. - Iterator versionItr = versions.iterator(); - ArrayList arrayOfVersionsList = new ArrayList(); - while (versionItr.hasNext()) - { - IProjectFacetVersion pfv = (IProjectFacetVersion)versionItr.next(); - arrayOfVersionsList.add(pfv); - } - - //Add the array of versions to the list of arrays. - projectFacetVersionArrays.add((IProjectFacetVersion[])arrayOfVersionsList.toArray(new IProjectFacetVersion[0])); - } - } - - IProjectFacetVersion[][] arrayOfProjectFacetVersionArrays = (IProjectFacetVersion[][])projectFacetVersionArrays.toArray(new IProjectFacetVersion[0][0]); - Set[] allValidCombinationsArray = FacetUtils.getFacetCombinations(arrayOfProjectFacetVersionArrays, true); - facetSetsByTemplateId_.put(templateId, allValidCombinationsArray); - return allValidCombinationsArray; - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetUtils.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetUtils.java deleted file mode 100644 index 2743dc410..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FacetUtils.java +++ /dev/null @@ -1,1339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060217 126757 rsinha@ca.ibm.com - Rupam Kuehner - * 20060419 137548 kathy@ca.ibm.com - Kathy Chan - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - * 20060503 126819 rsinha@ca.ibm.com - Rupam Kuehner - * 20060523 133714 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.common; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -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.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.VersionFormatException; -import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action; -import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; -import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager; - -import com.ibm.icu.util.StringTokenizer; - -/** - * FacetUtils contains utility methods related to facets and templates. - * <br/><br/> - * Terminology used in the Javadoc in this class - * <ul> - * <li><b>facet</b>: An {@link IProjectFacet}</li> - * <li><b>facet version</b>: An {@link IProjectFacetVersion} </li> - * <li><b>facet runtime</b>: An {@link IRuntime}</li> - * <li><b>faceted project</b>: An {@link IFacetedProject}. A faceted project may be obtained - * from an IProject (@see ProjectFacetsManager#create)</li> - * <li><b>template</b>: An {@link IFacetedProjectTemplate}. Conceptually this is similar to a project type.</li> - * <li><b>required facet version</b>: A {@link RequiredFacetVersion}. Used by serviceRuntimes and clientRuntimes - * to identify what they require in terms of facet versions.</li> - * </ul> - */ -public class FacetUtils -{ - - /** - * Returns an array of valid projects. Valid projects include projects with the facets nature or - * projects with the Java nature. - * @return IProject[] an array of valid projects - */ - public static IProject[] getAllProjects() - { - //Return all projects in the workspace that have the project facet nature or that do not have the project - //facet nature but have the Java nature. - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - ArrayList validProjects = new ArrayList(); - for (int i = 0; i < projects.length; i++) - { - try - { - IFacetedProject facProject = ProjectFacetsManager.create(projects[i]); - if (facProject != null) - { - //Add it to the list - validProjects.add(projects[i]); - } - else - { - if (ResourceUtils.isJavaProject(projects[i])) - { - validProjects.add(projects[i]); - } - } - } - catch (CoreException ce) - { - } - } - return (IProject[])validProjects.toArray(new IProject[]{}); - } - - /** - * Returns the facet versions on the given project. - * @param projectName name of an existing project. - * @returns Set containing elements of type {@link IProjectFacetVersion}. - * These are the facet versions currently installed on this project. If the project - * is a Java project, facets are inferred from the Java project. Returns null - * <ul> - * <li>if the project is not a faceted project or a Java project or</li> - * <li>if the project does not exist or</li> - * <li>if the project is null</li> - * </ul> - */ - public static Set getFacetsForProject(String projectName) - { - Set facetVersions = null; - IProject project = ProjectUtilities.getProject(projectName); - if (project!=null && project.exists()) - { - try - { - IFacetedProject fproject = ProjectFacetsManager.create(project); - if (fproject != null) - { - facetVersions = fproject.getProjectFacets(); - } else - { - //If this is not a faceted project, it may still be okay if it is a Java project - //and the client runtime supports a Java project. - IJavaProject javaProject = null; - if (ResourceUtils.isJavaProject(project)) - { - javaProject = JavaCore.create(project); - facetVersions = FacetUtils.getFacetsForJavaProject(javaProject); - } - } - } catch (CoreException ce) - { - //Leaving the catch block empty. This method will return null if there - //were any blow-ups in the facet API being called. - } - } - - return facetVersions; - - } - - /** - * Returns the facet runtime the given project is bound to. - * @param projectName name of an existing project - * @return {@link IRuntime} the project is bound to. Returns null - * <ul> - * <li>if the project is not bound to a facet runtime</li> - * <li>if the project does not exist</li> - * <li>if the project is null</li> - * </ul> - */ - public static IRuntime getFacetRuntimeForProject(String projectName) - { - IProject project = ProjectUtilities.getProject(projectName); - if (project!=null && project.exists()) - { - try - { - IFacetedProject fproject = ProjectFacetsManager.create(project); - if (fproject != null) - { - return fproject.getRuntime(); - } - } catch (CoreException ce) - { - //Leaving the catch block empty. This method will return null if there - //were any blow-ups in the facet API being called. - } - } - - return null; - } - - - /** - * Returns a set of combinations of facet versions derived from the facet versions - * in the provided arrayOfProjectFacetVersionArrays. For example, if - * arrayOfProjectFacetVersionArrays is a two dimenstional array of facet versions that has - * a structure like this:<br/> - * {{FacetA_version1, FacetA_version2},<br/> - * {FacetB_version1},<br/> - * {FacetC_version1, FacetC_version2}}<br/> - * the following array of Sets will be returned:<br/> - * {Set1, Set2, Set3, Set4}, where<br/> - * Set1 = [FacetA_version1, FacetB_version1, FacetC_version1]<br/> - * Set2 = [FacetA_version2, FacetB_version1, FacetC_version1]<br/> - * Set3 = [FacetA_version1, FacetB_version1, FacetC_version2]<br/> - * Set4 = [FacetA_version2, FacetB_version1, FacetC_version2]<br/> - * <br/> - * @param arrayOfProjectFacetVersionArrays a two dimensional array containing elements - * of type {@link IProjectFacetVersion} - * @param returnValidOnly false if all combinations of facet versions are to be returned. - * true if only valid combinations of facet versions are to be returned. - * @return Set[] an array of Sets, where each Set contains elements of type {@link IProjectFacetVersion}. - */ - public static Set[] getFacetCombinations(IProjectFacetVersion[][] arrayOfProjectFacetVersionArrays, boolean returnValidOnly) - { - ArrayList allCombinations = new ArrayList(); - //maxCount contains the number of versions in each array of IProjectFacetVersions. - //initialize counter, which will be used to navigate arrayOfProjectFacetVersionArrays. - int n = arrayOfProjectFacetVersionArrays.length; - int[] maxCount = new int[n]; - int[] counter = new int[n]; - for (int i=0; i<n; i++) - { - maxCount[i] = arrayOfProjectFacetVersionArrays[i].length - 1; - counter[i] = 0; - } - - //Navigate arrayOfProjectFacetVersionArrays to create all possible combinations. - boolean done = false; - while (!done) - { - //Create a combination of size n using current values in counter. - //Add it to the list of all combinations, checking first for validity if returnValidOnly is true. - Set combination = new HashSet(); - for (int j=0; j<n; j++) - { - IProjectFacetVersion pfv = arrayOfProjectFacetVersionArrays[j][counter[j]]; - combination.add(pfv); - } - - //Check if valid. - if (returnValidOnly) - { - Set actions = getInstallActions(combination); - try { - if( ProjectFacetsManager.check( new HashSet(), actions ).getSeverity() == IStatus.OK ) - { - allCombinations.add((combination)); - } - } catch (Throwable e) { - // Do nothing if ProjectFacetsManager.check() throws exception. - // TODO This try/catch will be unneccesary once WTP bug 137551 is fixed so that an OK Status - // would not be returned when an exception is thrown. - } - } - else - { - allCombinations.add((combination)); - } - - //Update the counters. - for (int p=0; p<n; p++) - { - if ( (counter[p] + 1) <= maxCount[p]) - { - (counter[p])++; - break; - } - else - { - counter[p] = 0; - if (p == n-1) - { - done = true; - } - } - } - } - - Set[] allCombinationsArray = (Set[])allCombinations.toArray(new Set[0]); - return allCombinationsArray; - } - - /** - * Returns a set of facet versions given a template. The highest facet version of every fixed - * facet in the template is returned, with the exception of the jst.java facet, where the 1.4 - * facet version is returned. - * - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return Set containing elements of type {@link IProjectFacetVersion} - */ - public static Set getInitialFacetVersionsFromTemplate(String templateId) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId); - Set fixedFacets = template.getFixedProjectFacets(); - HashSet initial = new HashSet(); - for (Iterator itr2 = fixedFacets.iterator(); itr2.hasNext(); ) - { - IProjectFacet facet = (IProjectFacet) itr2.next(); - IProjectFacetVersion highestFacetVersion = null; - try { - if (isJavaFacet(facet)) //special case the java facet because 1.4 is a better default than 5.0 for now. - { - highestFacetVersion = facet.getVersion("1.4"); - } else { - highestFacetVersion = facet.getLatestVersion(); - } - } catch (VersionFormatException e) { - } catch (CoreException e) { - } - initial.add(highestFacetVersion); - } - - return initial; - } - - /** - * Returns the template lables corresponding to the provided templateIds. - * @param templateIds array of valid template ids. Each id must correspond to a {@link IFacetedProjectTemplate}. - * @return String[] array of template labels. - */ - public static String[] getTemplateLabels(String[] templateIds) - { - String[] labels = new String[templateIds.length]; - for (int i=0; i<templateIds.length; i++) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateIds[i]); - labels[i] = template.getLabel(); - } - return labels; - - } - - /** - * Returns the id of a template given its label. - * - * @param templateLabel label of a template - * @return template id or empty String if no {@link IFacetedProjectTemplate} with the - * given templateLabel could be found. - */ - public static String getTemplateIdByLabel(String templateLabel) - { - for( Iterator itr = ProjectFacetsManager.getTemplates().iterator(); itr.hasNext(); ) - { - final IFacetedProjectTemplate template = (IFacetedProjectTemplate) itr.next(); - if (template.getLabel().equals(templateLabel)) - { - return template.getId(); - - } - } - - return ""; - } - - /** - * Returns the label of a template given its id - * - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return template label - */ - public static String getTemplateLabelById(String templateId) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId); - return template.getLabel(); - } - - /** - * Returns a set of install actions for the provided facet version - * - * @param projectFacetVersions Set containing elements of type {@link IProjectFacetVersion} - * @return Set containing elements of type {@link Action} with the type attribute set to Type.INSTALL - * The set contains one Action for each {@link IProjectFacetVersion} in projectFacetVersions. - */ - public static Set getInstallActions(Set projectFacetVersions) - { - HashSet actions = new HashSet(); - - Iterator facets = projectFacetVersions.iterator(); - - while(facets.hasNext()) - { - IProjectFacetVersion fv = (IProjectFacetVersion)facets.next(); - Action action = new Action(Type.INSTALL, fv, null); - actions.add(action); - } - - return actions; - } - - /** - * Returns the {@link FacetMatcher} calculated when checking the required facet versions - * against the facet versions. - * - * @param requiredFacetVersions array of required facet versions - * @param projectFacetVersions facet versions to check against. Set containing elements of type - * {@link IProjectFacetVersion} - * @return FacetMatcher with the following characteristics: - * <ul> - * <li><b>isMatch</b>: returns true if the required facet versions already exist in the facet versions - * or can be added to the facet versions. isMatch will return false otherwise.</li> - * <li><b>getFacetsTested</b>: returns the same set of facet versions as the input parameter, projectFacetVersions</li> - * <li><b>getFacetsThatMatched</b>: if isMatch returns false, getFacetsThatMatched returns null. If isMatch returns true, - * getFacetsThatMatched returns the subset of facet versions in the input parameter, projectFacetVersions, - * that matched one of the required facet versions. This may be an empty set.</li> - * <li><b>getFacetsToAdd</b>: if isMatch returns false, getFacetsToAdd returns null. If isMatch returns true, - * getFacetsToAdd returns the subset of facet versions that would need to be added to the facet versions in - * projectFacetVersions in order to satisfy the requirements of the required facet versions. This may be - * an empty set.</li> - * </ul> - */ - public static FacetMatcher match(RequiredFacetVersion[] requiredFacetVersions, Set projectFacetVersions) - { - FacetMatcher fm = new FacetMatcher(); - fm.setFacetsTested(projectFacetVersions); - HashSet facetsToAdd = new HashSet(); - HashSet requiredFacetVersionsToAdd = new HashSet(); - HashSet facetsThatMatched = new HashSet(); - for (int i=0; i<requiredFacetVersions.length; i++) - { - RequiredFacetVersion rfv = requiredFacetVersions[i]; - IProjectFacetVersion rpfv = rfv.getProjectFacetVersion(); - String rid = rpfv.getProjectFacet().getId(); - String rv = rpfv.getVersionString(); - boolean facetPresent = false; - - //Is the project facet present? or a later version of applicable. - Iterator itr = projectFacetVersions.iterator(); - while(itr.hasNext()) - { - IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next(); - String id = pfv.getProjectFacet().getId(); - String version = pfv.getVersionString(); - if (rid.equals(id)) - { - if (rv.equals(version)) - { - //found an exact match - facetPresent = true; - facetsThatMatched.add(pfv); - } - else - { - if (rfv.getAllowNewer()) - { - if (greaterThan(version, rv)) - { - //found a match - facetPresent = true; - facetsThatMatched.add(pfv); - } - } - } - //No need to keep iterating since we hit a facet with the same id; - break; - } - } - - //if not present, put it in the list to check if it can be added. - if (!facetPresent) - { - facetsToAdd.add(rpfv); - requiredFacetVersionsToAdd.add(rfv); - } - - } - - //Check if the facetsToAdd can be added - if (requiredFacetVersionsToAdd.size() > 0) - { - //Test all possible combinations of the facets that need to be added - //Create an array of arrays. Each element of the array will contain the array - //of the permitted IProjectFacetVersions for each required facet. - boolean facetsCanBeAdded = false; - Iterator itr = requiredFacetVersionsToAdd.iterator(); - ArrayList projectFacetVersionArrays = new ArrayList(); - - while (itr.hasNext()) - { - RequiredFacetVersion reqFacetVersion = (RequiredFacetVersion) itr.next(); - IProjectFacetVersion[] versions = reqFacetVersion.getAllowedProjectFacetVersions(); - if (versions != null && versions.length > 0) - { - //Add the array of versions to the list of arrays. - projectFacetVersionArrays.add(versions); - } - } - - IProjectFacetVersion[][] arrayOfProjectFacetVersionArrays = (IProjectFacetVersion[][])projectFacetVersionArrays.toArray(new IProjectFacetVersion[0][0]); - Set[] combinations = getFacetCombinations(arrayOfProjectFacetVersionArrays, false); - for (int i=0; i<combinations.length; i++) - { - //Check if the set can be added. If so, this is a match. Update the facet matcher and break. - Set actions = getInstallActions(combinations[i]); - try { - if( ProjectFacetsManager.check( projectFacetVersions, actions ).getSeverity() == IStatus.OK ) - { - //Facets can be added so there is a match - facetsCanBeAdded=true; - fm.setMatch(true); - fm.setFacetsThatMatched(facetsThatMatched); - fm.setFacetsToAdd(combinations[i]); - break; - } - } catch (Throwable e) { - // Do nothing if ProjectFacetsManager.check() throws exception. - // TODO This try/catch will be unneccesary once WTP bug 137551 is fixed so that an OK Status - // would not be returned when an exception is thrown. - } - } - - - if (!facetsCanBeAdded) - { - fm.setMatch(false); - } - } - else - { - //There are no facets to add. - fm.setMatch(true); - fm.setFacetsThatMatched(facetsThatMatched); - fm.setFacetsToAdd(facetsToAdd); - } - - return fm; - } - - /** - * Adds facet versions to the provided project if required based on checking provided - * required facet versions against the facet versions already installed on project. - * - * @param project IProject which exists in the workspace - * @param rfvs array of required facet versions. - * @param monitor progress monitor - * @return IStatus with severity IStatus.ERROR - * <ul> - * <li>if the project does not exist or</li> - * <li>if the project is not open or</li> - * <li>an attempt to add facet versions to the project resulted in an error.</li> - * </ul> - * Otherwise, returns an IStatus with severity IStatus.OK - */ - public static IStatus addRequiredFacetsToProject(IProject project, RequiredFacetVersion[] rfvs, IProgressMonitor monitor) - { - IStatus status = Status.OK_STATUS; - - Set missingFacets = null; - Set facetsToAdd = new HashSet(); - try - { - IFacetedProject fProject = ProjectFacetsManager.create(project); - if (fProject != null) - { - Set projectFacetVersions = fProject.getProjectFacets(); - FacetMatcher projectFacetMatcher = FacetUtils.match(rfvs, projectFacetVersions); - if (projectFacetMatcher.isMatch()) - { - missingFacets = projectFacetMatcher.getFacetsToAdd(); - if (missingFacets.size() > 0) - { - IRuntime fRuntime = null; - fRuntime = FacetUtils.getFacetRuntimeForProject(project.getName()); - if (fRuntime != null) - { - //Add the highest version supported by the runtime the project is bound to. - Iterator missingFacetsItr = missingFacets.iterator(); - while (missingFacetsItr.hasNext()) - { - IProjectFacet facet = ((IProjectFacetVersion)missingFacetsItr.next()).getProjectFacet(); - //Get the highest level of this facet supported by the runtime. - List versions = null; - try { - versions = facet.getSortedVersions(false); - } catch (VersionFormatException e) { - Set versionSet = facet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } catch (CoreException e) { - Set versionSet = facet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } - - //Iterate over the versions in descending order and pick the - //first one that fRuntime supports. - Iterator versionsItr = versions.iterator(); - while(versionsItr.hasNext()) - { - boolean match = false; - IProjectFacetVersion pfv = (IProjectFacetVersion)versionsItr.next(); - Set pfvs = new HashSet(); - pfvs.add(pfv); - - //Check the required facets to see if this version of this facet is supported. - for (int j=0; j<rfvs.length; j++) - { - RequiredFacetVersion rfv = rfvs[j]; - IProjectFacetVersion rpfv = rfv.getProjectFacetVersion(); - if (rpfv.getProjectFacet().getId().equals(pfv.getProjectFacet().getId())) - { - if (rpfv.getVersionString().equals(pfv.getVersionString())) - { - match = true; - } - else - { - if (rfv.getAllowNewer()) - { - if (greaterThan(pfv.getVersionString(), rpfv.getVersionString())) - { - match = true; - } - } - } - } - } - - if (match) - { - //Check against Runtime - if (FacetUtils.doesRuntimeSupportFacets(fRuntime, pfvs)) - { - //We have a match. Add this one to the master set. - facetsToAdd.add(pfv); - break; - } - } - } - } - } - else - { - facetsToAdd = missingFacets; - } - - status = addFacetsToProject(fProject, facetsToAdd); - } - } - } - } catch (CoreException ce) - { - //Display an appropriate error message to the user. - //A CoreException could have been thrown for any of the following three reasons - //1. The project does not exist - //2. The project is not open - //3. There was a problem adding the facets to the project. - - if (!project.exists()) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_DOES_NOT_EXIST, new String[] { project.getName()})); - } - else if (!project.isOpen()) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_IS_NOT_OPEN, new String[] { project.getName()})); - } - else - { - status = getErrorStatusForAddingFacets(project.getName(), facetsToAdd, ce); - } - } - - return status; - } - - - /** - * Adds the provided set of facet versions to the provided faceted project - * - * @param fproject A faceted project which exists in the workspace - * @param projectFacetVersions A set containing elements of type {@link IProjectFacetVersion} - * @return An IStatus with a severity of IStatus.OK if the facet - * versions were added successfully. Otherwise, an IStatus with a severity of - * IStatus.ERROR. - */ - public static IStatus addFacetsToProject(final IFacetedProject fproject, final Set projectFacetVersions) - { - final IStatus[] status = new IStatus[1]; - status[0] = Status.OK_STATUS; - final Set actions = getInstallActions(projectFacetVersions); - - // Create a runnable that applies the install actions to the faceted project - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - try - { - fproject.modify(actions, shellMonitor); - } catch (CoreException e) - { - status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); - } - } - }; - - // Run the runnable in another thread unless there is no UI thread (Ant scenarios) - if (Display.getCurrent() != null) - { - try - { - PlatformUI.getWorkbench().getProgressService().run(true, false, runnable); - } catch (InvocationTargetException ite) - { - status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, ite); - } catch (InterruptedException ie) - { - status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, ie); - } - } - else - { - try - { - fproject.modify(actions, null); - } catch (CoreException e) - { - status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); - } - } - - return status[0]; - } - - /** - * Returns an error status indicating that the facet versions could not be - * added to the faceted project - * - * @param projectName a project name to insert in the error message in the IStatus - * @param projectFacetVersions a set containing elements of type {@link IProjectFacetVersion}. - * The facets in this set will be listed in the error message in the IStatus. - * @param t a Throwable which will be inserted in the IStatus - * @return an IStatus with severity IStatus.ERROR - */ - private static IStatus getErrorStatusForAddingFacets(String projectName, Set projectFacetVersions, Throwable t) - { - IStatus status = Status.OK_STATUS; - int size = projectFacetVersions.size(); - if (size > 0) - { - Set facets = new HashSet(); - //Iterate over projectFacetVersions to form a set of IProjectFacets - Iterator itr = projectFacetVersions.iterator(); - while (itr.hasNext()) - { - IProjectFacetVersion projectFacet = (IProjectFacetVersion)itr.next(); - IProjectFacet facet = projectFacet.getProjectFacet(); - facets.add(facet); - } - String facetList = getFacetListMessageString(facets); - status = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_ADDING_FACETS_TO_PROJECT, new String[] { projectName, facetList}), t); - } - - return status; - } - - /** - * Creates a new faceted project with the provided name - * - * @param projectName A String containing the name of the project to be created - * @return An IStatus with a severity of IStatus.OK if the faceted project - * was created successfully or if a project of the provided name already - * exists in the workspace. Otherwise, an IStatus with severity of - * IStatus.ERROR. - */ - public static IStatus createNewFacetedProject(final String projectName) - { - final IStatus[] status = new IStatus[1]; - status[0] = Status.OK_STATUS; - IProject project = ProjectUtilities.getProject(projectName); - if (!project.exists()) - { - // Create a runnable that creates a new faceted project. - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - try - { - IFacetedProject fProject = ProjectFacetsManager.create(projectName, null, shellMonitor); - if (fProject == null) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName })); - } - } catch (CoreException e) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), e); - } - } - }; - - // Run the runnable in another thread unless there is no UI thread (Ant scenarios) - try - { - if (Display.getCurrent() != null) - { - PlatformUI.getWorkbench().getProgressService().run(true, false, runnable); - } - else - { - try - { - IFacetedProject fProject = ProjectFacetsManager.create(projectName, null, null); - if (fProject == null) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName })); - } - } catch (CoreException e) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), e); - } - } - } catch (InvocationTargetException ite) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), ite); - } catch (InterruptedException ie) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_PROJECT_CREATION, new String[] { projectName }), ie); - } - } - - return status[0]; - } - - /** - * Sets the provided set of facets as fixed on the faceted project - * - * @param fProject A faceted project which exists in the workspace - * @param fixedFacets A set containing elements of type {@link IProjectFacet} - * @return An IStatus with a severity of IStatus.OK if the facets - * were successfully set as fixed facets on the faceted project. - * Otherwise, an IStatus with a severity of IStatus.ERROR. - * - * @see IFacetedProject#setFixedProjectFacets - */ - public static IStatus setFixedFacetsOnProject(final IFacetedProject fProject, final Set fixedFacets) - { - final IStatus[] status = new IStatus[1]; - status[0] = Status.OK_STATUS; - - //Create a runnable that sets the fixed facets on the faceted project - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - try - { - fProject.setFixedProjectFacets(fixedFacets); - } catch (CoreException e) - { - status[0] = getErrorStatusForSettingFixedFacets(fProject.getProject().getName(), fixedFacets, e); - } - } - }; - - // Run the runnable in another thread unless there is no UI thread (Ant scenarios) - if (Display.getCurrent() != null) - { - try - { - PlatformUI.getWorkbench().getProgressService().run(true, false, runnable); - } catch (InvocationTargetException ite) - { - status[0] = getErrorStatusForSettingFixedFacets(fProject.getProject().getName(), fixedFacets, ite); - } catch (InterruptedException ie) - { - status[0] = getErrorStatusForSettingFixedFacets(fProject.getProject().getName(), fixedFacets, ie); - } - } - else - { - try - { - fProject.setFixedProjectFacets(fixedFacets); - } catch (CoreException e) - { - status[0] = getErrorStatusForSettingFixedFacets(fProject.getProject().getName(), fixedFacets, e); - } - } - - return status[0]; - } - - /** - * Returns an error status indicating that the facets could not be - * set as fixed facets on the faceted project - * - * @param projectName a project name to insert in the error message in the IStatus - * @param facets a set containing elements of type {@link IProjectFacet}. - * The facets in this set will be listed in the error message in the IStatus. - * @param t a Throwable which will be inserted in the IStatus - * @return an IStatus with severity IStatus.ERROR - */ - private static IStatus getErrorStatusForSettingFixedFacets(String projectName, Set facets, Throwable t) - { - IStatus status = Status.OK_STATUS; - int size = facets.size(); - if (size > 0) - { - String facetList = getFacetListMessageString(facets); - status = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_FIXED_FACETS, new String[] { projectName, facetList}), t); - } - - return status; - } - - - /** - * Binds the faceted project to the facet runtime - * - * @param fProject A faceted project which exists in the workspace - * @param fRuntime A facet runtime - * @return An IStatus with a severity of IStatus.OK if the faceted project - * was bound to the facet runtime successfully. Otherwise, an IStatus with severity of - * IStatus.ERROR. - */ - public static IStatus setFacetRuntimeOnProject(final IFacetedProject fProject, final IRuntime fRuntime) - { - final IStatus[] status = new IStatus[1]; - status[0] = Status.OK_STATUS; - - //Create a runnable that sets the facet runtime on the faceted project - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - try - { - fProject.setRuntime(fRuntime, shellMonitor); - } catch (CoreException e) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_SETTING_RUNTIME, new String[] { fProject.getProject().getName(), fRuntime.getName() }), e); - } - } - }; - - // Run the runnable in another thread unless there is no UI thread (Ant scenarios) - if (Display.getCurrent() != null) - { - try - { - PlatformUI.getWorkbench().getProgressService().run(true, false, runnable); - } catch (InvocationTargetException ite) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_SETTING_RUNTIME, new String[] { fProject.getProject().getName(), fRuntime.getName() }), ite); - } catch (InterruptedException ie) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_SETTING_RUNTIME, new String[] { fProject.getProject().getName(), fRuntime.getName() }), ie); - } - } - else - { - try - { - fProject.setRuntime(fRuntime, null); //jvh - happens here... - } catch (CoreException e) - { - status[0] = StatusUtils.errorStatus(NLS.bind(ConsumptionMessages.MSG_ERROR_SETTING_RUNTIME, new String[] { fProject.getProject().getName(), fRuntime.getName() }), e); - } - } - - - return status[0]; - } - - /** - * Returns a translatable delimited list of facet labels derived from the provided - * set of facets - * - * @param facets a set containing elements of type {@link IProjectFacet} - * @return String a delimited list of facet labels - */ - private static String getFacetListMessageString(Set facets) - { - String facetListMessage = ""; - int size = facets.size(); - if (size > 0) - { - Iterator itr = facets.iterator(); - IProjectFacet firstProjectFacet = (IProjectFacet)itr.next(); - facetListMessage = firstProjectFacet.getLabel(); - - //Continue appending to facetListMessage until all the facet labels - //are in the list. - while (itr.hasNext()) - { - IProjectFacet projectFacet = (IProjectFacet)itr.next(); - String pfLabel = projectFacet.getLabel(); - facetListMessage = NLS.bind(ConsumptionMessages.MSG_FACETS, new String[] {facetListMessage, pfLabel}); - } - } - - return facetListMessage; - } - - - /** - * Returns the set of facet versions which can be inferred from the provided Java project - * - * @param javaProject a Java project that exists in the workspace. Must not be null. - * @return Set containing elements of type {@link IProjectFacetVersion} - */ - public static Set getFacetsForJavaProject(IJavaProject javaProject) - { - Set facets = new HashSet(); - String jdkComplianceLevel = null; - if (javaProject!=null) - { - jdkComplianceLevel = javaProject.getOption("org.eclipse.jdt.core.compiler.compliance", false); - if (jdkComplianceLevel == null) - { - jdkComplianceLevel = (String)JavaCore.getDefaultOptions().get("org.eclipse.jdt.core.compiler.compliance"); - if (jdkComplianceLevel == null) - { - jdkComplianceLevel = "1.4"; - } - } - } - - IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_JAVA); - IProjectFacetVersion javaFacetVersion = null; - if (jdkComplianceLevel.equals("1.3")) - { - javaFacetVersion = javaFacet.getVersion("1.3"); - } - else if (jdkComplianceLevel.equals("1.4")) - { - javaFacetVersion = javaFacet.getVersion("1.4"); - } - else if (jdkComplianceLevel.equals("1.5")) - { - javaFacetVersion = javaFacet.getVersion("5.0"); - } - else - { - javaFacetVersion = javaFacet.getVersion("1.4"); - } - - facets.add(javaFacetVersion); - IProjectFacet utilityFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_UTILITY_MODULE); - IProjectFacetVersion utilityFacetVersion = null; - try - { - utilityFacetVersion = utilityFacet.getLatestVersion(); - } - catch (CoreException ce) - { - - } - if (utilityFacetVersion != null) - { - facets.add(utilityFacetVersion); - } - return facets; - } - - - //Methods related to facet runtimes. - - /** - * Returns a set of facet runtimes that support the given - * required facet versions. - * @param requiredFacetVersions an array containing elements of type {@link RequiredFacetVersion} - * @return Set set of facet runtimes that support the given required facet versions. - * (element type: {@link IRuntime}) - */ - public static Set getRuntimes(RequiredFacetVersion[] requiredFacetVersions) - { - //Form the sets of IProjectFacetVersions these RequiredFacetVersions represent. - ArrayList listOfFacetSets = new ArrayList(); - - HashSet facets = new HashSet(); - int javaFacetIndex = -1; - for (int i=0; i<requiredFacetVersions.length; i++) - { - IProjectFacetVersion pfv = requiredFacetVersions[i].getProjectFacetVersion(); - if (FacetUtils.isJavaFacet(pfv.getProjectFacet())) - { - //Remember the index - javaFacetIndex = i; - } - facets.add(requiredFacetVersions[i].getProjectFacetVersion()); - } - - listOfFacetSets.add(facets); - - //If the java facet was one of the facets in the set, and new versions of java are allowed, - //create sets that contain the newer permitted versions of the java facets. - if (javaFacetIndex > -1) - { - ArrayList permittedJavaVersions = new ArrayList(); - RequiredFacetVersion rfv = requiredFacetVersions[javaFacetIndex]; - if (rfv.getAllowNewer()) - { - String version = rfv.getProjectFacetVersion().getVersionString(); - Set allVersions = rfv.getProjectFacetVersion().getProjectFacet().getVersions(); - Iterator itr = allVersions.iterator(); - while (itr.hasNext()) - { - IProjectFacetVersion thisPfv = (IProjectFacetVersion)itr.next(); - String thisVersion = thisPfv.getVersionString(); - if (greaterThan(thisVersion, version)) - { - permittedJavaVersions.add(thisVersion); - } - } - - String[] javaVersions = (String[])permittedJavaVersions.toArray(new String[0]); - - for (int j=0; j<javaVersions.length; j++) - { - HashSet thisFacetSet = new HashSet(); - - for (int k=0; k<requiredFacetVersions.length; k++) - { - if (k==javaFacetIndex) - { - IProjectFacetVersion pfv = requiredFacetVersions[k].getProjectFacetVersion().getProjectFacet().getVersion(javaVersions[j]); - thisFacetSet.add(pfv); - } - else - { - IProjectFacetVersion pfv = requiredFacetVersions[k].getProjectFacetVersion(); - thisFacetSet.add(pfv); - } - } - - listOfFacetSets.add(thisFacetSet); - } - } - } - - //Return the union of runtimes for all the facetSets. - return getRuntimes((Set[])listOfFacetSets.toArray(new Set[0])); - - } - - /** - * Returns whether or not the provided facet runtime supports the provided - * required facet versions. - * - * @param requiredFacetVersions an array containing elements of type {@link RequiredFacetVersion} - * @param fRuntimeName name of a {@link IRuntime} - * @return boolean <code>true</code> if the facet runtime supports the required facet versions. - * Returns <code>false</code> otherwise. - */ - public static boolean isFacetRuntimeSupported(RequiredFacetVersion[] requiredFacetVersions, String fRuntimeName) - { - Set fRuntimes = getRuntimes(requiredFacetVersions); - Iterator itr = fRuntimes.iterator(); - while (itr.hasNext()) - { - IRuntime runtime = (IRuntime)itr.next(); - if (runtime.getName().equals(fRuntimeName)) - { - return true; - } - } - - return false; - } - - /** - * Returns the union of facet runtimes that support the provided sets of facet versions. - * - * @param facetSets array of Sets, where each Set contains elements of type {@link IProjectFacetVersion}. - * @return Set containing elements of type {@link IRuntime} - */ - public static Set getRuntimes(Set[] facetSets) - { - HashSet unionSet = new HashSet(); - for (int i=0; i<facetSets.length; i++) - { - Set facets = facetSets[i]; - Set runtimes = RuntimeManager.getRuntimes(facets); - Iterator itr = runtimes.iterator(); - while (itr.hasNext()) - { - IRuntime runtime = (IRuntime)itr.next(); - if (!unionSet.contains(runtime)) - { - unionSet.add(runtime); - } - } - } - return unionSet; - } - - /** - * Returns whether or not the provided facet runtime supports the provided set of facet versions. - * - * @param facetRuntime a facet runtime - * @param projectFacetVersions set containing elements of type {@link IProjectFacetVersion} - * @return boolean <code>true</code> if the facet runtime supports the provided set of facet versions. - * Returns <code>false</code> otherwise. - */ - public static boolean doesRuntimeSupportFacets(IRuntime facetRuntime, Set projectFacetVersions) - { - Set runtimes = RuntimeManager.getRuntimes(projectFacetVersions); - Iterator itr = runtimes.iterator(); - while (itr.hasNext()) - { - IRuntime runtime = (IRuntime)itr.next(); - if (runtime.getName().equals(facetRuntime.getName())) - { - return true; - } - } - - return false; - } - - /** - * Returns whether versionA is greater than versionB - * - * @param versionA version number of the form 1.2.3 - * @param versionA version number of the form 1.2.3 - * @return boolean <code>true</code> if versionA is greater than versionB, <code>false</code> otherwise. - */ - public static boolean greaterThan(String versionA, String versionB) - { - StringTokenizer stA = new StringTokenizer(versionA, "."); - StringTokenizer stB = new StringTokenizer(versionB, "."); - - int sizeA = stA.countTokens(); - int sizeB = stB.countTokens(); - - int size; - if (sizeA < sizeB) - { - size = sizeA; - } - else - size = sizeB; - - for (int i=0; i<size; i++) - { - int a = Integer.parseInt(stA.nextToken()); - int b = Integer.parseInt(stB.nextToken()); - if (a!=b) - { - return a > b; - } - } - - return sizeA > sizeB; - } - - /** - * Returns whether the provided facet has an id of "jst.java" - * @param pf facet - * @return <code>true</code> if facet has an id of "jst.java", <code>false</code> otherwise. - */ - public static boolean isJavaFacet(IProjectFacet pf) - { - if (pf.getId().equals("jst.java")) - return true; - else - return false; - } - - /** - * Returns whether or not the provided project is a faceted Java utility project or a non-faceted Java project. - * - * @param project an IProject - * @return boolean <code>true</code> if the provided project is a faceted Java utility project - * or a non-faceted Java project, <code>false</code> otherwise. - */ - public static boolean isJavaProject(IProject project) - { - //Check if it's a faceted project - try - { - IFacetedProject fProject = ProjectFacetsManager.create(project); - if (fProject != null) - { - //Return true if it's a utility project - if (J2EEUtils.isJavaComponent(project)) - { - return true; - } - else - { - //See if the java facet is the only one it has. - Set facets = fProject.getProjectFacets(); - if (facets.size()==1) - { - IProjectFacetVersion pfv = (IProjectFacetVersion)facets.iterator().next(); - if (isJavaFacet(pfv.getProjectFacet())) - { - return true; - } - } - } - } - else - { - if (ResourceUtils.isJavaProject(project)) - { - return true; - } - } - } catch (CoreException ce) - { - - } - - return false; - } - - /** - * Returns whether or not the provided template id is equal to "template.jst.utility" - * - * @param templateId template id - * @return boolean <code>true</code> if the provided template id is equal to "template.jst.utility", - * <code>false</code> otherwise. - */ - public static boolean isUtilityTemplate(String templateId) - { - if (ProjectFacetsManager.isTemplateDefined(templateId)) - { - if (templateId.equals("template.jst.utility")) - { - return true; - } - } - - return false; - } - -} 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 e78fcf032..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/FolderResourceFilter.java +++ /dev/null @@ -1,92 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.osgi.util.NLS; - - -/** -* This is a kind of 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 -{ - - /** - * 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 ConsumptionMessages.FOLDER_FILTER_NAME; - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return ConsumptionMessages.FOLDER_FILTER_DESC; - } - - public IStatus statusOf ( Object object ) - { - if (object == null) - { - return new Status( - IStatus.ERROR, - WebServiceConsumptionPlugin.ID, - 0, - ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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 a15eb540a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/JavaResourceFilter.java +++ /dev/null @@ -1,167 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.osgi.util.NLS; - - -/** -* This is a kind of 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 -{ - - /** - * 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 ConsumptionMessages.JAVA_FILTER_NAME; - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return ConsumptionMessages.JAVA_FILTER_DESC; - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * @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, - ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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 e8da47621..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); - 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 bf7f4f058..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/PropertiesResourceFilter.java +++ /dev/null @@ -1,122 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.osgi.util.NLS; - - -/** -* This is a kind of 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 -{ - - /** - * 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 ConsumptionMessages.PROPERTIES_FILTER_NAME; - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return ConsumptionMessages.PROPERTIES_FILTER_DESC; - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * @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, - ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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/RequiredFacetVersion.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/RequiredFacetVersion.java deleted file mode 100644 index 4a501df52..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/RequiredFacetVersion.java +++ /dev/null @@ -1,74 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.common; - - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class RequiredFacetVersion -{ - private IProjectFacetVersion projectFacetVersion; - private boolean allowNewer; - private IProjectFacetVersion[] allowedProjectFacetVersions; - - public boolean getAllowNewer() - { - return allowNewer; - } - public void setAllowNewer(boolean allowNewer) - { - this.allowNewer = allowNewer; - } - public IProjectFacetVersion getProjectFacetVersion() - { - return projectFacetVersion; - } - public void setProjectFacetVersion(IProjectFacetVersion projectFacetVersion) - { - this.projectFacetVersion = projectFacetVersion; - } - public IProjectFacetVersion[] getAllowedProjectFacetVersions() - { - if (allowedProjectFacetVersions == null) - { - ArrayList versions = new ArrayList(); - IProjectFacetVersion minpfv = getProjectFacetVersion(); - versions.add(minpfv); - //If allow-newer is true, add all the versions greater than the min version. - if (getAllowNewer()) - { - String minVersion = minpfv.getVersionString(); - Iterator allVersionsItr = minpfv.getProjectFacet().getVersions().iterator(); - while (allVersionsItr.hasNext()) - { - IProjectFacetVersion testpfv = (IProjectFacetVersion)allVersionsItr.next(); - String testVersion = testpfv.getVersionString(); - if (FacetUtils.greaterThan(testVersion, minVersion)) - { - versions.add(testpfv); - } - } - } - - allowedProjectFacetVersions = (IProjectFacetVersion[])versions.toArray(new IProjectFacetVersion[0]); - } - - return allowedProjectFacetVersions; - } - -} 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 880819506..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WSDLResourceFilter.java +++ /dev/null @@ -1,117 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.osgi.util.NLS; - - -/** -* This is a kind of 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 -{ - /** - * 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 ConsumptionMessages.WSDL_FILTER_NAME; - } - - /** - * Returns the locale-specific description of this filter. - * @return The locale-specific description of this filter. - */ - public String getDescription () - { - return ConsumptionMessages.WSDL_FILTER_DESC; - } - - /** - * Returns an {@link org.eclipse.core.runtime.IStatus} - * describing the <code>Filter</code>'s assessment of - * the given <code>object</code>. - * @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, - ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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, - NLS.bind(ConsumptionMessages.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 59b3831ce..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/common/WebServiceStartServerRegistry.java +++ /dev/null @@ -1,100 +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.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.ILog; - - - -/** -* 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) - { - ILog log = EnvironmentService.getEclipseLog(); - log.log(ILog.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 c3cc514bb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/AttributeElement.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.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 3b842ab76..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/BeanElement.java +++ /dev/null @@ -1,147 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060612 145433 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ - -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"; - public static int READONLY = 0; - public static int WRITEONLY = 1; - public static int READWRITE = 2; - private int attrib = 2; - - - /** - * 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; - attribFunction(attributeElement); - } - - private void attribFunction(AttributeElement attributeElement){ - if(attributeElement.getGetterMethod() != null && attributeElement.getSetterMethod() != null) attrib = READWRITE; - else if(attributeElement.getGetterMethod() == null && attributeElement.getSetterMethod() != null) attrib = WRITEONLY; - else if(attributeElement.getGetterMethod() != null && attributeElement.getSetterMethod() == null) attrib = READONLY; - } - - /** - * 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 int getAttrib() - { - return attrib; - } - - public void setAttrib(int attrib) - { - this.attrib = attrib; - } - - 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 eceb2eb6e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/FieldElement.java +++ /dev/null @@ -1,92 +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 52e8d6032..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/MethodElement.java +++ /dev/null @@ -1,129 +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/ObjectType.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ObjectType.java deleted file mode 100644 index 37e8bd726..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ObjectType.java +++ /dev/null @@ -1,63 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060823 145643 mahutch@ca.ibm.com - Mark Hutchinson (created class) - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel; - - -/** -* objects of this class represent a type -* -*/ -public class ObjectType extends SimpleType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - /** - *Constructor - * - */ - public ObjectType() - { - super(TypeFactory.OBJECT_NAME); - } - - /** - * StringToType gets the string taken by the - * user into proxy form - * @return String convert the string to type . - */ - public String StringToType(String name) - { - //We can't deserialize a String to an Object - //this should never actually be called since - //methods with Objects as input are omitted. - return "new java.lang.Object();"; - } - - /** - * 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/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 36f08a8b8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/ParameterElement.java +++ /dev/null @@ -1,83 +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 f1592f6aa..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeElement.java +++ /dev/null @@ -1,192 +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 7bed616cb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/beanmodel/TypeFactory.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060726 145676 gilberta@ca.ibm.com - Gilbert Andrews - * 20060823 145643 mahutch@ca.ibm.com - Mark Hutchinson - *******************************************************************************/ - -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 OBJECT_NAME = "java.lang.Object"; - 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(OBJECT_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 - //java.lang.Objects are ok for return types but not for input type - if (javaHelpers.isArray()|| - javaHelpers.getJavaName().equals(MAP_NAME)|| - javaHelpers.getJavaName().equals(VECTOR_NAME)|| - javaHelpers.getJavaName().equals(DATA_HANDLER)|| - javaHelpers.getJavaName().equals(OBJECT_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 String DATA_HANDLER = "javax.activation.DataHandler"; - - public static boolean isRecognizedReturnType(JavaHelpers javaHelpers) - { - //arrays - //Hashtable - //Vectors - //java.lang.Objects are ok for return types - 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 if (javaHelpers.getJavaName().equals(OBJECT_NAME))return true; - else return false; - } - - public static boolean isRecognizedReturnType(String type) - { - //arrays - //Hashtable - //Vectors - //java.lang.Objects are ok for return types - 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 if (type.equals(OBJECT_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(); - else if (type.equals(OBJECT_NAME)) datatype = new ObjectType(); - - // 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 e7ca18741..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/BindingElement.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; - - -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 723975828..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/DefinitionElement.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.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 f0d010cbc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/MessageElement.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.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 2f501e067..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/OperationElement.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.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 d80ffbb39..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PartElement.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.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 78e2ac4af..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortElement.java +++ /dev/null @@ -1,44 +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 08f6883f8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/PortTypeElement.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.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 3302d8968..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/ServiceElement.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.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 a9e89d3bc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/datamodel/wsdlmodel/WSDLElement.java +++ /dev/null @@ -1,53 +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 3d4062a67..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/plugin/WebServiceConsumptionPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060424 115690 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.plugin; - -import org.eclipse.core.runtime.Plugin; - -/** -* 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 -{ - /** - * 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_; - } - -} 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 391fa5e72..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileAttributeGenerator.java +++ /dev/null @@ -1,76 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060612 145433 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -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.getSetterMethod() == null) return Status.OK_STATUS; - 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 af2d94e63..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/InputFileTypeGenerator.java +++ /dev/null @@ -1,300 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060612 145433 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -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; - private boolean fWrite = true; - - /** - * 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; - if (bean.getAttrib() == BeanElement.READONLY) fWrite = false; - } - - - - //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 - if(fWrite){ - 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("")){ - if(fWrite){ - 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 cf8e564f3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileAttributeGenerator.java +++ /dev/null @@ -1,92 +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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060612 145433 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ - -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; - if(attributeElementType.getSetterMethod() == null) return Status.OK_STATUS; - 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(); - 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 0427721f0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/codegen/ResultFileGenerator.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060523 142296 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -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\"%>"+ StringUtils.NEWLINE); - fbuffer.append("<% request.setCharacterEncoding(\"UTF-8\"); %>"+ StringUtils.NEWLINE); - 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 d456f896e..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.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - -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 ) -{ - IEnvironment 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 b40810432..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/sampleapp/command/JavaToModelCommand.java +++ /dev/null @@ -1,227 +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.ConsumptionMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 AbstractDataModelOperation -{ - - private String clientProject; - private BooleanSelection[] methods; - private String proxyBean; - private JavaClass javaClass; - private Model model; - private Element parentElement; - - public JavaToModelCommand () - { - } - - - private IStatus createJavaReflection(IEnvironment 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 (IEnvironment env) throws CoreException - { - - Choice OKChoice = new Choice('O', ConsumptionMessages.LABEL_OK, ConsumptionMessages.DESCRIPTION_OK); - Choice CancelChoice = new Choice('C', ConsumptionMessages.LABEL_CANCEL, ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.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( ConsumptionMessages.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 ) - { - IEnvironment 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 97b207ecd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/LiveWSDLFilter.java +++ /dev/null @@ -1,99 +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 e93561e25..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/wsfinder/WSFinderRegistry.java +++ /dev/null @@ -1,86 +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; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/DomElementHelper.java b/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/DomElementHelper.java deleted file mode 100644 index 5123e55e2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/DomElementHelper.java +++ /dev/null @@ -1,137 +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.util; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class DomElementHelper { - - - public static org.w3c.dom.Element createDomElementFromXMLString(java.lang.String xmlString ) - { - java.io.StringReader stringReader = new java.io.StringReader(xmlString); - org.xml.sax.InputSource inputSource = new org.xml.sax.InputSource(stringReader); - try - { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - Document document = docBuilder.parse(inputSource); - return document.getDocumentElement(); - } - catch (Throwable t) - { - return null; - } - } - - public static java.lang.String domWriter(org.w3c.dom.Node node,java.lang.StringBuffer buffer) - { - if ( node == null ) { - return ""; - } - int type = node.getNodeType(); - switch ( type ) { - case org.w3c.dom.Node.DOCUMENT_NODE: { - buffer.append(JspUtils.markup("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") + "<br>"); - domWriter(((org.w3c.dom.Document)node).getDocumentElement(),buffer); - break; - } - case org.w3c.dom.Node.ELEMENT_NODE: { - buffer.append(JspUtils.markup("<" + node.getNodeName())); - org.w3c.dom.Attr attrs[] = sortAttributes(node.getAttributes()); - for ( int i = 0; i < attrs.length; i++ ) { - org.w3c.dom.Attr attr = attrs[i]; - buffer.append(" " + attr.getNodeName() + "=\"" + JspUtils.markup(attr.getNodeValue()) + "\""); - } - buffer.append(JspUtils.markup(">")); - org.w3c.dom.NodeList children = node.getChildNodes(); - if ( children != null ) { - int len = children.getLength(); - for ( int i = 0; i < len; i++ ) { - if(((org.w3c.dom.Node)children.item(i)).getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) - buffer.append("<br>"); - domWriter(children.item(i),buffer); - } - } - buffer.append(JspUtils.markup("</" + node.getNodeName() + ">")); - break; - } - case org.w3c.dom.Node.ENTITY_REFERENCE_NODE: { - org.w3c.dom.NodeList children = node.getChildNodes(); - if ( children != null ) { - int len = children.getLength(); - for ( int i = 0; i < len; i++ ) - { - buffer.append(children.item(i)); - } - } - break; - } - case org.w3c.dom.Node.CDATA_SECTION_NODE: { - buffer.append(JspUtils.markup(node.getNodeValue())); - break; - } - case org.w3c.dom.Node.TEXT_NODE:{ - buffer.append(JspUtils.markup(node.getNodeValue())); - break; - } - case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:{ - buffer.append(JspUtils.markup("<?")); - buffer.append(node.getNodeName()); - String data = node.getNodeValue(); - if ( data != null && data.length() > 0 ){ - buffer.append(" "); - buffer.append(data); - } - buffer.append(JspUtils.markup("?>")); - break; - } - } - return buffer.toString(); - } - - public static org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs) - { - int len = (attrs != null) ? attrs.getLength() : 0; - org.w3c.dom.Attr array[] = new org.w3c.dom.Attr[len]; - for ( int i = 0; i < len; i++ ){ - array[i] = (org.w3c.dom.Attr)attrs.item(i); - } - for ( int i = 0; i < len - 1; i++ ) { - String name = array[i].getNodeName(); - int index = i; - for ( int j = i + 1; j < len; j++ ) { - String curName = array[j].getNodeName(); - if ( curName.compareTo(name) < 0 ) { - name = curName; - index = j; - } - } - if ( index != i ) { - org.w3c.dom.Attr temp = array[i]; - array[i] = array[index]; - array[index] = temp; - } - } - return (array); - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/JspUtils.java b/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/JspUtils.java deleted file mode 100644 index abb9013e9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/JspUtils.java +++ /dev/null @@ -1,50 +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.util; - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class JspUtils { - public static String markup(String text) { - if (text == null) { - return null; - } - - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - switch (c) { - case '<': - buffer.append("<"); - break; - case '&': - buffer.append("&"); - break; - case '>': - buffer.append(">"); - break; - case '"': - buffer.append("""); - break; - default: - buffer.append(c); - break; - } - } - return buffer.toString(); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementHelper.java b/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementHelper.java deleted file mode 100644 index 18030062b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementHelper.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005,2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 123963 andyzhai@ca.ibm.com - Andy Zhai - *******************************************************************************/ -package org.eclipse.jst.ws.util; - -import java.io.IOException; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.xml.sax.SAXException; - -/** - * @author gilberta - */ -public class SoapElementHelper -{ - public static javax.xml.soap.SOAPElement createSOAPElementFromXMLString(String xmlString) throws ParserConfigurationException, IOException, SAXException - { - java.io.StringReader stringReader = new java.io.StringReader(xmlString); - org.xml.sax.InputSource inputSource = new org.xml.sax.InputSource(stringReader); - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - SAXParser parser = factory.newSAXParser(); - SoapElementSaxHandler handler = new SoapElementSaxHandler(); - parser.parse(inputSource,handler); - return handler.getSOAPElement(); - } - - public static java.lang.String soapElementWriter(javax.xml.soap.SOAPElement node,java.lang.StringBuffer buffer) - { - if (node == null ) { - return ""; - } - - buffer.append(JspUtils.markup("<" + node.getElementName().getLocalName())); - java.util.Iterator attrs = node.getAllAttributes(); - while(attrs.hasNext()) { - javax.xml.soap.Name attr = (javax.xml.soap.Name)attrs.next(); - buffer.append(" " + attr.getQualifiedName() + "=\"" + JspUtils.markup(node.getAttributeValue(attr)) + "\""); - } - buffer.append(JspUtils.markup(">")); - java.util.Iterator children = node.getChildElements(); - if ( children != null ) { - while(children.hasNext()){ - javax.xml.soap.Node childNode = (javax.xml.soap.Node)children.next(); - if(childNode instanceof javax.xml.soap.SOAPElement){ - buffer.append("<br>"); - soapElementWriter((javax.xml.soap.SOAPElement)childNode,buffer); - } - else - buffer.append(JspUtils.markup(((javax.xml.soap.Text)childNode).getValue())); - } - buffer.append(JspUtils.markup("</" + node.getElementName().getLocalName() + ">")); - } - return buffer.toString(); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementRuntimeException.java b/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementRuntimeException.java deleted file mode 100644 index 2335ef522..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementRuntimeException.java +++ /dev/null @@ -1,33 +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.util; - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class SoapElementRuntimeException extends Exception { - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3761693372674748471L; - -public SoapElementRuntimeException(String message){ - super(message); - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementSaxHandler.java b/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementSaxHandler.java deleted file mode 100644 index 26bbf6e30..000000000 --- a/bundles/org.eclipse.jst.ws.consumption/webserviceutils/org/eclipse/jst/ws/util/SoapElementSaxHandler.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 123963 andyzhai@ca.ibm.com - Andy Zhai - *******************************************************************************/ - -package org.eclipse.jst.ws.util; - -import java.util.ArrayList; -import java.util.HashMap; - -import javax.xml.soap.Name; -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPFactory; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * @author xinzhai - */ -public class SoapElementSaxHandler extends DefaultHandler -{ - //Stores all values of pairs of prefix and URI in the document - private HashMap prefixURIMapping = new HashMap(); - //Stores a list of URIs for a particular SOAP element - private ArrayList uris = new ArrayList(); - //Represents the whole(root) SOAP document - private SOAPElement rootElement = null; - //Represents the current SOAP element where SAX parser is reading - private SOAPElement currentElement = null; - private SOAPFactory soapFactory; - - public SOAPElement getSOAPElement() - { - return rootElement; - } - - public void startDocument() throws SAXException - { - try - { - soapFactory = SOAPFactory.newInstance(); - } - catch (SOAPException e) - { - throw new SAXException("Can't create a SOAPFactory instance", e); - } - } - - public void startPrefixMapping(String prefix, String uri) - { - prefixURIMapping.put(uri,prefix); - uris.add(uri); - } - - public void characters(char[] ch, int start, int length) throws SAXException - { - String str = String.valueOf(ch); - //Add non-trivial text as a text node - if (length > 1) - { - try - { - currentElement.addTextNode(str.substring(start,start+length)); - } - catch (SOAPException e) - { - throw new SAXException("Can't add a text node into SOAPElement from text", e); - } - } - } - - public void endElement (String uri, String localName, String qName) - { - if (currentElement != rootElement ) - { - currentElement = currentElement.getParentElement(); - } - } - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - { - String prefix = (String)prefixURIMapping.get(namespaceURI); - try - { - // Create and/or add child element - if (rootElement == null && currentElement == null) - { - rootElement = soapFactory.createElement(localName,prefix,namespaceURI); - currentElement = rootElement; - } - else - { - currentElement = currentElement.addChildElement(localName,prefix,namespaceURI); - } - - // Add namespace declaration - if (uris.size() > 0) - { - for (int i = 0; i < uris.size(); i++) - { - String uri = (String)uris.get(i); - String pre = (String)prefixURIMapping.get(uri); - currentElement.addNamespaceDeclaration(pre,uri); - } - // Need to reset uris as we will use it for next element. - uris.clear(); - } - - // Add attibutes - for (int i =0; i<atts.getLength(); i++) - { - Name attriName; - if (atts.getURI(i) != null) - { - String attriPre = (String)prefixURIMapping.get(atts.getURI(i)); - attriName = soapFactory.createName(atts.getLocalName(i),attriPre,atts.getURI(i)); - } - else - { - attriName = soapFactory.createName(atts.getLocalName(i)); - } - currentElement.addAttribute(attriName, atts.getValue(i)); - } - } - catch (SOAPException e) - { - throw new SAXException(e); - } - } -} - |