diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates')
3 files changed, 0 insertions, 542 deletions
diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java deleted file mode 100644 index 425f608fd..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import java.util.Date; - -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.wsi.internal.core.log.RequestHandler; - -/** - * Implements the RequestHandler interface which represents a TCP/IP - * request made between the client and the server. Each request - * represents a request-response pair, where the request is from - * client -> server, and the response is from server -> client. - * - * @author lauzond - */ -public class RequestHandlerImpl implements RequestHandler -{ - /** - * The HTTP header of the request portion of this request. - */ - protected byte[] requestHeader; - - /** - * The HTTP header of the response portion of this request. - */ - protected byte[] responseHeader; - - /** - * The HTTP body of the request portion of this request. - */ - protected byte[] requestContent; - - /** - * The HTTP body of the response portion of this request. - */ - protected byte[] responseContent; - - /** - * The time this request was made. - */ - protected Date date = null; - - /** - * The local (client) port. - */ - protected int localPort = 0; - - /** - * The remote (server) port. - */ - protected int remotePort = 0; - - /** - * The remote (server) host. - */ - protected String remoteHost = null; - - /** - * The server's response time in milliseconds. - */ - protected long responseTime = 0; - - /** - * Constructor. - * @param request a TCP/IP request - */ - RequestHandlerImpl(Request request) - { - if (request != null) - { - this.requestHeader = request.getRequest(Request.TRANSPORT); - this.requestContent = request.getRequest(Request.CONTENT); - this.responseHeader = request.getResponse(Request.TRANSPORT); - this.responseContent = request.getResponse(Request.CONTENT); - this.date = request.getDate(); - this.localPort = request.getLocalPort(); - this.remotePort = request.getRemotePort(); - this.remoteHost = request.getRemoteHost(); - this.responseTime = request.getResponseTime(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRequestHeader() - */ - public byte[] getRequestHeader() - { - return this.requestHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRequestHeader(byte[]) - */ - public void setRequestHeader(byte[] requestHeader) - { - this.requestHeader = requestHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseHeader() - */ - public byte[] getResponseHeader() - { - return this.responseHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseHeader(byte[]) - */ - public void setResponseHeader(byte[] responseHeader) - { - this.responseHeader = responseHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRequestContent() - */ - public byte[] getRequestContent() - { - return this.requestContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseContent(byte[]) - */ - public void setResponseContent(byte[] responseContent) - { - this.responseContent = responseContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseContent() - */ - public byte[] getResponseContent() - { - return this.responseContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRequestContent(byte[]) - */ - public void setRequestContent(byte[] requestContent) - { - this.requestContent = requestContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getDate() - */ - public Date getDate() - { - return this.date; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setDate(java.util.Date) - */ - public void setDate(Date date) - { - this.date = date; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getLocalPort() - */ - public int getLocalPort() - { - return this.localPort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setLocalPort(int) - */ - public void setLocalPort(int localPort) - { - this.localPort = localPort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRemotePort() - */ - public int getRemotePort() - { - return this.remotePort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRemotePort(int) - */ - public void setRemotePort(int remotePort) - { - this.remotePort = remotePort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRemoteHost() - */ - public String getRemoteHost() - { - return this.remoteHost; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRemoteHost(java.lang.String) - */ - public void setRemoteHost(String remoteHost) - { - this.remoteHost = remoteHost; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseTime() - */ - public long getResponseTime() - { - return this.responseTime; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseTime(long) - */ - public void setResponseTime(long responseTime) - { - this.responseTime = responseTime; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java deleted file mode 100644 index 3c410e841..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IActionDelegate; - -import org.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -import org.eclipse.wst.wsi.ui.internal.actions.WSIValidateAction; - - -/** - * Action delegate for validating a WS-I log file. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ -public class ValidateWSILogFileActionDelegate implements IActionDelegate -{ - /** - * The current selection, or null if there is no selection. - */ - ISelection selection; - - /** - * Constructor. - */ - public ValidateWSILogFileActionDelegate() - { - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) - { - try - { - if (selection instanceof IStructuredSelection) - { - Object obj = ((IStructuredSelection)selection).getFirstElement(); - if (obj instanceof IFile) - { - IFile file = (IFile)obj; - WSIMessageValidator messageValidator = new WSIMessageValidator(); - WSIValidateAction validateAction = new WSIValidateAction(file, true); - validateAction.setValidator(messageValidator); - validateAction.run(); - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) - { - this.selection = selection; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java deleted file mode 100644 index 31bae5be5..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.MonitorUICore; -import org.eclipse.wst.wsi.internal.core.log.LogBuilder; -import org.eclipse.wst.wsi.internal.core.log.RequestHandler; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.wst.wsi.ui.internal.wizards.ValidationWizard; -import org.eclipse.wst.wsi.ui.internal.WSIValidator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.ContainerGenerator; -import org.eclipse.wst.wsi.internal.core.log.Log; - -/** - * Action delegate for the WS-I validator. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ -public class ValidateWSIProfileActionDelegate implements IViewActionDelegate -{ - /** - * The default WS-I Message Log filename. - */ - public static final String DEFAULT_LOG_FILENAME = "log.wsimsg"; - - /** - * The HTTP protocol. - */ - private final String HTTP = "http://"; - - - /** - * The default tag for WSDL locations. - */ - private final String WSDL = "?WSDL"; - - /** - * The current selection, or null if there is no selection. - */ - ISelection selection; - - /** - * The list of messages in the form of request-response pairs. - */ - Request[] requestResponses; - - /** - * The view that provides the context for this delegate. - */ - IViewPart view; - - /** - * Constructor. - */ - public ValidateWSIProfileActionDelegate() - { - } - - /** - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) - { - this.view = view; - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) - { - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() - { - protected void execute(IProgressMonitor progressMonitor) - throws CoreException - { - validate(progressMonitor); - } - }; - - try - { - operation.run(null); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * The validate action. - * - * @param progressMonitor - */ - public void validate(IProgressMonitor progressMonitor) - { - try - { - requestResponses = MonitorUICore.getRequests(); - Shell shell = Display.getCurrent().getActiveShell(); - if ((requestResponses != null) && (requestResponses.length > 0)) - { - ValidationWizard validateWizard = new ValidationWizard(DEFAULT_LOG_FILENAME); - List wsdllocs = new Vector(); - - for (int i=0; i<requestResponses.length; i++) - { - Request reqresp = requestResponses[i]; - String remotehost = reqresp.getRemoteHost(); - int remoteport = reqresp.getRemotePort(); - String remotelabel = reqresp.getName(); - String location = HTTP + remotehost + ":" + remoteport + remotelabel + WSDL; - if(!wsdllocs.contains(location)) - { - wsdllocs.add(location); - } - } - - validateWizard.setWSDLLocations((String[])wsdllocs.toArray(new String[wsdllocs.size()])); - WizardDialog wizardDialog = new WizardDialog(shell, validateWizard); - wizardDialog.create(); - - int result = wizardDialog.open(); - - if (validateWizard.isValid() && (result != org.eclipse.jface.window.Window.CANCEL)) - { - // If the container doesn't exist, create it now - checkAndCreateContainer(validateWizard.getContainerFullPath()); - - IFile file = validateWizard.getFile(); - LogBuilder builder = new LogBuilder(file); - Log log = builder.buildLog(getRequestHandlers(requestResponses)); - - builder.writeLog(log); - file.refreshLocal(1, progressMonitor); - - WSIValidator messageValidator = new WSIValidator(); - if(validateWizard.includeWSDLFile()) - { - String wsdlfile = validateWizard.getWSDLFile(); - String name = validateWizard.getElementName(); - String namespace = validateWizard.getNamespace(); - String parentname = validateWizard.getParentName(); - String type = validateWizard.getType(); - messageValidator.validate(file, wsdlfile, name, namespace, parentname, type); - } - else - { - messageValidator.validate(file); - } - } - } - else - { - // no available messages to validate - String title = Messages.ACTION_WSI_VALIDATOR; - String message = Messages.INFO_NO_MESSAGES_TO_VALIDATE; - MessageDialog.openInformation(shell, title, message); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - private List getRequestHandlers(Request[] requestResponses) - { - List requestHandlers = new ArrayList(); - int size = requestResponses.length; - for (int i = 0; i<size; i++) - { - Request request = requestResponses[i]; - RequestHandler handler = new RequestHandlerImpl(request); - requestHandlers.add(handler); - } - return requestHandlers; - } - - /** - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) - { - this.selection = selection; - } - - /** - * If the container doesn't exist for the selected IFile, create it now. - * - * @param containerPath The container for the selected IFile. - */ - public static void checkAndCreateContainer(IPath containerPath) - { - IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(containerPath); - - // If the container doesn't exist in the workspace, create it. - if (resource == null) - { - try - { - ContainerGenerator generator = new ContainerGenerator(containerPath); - generator.generateContainer(null); - } - catch (CoreException e) - { - } - } - } -} |