diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command')
14 files changed, 0 insertions, 1757 deletions
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisCheckCompilerLevelCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisCheckCompilerLevelCommand.java deleted file mode 100644 index 28363ed1b..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisCheckCompilerLevelCommand.java +++ /dev/null @@ -1,92 +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.axis.creation.ui.command; - -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.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.axis.creation.ui.AxisCreationUIMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** - * Check to make sure that the project containing the service bean is not at a compiler compliance setting - * that's higher than the Java VM the workbench is launched with. - */ -public class AxisCheckCompilerLevelCommand extends AbstractDataModelOperation { - - private String serverProject_; - - /** - * Default CTOR - */ - public AxisCheckCompilerLevelCommand() { - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.IUndoableOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) { - - IStatus status = Status.OK_STATUS; - String javaSpecVersion = System.getProperty("java.specification.version"); - if (javaSpecVersion != null) - { - IProject project = ProjectUtilities.getProject(serverProject_); - IJavaProject javaProject = JavaCore.create(project); - if (javaProject != null) - { - String projectCompilerLevel = javaProject.getOption("org.eclipse.jdt.core.compiler.compliance", false); - if (projectCompilerLevel == null) - { - projectCompilerLevel = (String)JavaCore.getDefaultOptions().get("org.eclipse.jdt.core.compiler.compliance"); - } - if (projectCompilerLevel != null) - { - if (!compilerLevelsCompatible(javaSpecVersion, projectCompilerLevel)) { - status = StatusUtils.errorStatus( NLS.bind(AxisCreationUIMessages.MSG_ERROR_COMPILER_LEVEL_NOT_COMPATIBLE, new String[] {javaSpecVersion, serverProject_, projectCompilerLevel})); - getEnvironment().getStatusHandler().reportError(status); - } - } - } - } - return status; - } - - /** - * Returns true if and only if the Java specification level - * of the Eclipse JRE (<code>javaSpecVersion</code> is not - * lower than the Java specification level of the compiler - * (<code>projectCompilerLevel</code>. - * @param javaSpecVersion The Java Specification Version of the JRE. - * @param projectCompilerLevel The Java project's compiler level. - * @return True if the Java specification level of the project's - * compiler does not exceed the Java specification level of the - * JRE that Eclipse is running on, and false otherwise. - */ - private boolean compilerLevelsCompatible(String javaSpecVersion, String projectCompilerLevel) { - return (javaSpecVersion.compareTo(projectCompilerLevel) >= 0); - } - - /** - * Sets the project whose compiler level should be checked. - * @param serverProject The project whose compiler level should be checked. - */ - public void setServerProject(String serverProject) { - serverProject_ = serverProject; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisOutputCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisOutputCommand.java deleted file mode 100644 index 956da3c2d..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisOutputCommand.java +++ /dev/null @@ -1,65 +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.axis.creation.ui.command; - - -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.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebService; -import org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebServiceInfo; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class AxisOutputCommand extends AbstractDataModelOperation { - - private AxisWebService ws_; - private JavaWSDLParameter javaWSDLParam_; - - private String wsdlURI_; - - /** - * Default CTOR - */ - public AxisOutputCommand() { - } - - public AxisOutputCommand(AxisWebService ws) { - ws_ = ws; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - ws_.getWebServiceInfo().setWsdlURL(wsdlURI_); - AxisWebServiceInfo axisWSInfo = new AxisWebServiceInfo(); - axisWSInfo.setJavaWSDLParameter(javaWSDLParam_); - ws_.setAxisWebServiceInfo(axisWSInfo); - - return status; - } - - /** - * @param wsdlURI - * The wsdlURI to set. - */ - public void setWsdlURI(String wsdlURI) - { - wsdlURI_ = wsdlURI; - } - - public void setJavaWSDLParam (JavaWSDLParameter javaWSDLParam_) { - this.javaWSDLParam_ = javaWSDLParam_; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisRunInputCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisRunInputCommand.java deleted file mode 100644 index 6967480e9..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisRunInputCommand.java +++ /dev/null @@ -1,74 +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 - * -------- -------- ----------------------------------------------------------- - * 20060330 124667 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - -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.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebService; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class AxisRunInputCommand extends AbstractDataModelOperation{ - - private AxisWebService ws_; - private JavaWSDLParameter javaWSDLParam_; - private String serverProject_; - private String serverInstanceId_; - private String serverFactoryId_; - private String wsdlURI_; - - public AxisRunInputCommand() { - } - - public AxisRunInputCommand(AxisWebService ws, String project) { - ws_ = ws; - serverProject_ = project; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - javaWSDLParam_ = ws_.getAxisWebServiceInfo().getJavaWSDLParameter(); - serverInstanceId_ = ws_.getWebServiceInfo().getServerInstanceId(); - serverFactoryId_ = ws_.getWebServiceInfo().getServerFactoryId(); - wsdlURI_ = ws_.getWebServiceInfo().getWsdlURL(); - - return Status.OK_STATUS; - } - - /** - * @return Returns the serverProject. - */ - public String getServerProject() - { - return serverProject_; - } - - public JavaWSDLParameter getJavaWSDLParam() { - return javaWSDLParam_; - } - - public String getServerInstanceId() { - return serverInstanceId_; - } - - public String getServerFactoryId() { - return serverFactoryId_; - } - - public String getWsdlURI() { - return wsdlURI_; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisServerDefaulter.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisServerDefaulter.java deleted file mode 100644 index b378b6b78..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/AxisServerDefaulter.java +++ /dev/null @@ -1,29 +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.axis.creation.ui.command; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter; -import org.eclipse.jst.ws.internal.consumption.common.ServerInfo; - - - -public class AxisServerDefaulter implements IServerDefaulter -{ - /* (non-Javadoc) - * @see org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter#recommendDefaultServer(org.eclipse.core.resources.IProject) - */ - public ServerInfo recommendDefaultServer(IProject project) - { - return null; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUAxisInputCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUAxisInputCommand.java deleted file mode 100644 index bc8707515..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUAxisInputCommand.java +++ /dev/null @@ -1,124 +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 - * -------- -------- ----------------------------------------------------------- - * 20060419 132905 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - - -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.Status; -import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterContext; -import org.eclipse.jst.ws.internal.axis.consumption.core.plugin.WebServiceAxisConsumptionCorePlugin; -import org.eclipse.jst.ws.internal.conformance.JAXRPCWebServiceAnalyzer; -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.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IWebService; - - -public class BUAxisInputCommand extends AbstractDataModelOperation { - - private IWebService ws_; - private String serverProject_; - private String javaBeanName_; - - private String serviceServerTypeID_; - - /** - * Default CTOR - */ - public BUAxisInputCommand() { - } - - public BUAxisInputCommand(IWebService ws, String project) { - ws_ = ws; - serverProject_ = project; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - - String serverInstanceId = ws_.getWebServiceInfo().getServerInstanceId(); - String serverFactoryId = ws_.getWebServiceInfo().getServerFactoryId(); - javaBeanName_ = ws_.getWebServiceInfo().getImplURL(); - - // The following "if" block drives validation of the given - // Java service class (javaBeanName_) against JAX-RPC if the - // JAX-RPC validation preference is switched on. - // For the most part, the JAX-RPC analyzer returns warnings - // for violations of the JAX-RPC spec, and errors only if - // actual JDT model navigation fails due to bad classpaths. - // This allows users the choice of heeding or ignoring the - // messages returned by the analyzer. - IEnvironment environment = getEnvironment(); - AxisEmitterContext context = WebServiceAxisConsumptionCorePlugin.getInstance().getAxisEmitterContext(); - if (javaBeanName_ != null && context.isValidateAgainstJAXRPCEnabled()) - { - JAXRPCWebServiceAnalyzer analyzer = new JAXRPCWebServiceAnalyzer(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(serverProject_); - if (project != null) - { - IStatus status = analyzer.analyze(project,javaBeanName_,monitor); - if (!status.isOK()) - { - try - { - environment.getStatusHandler().report(status); - } - catch (StatusException e) - { - return new Status(IStatus.ERROR,"org.eclipse.jst.ws",0,"",null); - } - } - } - } - - IServer serviceExistingServer=null; - - if (serverInstanceId != null) { // server exists - serviceExistingServer = ServerCore.findServer(serverInstanceId); - if (serviceExistingServer != null) - { - serviceServerTypeID_ = serviceExistingServer.getServerType().getId(); - } - } - else - { - serviceServerTypeID_ = serverFactoryId; - } - - return Status.OK_STATUS; - } - - /** - * @return Returns the serverProject. - */ - public String getServerProject() - { - return serverProject_; - } - - public String getServiceServerTypeID() - { - return serviceServerTypeID_; - } - - public String getJavaBeanName() { - return javaBeanName_; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUCodeGenOperation.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUCodeGenOperation.java deleted file mode 100644 index bae225977..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/BUCodeGenOperation.java +++ /dev/null @@ -1,178 +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 - * -------- -------- ----------------------------------------------------------- - * - * 20060509 125094 sengpl@ca.ibm.com - Seng Phung-Lu, Use WorkspaceModifyOperation - * 20060515 115225 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142327 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - -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.axis.consumption.core.command.Java2WSDLCommand; -import org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand; -import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.consumption.ui.task.CopyAxisJarCommand; -import org.eclipse.jst.ws.internal.axis.consumption.ui.task.RefreshProjectCommand; -import org.eclipse.jst.ws.internal.axis.creation.ui.task.UpdateAxisWSDDFileTask; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class BUCodeGenOperation extends AbstractDataModelOperation { - - // CopyAxisJarCommand - private CopyAxisJarCommand copyAxisJarCommand = null; - - // Java2WSDLCommand - private Java2WSDLCommand java2WSDLCommand = null; - private JavaWSDLParameter javaWSDLParam; - private String wsdlURI; - - // wsdl2JavaCommand - private WSDL2JavaCommand wsdl2JavaCommand = null; - - // UpdateAxisWSDDFileTask - private UpdateAxisWSDDFileTask updateAxisWsddCommand = null; - private IProject serviceProject; - - // UpdateWEBXMLCommand - private UpdateWEBXMLCommand updateWebXMLCommand = null; - - // RefreshProjectCommand - private RefreshProjectCommand refreshProjectCommand = null; - - /** - * This command runs the commands in the constructor in a WorkspaceModifyOperation. - * The commands are listed above, along with their relevant data registry parameters - * @param java2WSDL - * @param wsdl2Java - * @param updateAxisWsdd - * @param updateWebXML - */ - public BUCodeGenOperation(){ - copyAxisJarCommand = new CopyAxisJarCommand(); - java2WSDLCommand = new Java2WSDLCommand(); - wsdl2JavaCommand = new WSDL2JavaCommand(); - updateAxisWsddCommand = new UpdateAxisWSDDFileTask(); - updateWebXMLCommand = new UpdateWEBXMLCommand(); - refreshProjectCommand = new RefreshProjectCommand(); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) { - - IEnvironment env = getEnvironment(); - BottomUpWSModifyOperation buOperation = new BottomUpWSModifyOperation(info, env); - try { - buOperation.execute(monitor); - } - catch(CoreException ce){ - IStatus status = ce.getStatus(); - return status; - } - return Status.OK_STATUS; - - } - - private class BottomUpWSModifyOperation extends WorkspaceModifyOperation { - - private IAdaptable info = null; - private IEnvironment env = null; - - - protected BottomUpWSModifyOperation(IAdaptable adaptable, IEnvironment environment){ - info = adaptable; - env = environment; - } - - protected void execute(IProgressMonitor monitor) throws CoreException{ - - IStatus status = null; - - // CopyAxisJarCommand - copyAxisJarCommand.setEnvironment(env); - copyAxisJarCommand.setProject(serviceProject); - status = copyAxisJarCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR){ - throw new CoreException(status); - } - - // Java2WSDLCommand - java2WSDLCommand.setEnvironment(env); - java2WSDLCommand.setJavaWSDLParam(javaWSDLParam); - status = java2WSDLCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - wsdlURI = java2WSDLCommand.getWsdlURI(); - - // WSDL2JavaCommand - wsdl2JavaCommand.setEnvironment(env); - wsdl2JavaCommand.setJavaWSDLParam(javaWSDLParam); - status = wsdl2JavaCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - javaWSDLParam = wsdl2JavaCommand.getJavaWSDLParam(); - - // UpdateAxisWsddCommand - updateAxisWsddCommand.setEnvironment(env); - updateAxisWsddCommand.setJavaWSDLParam(javaWSDLParam); - updateAxisWsddCommand.setServiceProject(serviceProject); - status = updateAxisWsddCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - javaWSDLParam = updateAxisWsddCommand.getJavaWSDLParam(); - - // UpdateWebXMLCommand - updateWebXMLCommand.setEnvironment(env); - updateWebXMLCommand.setServerProject(serviceProject); - status = updateWebXMLCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - - // RefreshProjectCommand - refreshProjectCommand.setEnvironment(env); - refreshProjectCommand.setProject(serviceProject); - status = refreshProjectCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - - - } - - } - - public String getWsdlURI() { - return wsdlURI; - } - - public JavaWSDLParameter getJavaWSDLParam() { - return javaWSDLParam; - } - - public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) { - this.javaWSDLParam = javaWSDLParam; - } - - public void setServiceProject(IProject serviceProject) { - this.serviceProject = serviceProject; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ComputeAxisSkeletonBeanCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ComputeAxisSkeletonBeanCommand.java deleted file mode 100644 index adb2718db..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ComputeAxisSkeletonBeanCommand.java +++ /dev/null @@ -1,72 +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.axis.creation.ui.command; - -import java.util.List; -import java.util.Vector; -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.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class ComputeAxisSkeletonBeanCommand extends AbstractDataModelOperation -{ - private List classNames; - //private String wsdlURI; - //private WebServicesParser webServicesParser; - private JavaWSDLParameter javaWSDLParameter; - - public ComputeAxisSkeletonBeanCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - classNames = new Vector(); - if (javaWSDLParameter != null) - { - String beanName = javaWSDLParameter.getBeanName(); - if (beanName != null) - classNames.add(beanName); - } - return Status.OK_STATUS; - } - - public List getClassNames() - { - return classNames; - } - - /** - * @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 void setJavaWSDLParam(JavaWSDLParameter javaWSDLParameter) - { - this.javaWSDLParameter = javaWSDLParameter; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/CopyDeploymentFileCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/CopyDeploymentFileCommand.java deleted file mode 100644 index dcc43507b..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/CopyDeploymentFileCommand.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - * -------- -------- ----------------------------------------------------------- - * 20060524 130755 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - - -import java.io.FileInputStream; -import java.io.IOException; - -import org.eclipse.core.resources.IProject; -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.axis.consumption.core.AxisConsumptionCoreMessages; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -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.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -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.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; -import org.eclipse.wst.server.core.internal.IModulePublishHelper; - -/** - * - * This command copies the server-config.wsdd file to it's proper location in the module. - * - */ - -public class CopyDeploymentFileCommand extends AbstractDataModelOperation -{ - private final String WEB_INF = "WEB-INF"; - private final String SERVER_CONFIG = "server-config.wsdd"; - private String projectName_; - private String EARProjectName_; - private String serverInstanceId_; - - /** - * Constructor for CopyDeploymentFileCommand. - * @param String description - * @param String name - * - */ - public CopyDeploymentFileCommand( String projectName, String earProjectName ) - { - projectName_ = projectName; - EARProjectName_ = earProjectName; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - IEnvironment environment = getEnvironment(); - - FileInputStream finStream = null; - try - { - - IVirtualComponent component = J2EEUtils.getVirtualComponent( projectName_ ); - IServer server = ServerCore.findServer( serverInstanceId_ ); - IProject project = ProjectUtilities.getProject(projectName_); - IModule projectModule = ServerUtil.getModule(project); - - if (server != null && component != null && projectModule != null) { - IModulePublishHelper publishHelper = (IModulePublishHelper) - server.loadAdapter(IModulePublishHelper.class, monitor); - if (publishHelper != null) { - IModule[] serverModules; - if (EARProjectName_ == null) { - serverModules = new IModule [] {projectModule}; - } else { - IProject EARProject = ProjectUtilities.getProject(EARProjectName_); - IModule EARProjectModule = ServerUtil.getModule(EARProject); - serverModules = new IModule [] {EARProjectModule, projectModule}; - } - IPath publishDirPath = publishHelper.getPublishDirectory(serverModules); - if (publishDirPath != null) { - IPath path = new Path( WEB_INF ).append( SERVER_CONFIG ); - IPath serverConfigPath = publishDirPath.append(path); - if (serverConfigPath != null) { - IVirtualFolder rootFolder = component.getRootFolder(); - if (rootFolder != null) { - IVirtualFile newLocation = rootFolder.getFile(path); - IPath targetPath = newLocation.getWorkspaceRelativePath(); - - if (targetPath != null) { - finStream = new FileInputStream(serverConfigPath.toString()); - if (finStream != null) { - IStatusHandler statusHandler = environment.getStatusHandler(); - ResourceContext context = WebServicePlugin.getInstance().getResourceContext(); - FileResourceUtils.createFile(context, - targetPath, - finStream, - monitor, - statusHandler); - finStream.close(); - } - } - } - } - } - } - } - } - catch( Throwable e ) - { - status = StatusUtils.errorStatus(NLS.bind(AxisConsumptionCoreMessages.MSG_ERROR_MOVE_RESOURCE, new String[]{e.getLocalizedMessage()}), e); - environment.getStatusHandler().reportError(status); - } finally { - if (finStream != null) { - try { - finStream.close(); - } catch (IOException e) { - } - } - } - - return status; - - } - - public void setServerInstanceId(String serverInstanceId) { - this.serverInstanceId_ = serverInstanceId; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java deleted file mode 100644 index 682416718..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java +++ /dev/null @@ -1,213 +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.axis.creation.ui.command; - - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -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.java.JavaClass; -import org.eclipse.jem.java.Method; -import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.creation.ui.AxisCreationUIMessages; -import org.eclipse.jst.ws.internal.common.JavaMOFUtils; -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.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class JavaToWSDLMethodCommand extends AbstractDataModelOperation { - - private static String JAVA_EXTENSION = ".java"; //$NON-NLS-1$ - private static String CLASS_EXTENSION = ".class"; //$NON-NLS-1$ - - private Hashtable fMethodNames; - private String fClassName; - private String fbeanBaseName; - private JavaWSDLParameter javaWSDLParam_; - private IProject serviceProject_; - - /** - * Default CTOR - */ - public JavaToWSDLMethodCommand() { - } - /** - * Default CTOR - */ - public JavaToWSDLMethodCommand( - JavaWSDLParameter javaParameter, - IProject serviceProject) { - javaWSDLParam_ = javaParameter; - serviceProject_ = serviceProject; - - } - - /** - * JavaToToWSDLMethod execute - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - - fbeanBaseName = javaWSDLParam_.getBeanName(); - environment.getLog().log(ILog.INFO, 5070, this, "execute", "beanBaseName = "+fbeanBaseName); - IStatus status; - try { - //Get the qualified bean name; my.package.MyClass - fMethodNames = new Hashtable(); - Hashtable oldMethodsNames = javaWSDLParam_.getMethods(); - String qName = fbeanBaseName; - - if (qName.toLowerCase().endsWith(JAVA_EXTENSION) - || qName.toLowerCase().endsWith(CLASS_EXTENSION)) { - qName = qName.substring(0, qName.lastIndexOf('.')); - } - - JavaClass javaClass = JavaMOFUtils.getJavaClass(qName, serviceProject_); - - if (!javaClass.isExistingType()) { - environment.getLog().log(ILog.ERROR, 5022, this, "execute", - NLS.bind(AxisCreationUIMessages.MSG_ERROR_JAVA_MOF_REFLECT_FAILED, - new String[] { qName })); - - status = StatusUtils.errorStatus( - NLS.bind(AxisCreationUIMessages.MSG_ERROR_JAVA_MOF_REFLECT_FAILED, - new String[] { qName })); - environment.getStatusHandler().reportError(status); - return status; - } - - // Get the qualified name - fClassName = javaClass.getQualifiedName(); - String beanName; - if (fClassName.lastIndexOf('.') != -1) { - beanName = - fClassName.substring( - fClassName.lastIndexOf('.') + 1, - fClassName.length()); - } else - beanName = fClassName; - - // Walk the java class and get the method names - gatherMethods(javaClass, beanName, oldMethodsNames); - /* - Iterator m = javaClass.getPublicMethodsExtended().iterator(); - while (m.hasNext()) { - Method method = (Method) m.next(); - if ( ! method.isConstructor()){ - if (!beanName.equals(method.getName()) - && !(isDuplicateMethodName(method - .getMethodElementSignature())) - && !(method - .getContainingJavaClass() - .getJavaName() - .equalsIgnoreCase("javax.ejb.EJBObject")) //$NON-NLS-1$ - && !(method - .getContainingJavaClass() - .getJavaName() - .equalsIgnoreCase("javax.ejb.EJBObject[]")) //$NON-NLS-1$ - && !(method - .getContainingJavaClass() - .getJavaName() - .equalsIgnoreCase("java.lang.Object")) //$NON-NLS-1$ - && !(method - .getContainingJavaClass() - .getJavaName() - .equalsIgnoreCase("java.lang.Object[]"))) { //$NON-NLS-1$ - // add the method name to our list of method names - String methodName =method.getMethodElementSignature(); - Boolean isSelected = new Boolean(true); - if (oldMethodsNames != null && oldMethodsNames.containsKey(methodName)) - isSelected = (Boolean)oldMethodsNames.get(methodName); - fMethodNames.put(methodName, isSelected); - } - } - } - */ - javaWSDLParam_.setMethods(fMethodNames); - - return Status.OK_STATUS; - - } catch (Exception e) { - environment.getLog().log(ILog.ERROR, 5023, this, "execute", AxisCreationUIMessages.MSG_ERROR_READ_BEAN); - - status = StatusUtils.errorStatus(AxisCreationUIMessages.MSG_ERROR_JAVA_TO_METHOD, e); - environment.getStatusHandler().reportError(status); - return status; - } - } - - private void gatherMethods(JavaClass javaClass, String beanName, Hashtable oldMethodsNames) - { - String javaName = javaClass.getJavaName(); - if (!javaClass.isInterface() - && !javaName.equalsIgnoreCase("javax.ejb.EJBObject[]") - && !javaName.equalsIgnoreCase("javax.ejb.EJBObject") - && !javaName.equalsIgnoreCase("java.lang.Object[]") - && !javaName.equalsIgnoreCase("java.lang.Object")) - { - List publicMethods = javaClass.getPublicMethods(); - for (Iterator it = publicMethods.iterator(); it.hasNext();) - { - Method method = (Method)it.next(); - if (!method.isConstructor() - && !beanName.equals(method.getName()) - && !(isDuplicateMethodName(method.getMethodElementSignature()))) - { - // add the method name to our list of method names - String methodName = method.getMethodElementSignature(); - Boolean isSelected = new Boolean(true); - if (oldMethodsNames != null && oldMethodsNames.containsKey(methodName)) - isSelected = (Boolean)oldMethodsNames.get(methodName); - fMethodNames.put(methodName, isSelected); - } - } - gatherMethods(javaClass.getSupertype(), beanName, oldMethodsNames); - } - } - - //Returns true if the provided method name already exists in the - //fMethodNames vector. This method is used to detect overloaded - //methods in Beans and EJBs, which are currently unsupported. - private boolean isDuplicateMethodName(String methodName) { - return (fMethodNames == null ? false: fMethodNames.containsKey(methodName)); - } - - /** - * Returns the javaWSDLParam. - * @return JavaWSDLParameter - */ - public JavaWSDLParameter getJavaWSDLParam() { - return javaWSDLParam_; - } - - /** - * Sets the javaWSDLParam. - * @param javaWSDLParam The javaWSDLParam to set - */ - public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) { - this.javaWSDLParam_ = javaWSDLParam; - } - - public void setServiceProject(IProject serviceProject) - { - serviceProject_ = serviceProject; - } -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ModifyWSDLEndpointAddressCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ModifyWSDLEndpointAddressCommand.java deleted file mode 100644 index 4b4f02674..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ModifyWSDLEndpointAddressCommand.java +++ /dev/null @@ -1,187 +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 - * -------- -------- ----------------------------------------------------------- - * 20060515 115225 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - -import java.io.OutputStream; -import java.net.URL; -import java.util.Iterator; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.wsdl.extensions.soap.SOAPAddress; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLWriter; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -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.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.creation.ui.AxisCreationUIMessages; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -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.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.wsdl.internal.impl.wsdl4j.WSDLFactoryImpl; - -public class ModifyWSDLEndpointAddressCommand extends AbstractDataModelOperation { - - private String serverInstanceId; - private String serverFactoryId; - private IProject serviceProject; - private String wsdlURI; - private WebServicesParser webServicesParser; - public final String SERVICE_EXT = "/services/"; //$NON-NLS-1$ - private JavaWSDLParameter javaWSDLParam; - - public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) { - IStatus status; - IEnvironment environment = getEnvironment(); - try { - // the correct project URL has already been obtained, no need to modify <soap:address> location URI - if (!javaWSDLParam.isGuessProjectURL()) { - return Status.OK_STATUS; - } - - String projectURL = null; - - IServer server = null; - if(serverInstanceId!=null) { - server = ServerCore.findServer(serverInstanceId); - } - - if(server!=null) { - projectURL = ServerUtils.getEncodedWebComponentURL(serviceProject, serverFactoryId, server); - } else { - projectURL = ServerUtils.getEncodedWebComponentURL(serviceProject, serverFactoryId); - } - - if(projectURL==null || projectURL.trim().length()==0) { - status = StatusUtils.errorStatus(NLS.bind(AxisCreationUIMessages.MSG_ERROR_PROJECT_URL, new String[] {serviceProject.getName()})); - environment.getStatusHandler().reportError(status); - return status; - } - - if (javaWSDLParam.getProjectURL() == projectURL) { - return Status.OK_STATUS; - } - - javaWSDLParam.setProjectURL(projectURL); // project URL needed for Axis deploy - - // modify the <soap:address> location URI to reflect the correct project URL - if(wsdlURI!=null) { - boolean modified = false; - if (webServicesParser == null) { - webServicesParser = new WebServicesParserExt(); - } - Definition definition = webServicesParser.getWSDLDefinition(wsdlURI); - Map services = definition.getServices(); - for (Iterator it = services.values().iterator(); it.hasNext();) { - Service ser = (Service)it.next(); - Map ports = ser.getPorts(); - for (Iterator it2 = ports.values().iterator(); it2.hasNext();) { - Port p = (Port)it2.next(); - for (Iterator it3 = p.getExtensibilityElements().iterator(); it3.hasNext();) { - Object obj = it3.next(); - if (obj instanceof SOAPAddress) { - SOAPAddress soapAddress = (SOAPAddress)obj; - String wsdlSoapAddress = soapAddress.getLocationURI(); - - // check if the WSDL SOAP address has the right project URL, if not, update it - if(wsdlSoapAddress!=null) { - if (!wsdlSoapAddress.startsWith(projectURL)) { - // e.g. "http://tempuri.org/services/ServiceName" becomes "/services/ServiceName" - String servicesString = wsdlSoapAddress.substring(wsdlSoapAddress.indexOf(SERVICE_EXT)); - soapAddress.setLocationURI(projectURL + servicesString); - modified = true; - } - - } - } - } - } - } - - if (modified) { - // update the WSDL file and refresh in workspace - WSDLFactory wsdlFactory = new WSDLFactoryImpl(); - WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); - OutputStream os = environment.getURIFactory().newURI(wsdlURI.toString()).getOutputStream(); - wsdlWriter.writeWSDL(definition, os); - os.close(); - - URL wsdlURL = new URL (wsdlURI); - IResource wsdlFile = ResourceUtils.findResourceAtLocation(wsdlURL.getPath(), serviceProject); - if (wsdlFile != null) { - wsdlFile.refreshLocal(IResource.DEPTH_ZERO, monitor); - } - } - } else { - status = StatusUtils.errorStatus(NLS.bind(AxisCreationUIMessages.MSG_ERROR_MODIFY_ENDPOINT, new String[] {wsdlURI})); - environment.getStatusHandler().reportError(status); - return status; - } - - } catch(Exception e) { - status = StatusUtils.errorStatus(NLS.bind(AxisCreationUIMessages.MSG_ERROR_MODIFY_ENDPOINT, new String[] {wsdlURI})); - environment.getStatusHandler().reportError(status); - return status; - } - - return Status.OK_STATUS; - } - - - public void setServerInstanceId(String serverId) { - this.serverInstanceId = serverId; - } - - public void setServerFactoryId(String serverFactoryId) { - this.serverFactoryId = serverFactoryId; - } - - public void setServiceProject(IProject serviceProject) { - this.serviceProject = serviceProject; - } - - public void setWsdlURI(String wsdlURI) { - this.wsdlURI = wsdlURI; - } - - public void setWebServicesParser(WebServicesParser parser) { - webServicesParser = parser; - } - - - public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) - { - this.javaWSDLParam = javaWSDLParam; - } - - public JavaWSDLParameter getJavaWSDLParam() - { - return javaWSDLParam; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java deleted file mode 100644 index 45c8f59a9..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java +++ /dev/null @@ -1,83 +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 - * -------- -------- ----------------------------------------------------------- - * 20060330 128827 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - - -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.wsrt.IWebService; -import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo; - - -public class TDAxisInputCommand extends AbstractDataModelOperation { - - private IWebService ws_; - private String serverProject_; - - private String serverServer_; - private String serviceServerTypeID_; - private String wsdlURI_; - private WebServiceInfo webServiceInfo_; - - /** - * Default CTOR - */ - public TDAxisInputCommand() { - } - - public TDAxisInputCommand(IWebService ws, String project) { - ws_ = ws; - serverProject_ = project; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - serverServer_ = ws_.getWebServiceInfo().getServerInstanceId(); - serviceServerTypeID_ = ws_.getWebServiceInfo().getServerFactoryId(); - wsdlURI_ = ws_.getWebServiceInfo().getWsdlURL(); - webServiceInfo_ = ws_.getWebServiceInfo(); - - return Status.OK_STATUS; - } - - /** - * @return Returns the serverProject. - */ - public String getServerProject() - { - return serverProject_; - } - - public String getServerServer() - { - return serverServer_; - } - - public String getServiceServerTypeID() - { - return serviceServerTypeID_; - } - - public String getWsdlURI() { - return wsdlURI_; - } - - public WebServiceInfo getWebServiceInfo() { - return webServiceInfo_; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDCodeGenOperation.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDCodeGenOperation.java deleted file mode 100644 index 1bbefc23c..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDCodeGenOperation.java +++ /dev/null @@ -1,226 +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 - * -------- -------- ----------------------------------------------------------- - * 20060509 125094 sengpl@ca.ibm.com - Seng Phung-Lu, Use WorkspaceModifyOperation - * 20060515 115225 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142327 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - -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.axis.consumption.core.command.WSDL2JavaCommand; -import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.consumption.ui.task.CopyAxisJarCommand; -import org.eclipse.jst.ws.internal.axis.consumption.ui.task.RefreshProjectCommand; -import org.eclipse.jst.ws.internal.axis.creation.ui.task.BackupSkelImplCommand; -import org.eclipse.jst.ws.internal.axis.creation.ui.task.Skeleton2WSDLCommand; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo; - -public class TDCodeGenOperation extends AbstractDataModelOperation { - - // CopyAxisJarCommand - private CopyAxisJarCommand copyAxisJarCommand = null; - - // BackupSkelImplCommand - private BackupSkelImplCommand backupSkelImplCommand = null; - private WebServicesParser webServicesParser; - private JavaWSDLParameter javaWSDLParam; - private WebServiceInfo webServiceInfo; - - // WSDL2JavaCommand - private WSDL2JavaCommand wsdl2JavaCommand = null; - private String wsdlURI; - private String httpBasicAuthUsername; - private String httpBasicAuthPassword; - - // Skeleton2WSDLCommand - private Skeleton2WSDLCommand skeleton2WSDLCommand = null; - private IProject serverProject; - private String serviceServerTypeID; - - // UpdateWebXMLCommand - private UpdateWEBXMLCommand updateWebXMLCommand = null; - - // RefreshProjectCommand - private RefreshProjectCommand refreshProjectCommand = null; - - /** - * This command runs the commands passed by the constructor in a WorkspaceModifyOperation. - * The commands are listed above, with only some of their data registry parameters since some appear - * to overlap the commands. - * @param backupSkelImpl - * @param wsdl2Java - * @param skeleton2WSDL - * @param updateWebXML - */ - public TDCodeGenOperation() { - copyAxisJarCommand = new CopyAxisJarCommand(); - backupSkelImplCommand = new BackupSkelImplCommand(); - wsdl2JavaCommand = new WSDL2JavaCommand(); - skeleton2WSDLCommand = new Skeleton2WSDLCommand(); - updateWebXMLCommand = new UpdateWEBXMLCommand(); - refreshProjectCommand = new RefreshProjectCommand(); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) { - IEnvironment env = getEnvironment(); - TopDownWSModifyOperation tdOperation = new TopDownWSModifyOperation(info, env); - try { - tdOperation.execute(monitor); - } - catch(CoreException ce){ - IStatus status = ce.getStatus(); - return status; - } - return Status.OK_STATUS; - } - - - - private class TopDownWSModifyOperation extends WorkspaceModifyOperation { - - private IAdaptable info = null; - private IEnvironment env = null; - - protected TopDownWSModifyOperation(IAdaptable adaptable, IEnvironment environment){ - info = adaptable; - env = environment; - } - - protected void execute(IProgressMonitor monitor) throws CoreException { - - IStatus status = null; - - // CopyAxisJarCommand - copyAxisJarCommand.setEnvironment(env); - copyAxisJarCommand.setProject(serverProject); - status = copyAxisJarCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR){ - throw new CoreException(status); - } - - // backupSkelImplCommand - backupSkelImplCommand.setEnvironment(env); - backupSkelImplCommand.setWebServicesParser(webServicesParser); - backupSkelImplCommand.setJavaWSDLParam(javaWSDLParam); - backupSkelImplCommand.setWebServiceInfo(webServiceInfo); - status = backupSkelImplCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - - // wsdl2JavaCommand - wsdl2JavaCommand.setEnvironment(env); - wsdl2JavaCommand.setWsdlURI(wsdlURI); - wsdl2JavaCommand.setHttpBasicAuthUsername(httpBasicAuthUsername); - wsdl2JavaCommand.setHttpBasicAuthPassword(httpBasicAuthPassword); - wsdl2JavaCommand.setJavaWSDLParam(javaWSDLParam); - status = wsdl2JavaCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - javaWSDLParam = wsdl2JavaCommand.getJavaWSDLParam(); - - // Skeleton2WSDLCommand - skeleton2WSDLCommand.setEnvironment(env); - skeleton2WSDLCommand.setWebServicesParser(webServicesParser); - skeleton2WSDLCommand.setJavaWSDLParam(javaWSDLParam); - skeleton2WSDLCommand.setServerProject(serverProject); - skeleton2WSDLCommand.setServiceServerTypeID(serviceServerTypeID); - status = skeleton2WSDLCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - wsdlURI = skeleton2WSDLCommand.getWsdlURI(); - - // UpdateWebXMLCommand - updateWebXMLCommand.setEnvironment(env); - updateWebXMLCommand.setServerProject(serverProject); - status = updateWebXMLCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - - // RefreshProjectCommand - refreshProjectCommand.setEnvironment(env); - refreshProjectCommand.setProject(serverProject); - status = refreshProjectCommand.execute(monitor, info); - if (status.getSeverity() == Status.ERROR) { - throw new CoreException(status); - } - - } - - } - - - - public JavaWSDLParameter getJavaWSDLParam() { - return javaWSDLParam; - } - - public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) { - this.javaWSDLParam = javaWSDLParam; - } - - public void setWebServiceInfo(WebServiceInfo webServiceInfo) { - this.webServiceInfo = webServiceInfo; - } - - public void setWebServicesParser(WebServicesParser webServicesParser) { - this.webServicesParser = webServicesParser; - } - - /** - * @param httpBasicAuthPassword - * The httpBasicAuthPassword to set. - */ - public void setHttpBasicAuthPassword(String httpBasicAuthPassword) { - this.httpBasicAuthPassword = httpBasicAuthPassword; - } - - /** - * @param httpBasicAuthUsername - * The httpBasicAuthUsername to set. - */ - public void setHttpBasicAuthUsername(String httpBasicAuthUsername) { - this.httpBasicAuthUsername = httpBasicAuthUsername; - } - - public void setWsdlURI(String wsdlURI) { - this.wsdlURI = wsdlURI; - } - - public String getWsdlURI() { - return wsdlURI; - } - - /** - * @param serverProject The serverProject to set. - */ - public void setServerProject(IProject serverProject) { - this.serverProject = serverProject; - } - - public void setServiceServerTypeID(String id) { - this.serviceServerTypeID = id; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/UpdateWEBXMLCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/UpdateWEBXMLCommand.java deleted file mode 100644 index 5d4e868fd..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/UpdateWEBXMLCommand.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - * -------- -------- ----------------------------------------------------------- - * 20060515 115225 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - - -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.ws.internal.axis.creation.ui.AxisCreationUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class UpdateWEBXMLCommand extends AbstractDataModelOperation { - - private IProject serverProject; - - public UpdateWEBXMLCommand( ) - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - if (serverProject != null) { - IStatus status = null; - status = addServlet(serverProject, getAxisServletDescriptor()); - if (status.getSeverity() == Status.ERROR) { - environment.getStatusHandler().reportError(status); - return status; - } - addServlet(serverProject, getAdmintServletDescriptor()); - if (status.getSeverity() == Status.ERROR) { - environment.getStatusHandler().reportError(status); - return status; - } - } - return Status.OK_STATUS; - } - - private ServletDescriptor getAxisServletDescriptor() { - - ServletDescriptor sd = new ServletDescriptor(); - sd._name = "AxisServlet"; //$NON-NLS-1$ - sd._displayName = "Apache-Axis Servlet"; //$NON-NLS-1$ - sd._className = "org.apache.axis.transport.http.AxisServlet"; //$NON-NLS-1$ - sd._mappings = new String[] { "/servlet/AxisServlet", //$NON-NLS-1$ - "*.jws", //$NON-NLS-1$ - "/services/*" }; //$NON-NLS-1$ - return sd; - } - - private ServletDescriptor getAdmintServletDescriptor() { - ServletDescriptor sd = new ServletDescriptor(); - sd._name = "AdminServlet"; //$NON-NLS-1$ - sd._displayName = "Axis Admin Servlet"; //$NON-NLS-1$ - sd._className = "org.apache.axis.transport.http.AdminServlet"; //$NON-NLS-1$ - sd._mappings = new String[] { "/servlet/AdminServlet" }; //$NON-NLS-1$ - sd._loadOnStartup = new Integer(100); - return sd; - } - - public IStatus addServlet(IProject webProject, ServletDescriptor servletDescriptor) { - - WebArtifactEdit webEdit = null; - try { - // - WebApp webapp = null; - IVirtualComponent vc = ComponentCore.createComponent(webProject); - webEdit = WebArtifactEdit.getWebArtifactEditForWrite(vc); - if (webEdit != null) - { - webapp = (WebApp) webEdit.getDeploymentDescriptorRoot(); - - List theServlets = webapp.getServlets(); - for (int i = 0; i < theServlets.size(); i++) { - Servlet aServlet = (Servlet) theServlets.get(i); - if (aServlet.getServletName().equals(servletDescriptor._name)) { - return Status.OK_STATUS; - } - } - - WebapplicationFactory factory = WebapplicationFactory.eINSTANCE; - - Servlet servlet = factory.createServlet(); - ServletType servletType = factory.createServletType(); - servlet.setWebType(servletType); - servlet.setServletName(servletDescriptor._name); - servletType.setClassName(servletDescriptor._className); - if(servletDescriptor._displayName != null){ - servlet.setDisplayName(servletDescriptor._displayName); - } - if(servletDescriptor._loadOnStartup != null){ - servlet.setLoadOnStartup(servletDescriptor._loadOnStartup); - } - if(servletDescriptor._params != null){ - Properties properties = servlet.getParamsAsProperties(); - properties.putAll(servletDescriptor._params); - } - webapp.getServlets().add(servlet); - - if(servletDescriptor._mappings != null){ - for(int i=0; i<servletDescriptor._mappings.length; i++){ - ServletMapping servletMapping = factory.createServletMapping(); - servletMapping.setServlet(servlet); - servletMapping.setUrlPattern(servletDescriptor._mappings[i]); - webapp.getServletMappings().add(servletMapping); - } - } - - webEdit.save(new NullProgressMonitor()); - } - - return Status.OK_STATUS; - } catch (Exception e) { - - return StatusUtils.errorStatus( - AxisCreationUIMessages.MSG_ERROR_UPDATE_WEB_XML, - e); - } - finally{ - if (webEdit != null) - webEdit.dispose(); - } - } - - public void setServerProject(IProject serverProject) - { - this.serverProject = serverProject; - } - - public class ServletDescriptor { - String _name; - String _className; - String _displayName; - Map _params; - String[] _mappings; - Integer _loadOnStartup; - } - -} diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ValidateWSIComplianceCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ValidateWSIComplianceCommand.java deleted file mode 100644 index ce5635f6f..000000000 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/ValidateWSIComplianceCommand.java +++ /dev/null @@ -1,99 +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 - * -------- -------- ----------------------------------------------------------- - * 20060607 144978 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.axis.creation.ui.command; - -import java.util.Vector; - -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.axis.consumption.core.AxisConsumptionCoreMessages; -import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; -import org.eclipse.jst.ws.internal.axis.creation.ui.AxisCreationUIMessages; -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.ws.internal.preferences.PersistentWSIContext; -import org.eclipse.wst.ws.internal.preferences.WSIComplianceUtils; - - -public class ValidateWSIComplianceCommand extends AbstractDataModelOperation -{ - private JavaWSDLParameter javaWSDLParam = null; - private Vector status = null; - private IProject serviceProject_ = null; - - public ValidateWSIComplianceCommand() { - } - - public IStatus execute (IProgressMonitor monitor, IAdaptable adaptable) - { - - IEnvironment environment = getEnvironment(); - - if (javaWSDLParam == null) { - IStatus simpleStatus = StatusUtils.errorStatus( AxisConsumptionCoreMessages.MSG_ERROR_JAVA_WSDL_PARAM_NOT_SET); - environment.getStatusHandler().reportError(simpleStatus); - return simpleStatus; - } - - status = new Vector(); - - PersistentWSIContext wsiContext = new PersistentWSIContext(); - int severity = WSIComplianceUtils.getWSISeverity(serviceProject_, wsiContext); - checkRPCEncoded(severity); - Status[] statuses = (Status[]) status.toArray(new Status[status.size()]); - - if (statuses.length == 0 || - WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statuses, serviceProject_, wsiContext)) - return Status.OK_STATUS; - else { - return StatusUtils.errorStatus(""); - } - } - - private void checkRPCEncoded(int severity) - { - if (JavaWSDLParameter.STYLE_RPC.equals(javaWSDLParam.getStyle()) && - JavaWSDLParameter.USE_ENCODED.equals(javaWSDLParam.getUse())) - status.add (new Status(severity, "ValidateWSIComplianceCommand", 0, - AxisCreationUIMessages.WSI_INCOMPLIANCE_RPC_ENCODED, null)); - - } - - /** - * Returns the message string identified by the given key from - * plugin.properties. - * @return The String message. - */ - -/** - * @param javaWSDLParam The javaWSDLParam to set. - * @todo Generated comment - */ -public void setJavaWSDLParam(JavaWSDLParameter javaWSDLParam) { - this.javaWSDLParam = javaWSDLParam; -} - -/** - * @param serviceProject_ The serviceProject_ to set. - * @todo Generated comment - */ -public void setServiceProject(IProject serviceProject_) { - this.serviceProject_ = serviceProject_; -} -} |