diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer')
24 files changed, 0 insertions, 5672 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.java deleted file mode 100644 index 3e00d4a23..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.java +++ /dev/null @@ -1,309 +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.internal.core.analyzer; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.List; -import java.util.Vector; - -import org.eclipse.wst.wsi.internal.core.ToolInfo; -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig; -import org.eclipse.wst.wsi.internal.core.document.DocumentFactory; -import org.eclipse.wst.wsi.internal.core.log.Log; -import org.eclipse.wst.wsi.internal.core.profile.ProfileAssertions; -import org.eclipse.wst.wsi.internal.core.profile.validator.ProfileValidatorFactory; -import org.eclipse.wst.wsi.internal.core.report.Reporter; -import org.eclipse.wst.wsi.internal.core.util.MessageList; -import org.eclipse.wst.wsi.internal.core.util.TestUtils; - -/** - * The Analyzer will process all Profile conformance functions. - * This class should be sub-classed for each profile. - * - * @version 1.0.1 - * @author Jim Clune - * @author Peter Brittenham - */ -public abstract class Analyzer -{ - /** - * Message list. - */ - protected MessageList messageList = null; - - protected final static String RESOURCE_BUNDLE_NAME = - "org.eclipse.wst.wsi.internal.core.analyzer.Analyzer"; - - public final static String USAGE_MESSAGE = - "Usage: Analyzer -config <configFilename>"; - - protected Reporter reporter = null; - protected AnalyzerContext analyzerContext = null; - protected CandidateInfo candidateInfo = null; - - /** - * Analyzer tool information. - */ - protected ToolInfo toolInfo = null; - - /** - * Profile validator factory. - */ - protected ProfileValidatorFactory factory = null; - - /** - * Profile validator factory. - */ - protected DocumentFactory documentFactory = null; - - /** - * Analyzer config file list. - */ - protected List analyzerConfigList = new Vector(); - protected int analyzerConfigIndex = 0; - - /** - * Profile assertions. - */ - protected ProfileAssertions profileAssertions = null; - - /** - * Log file. - */ - protected Log log = null; - - /** - * Create an instance of the analyzer tool. - * @param args command line arguments. - * @param toolInfo analyzer tool information. - * @throws WSIException if problems creating the instance of the analyzer tool. - */ - public Analyzer(String[] args, ToolInfo toolInfo) throws WSIException - { - init(toolInfo); - - // Get new config object - this.analyzerConfigList.add( - analyzerConfigIndex, - documentFactory.newAnalyzerConfig()); - getAnalyzerConfig().init(messageList); - - // Parse command line arguments - getAnalyzerConfig().parseArgs(args, true); - - // Display copyright and options that were specified - TestUtils.printToolInfo(toolInfo); - System.out.println(getAnalyzerConfig().toString()); - - // Display message - printMessage( - "progress01", - null, - "Please wait while the specified artifacts are analyzed..."); - } - - /** - * Create an instance of the analyzer tool. - * @param args command line arguments. - * @param toolInfo analyzer tool information. - * @param validate flag for config options validation. - * @throws WSIException if problems creating the instance of the analyzer tool. - */ - public Analyzer(String[] args, ToolInfo toolInfo, boolean validate) throws WSIException - { - init(toolInfo); - - // Get new config object - this.analyzerConfigList.add( - analyzerConfigIndex, - documentFactory.newAnalyzerConfig()); - getAnalyzerConfig().init(messageList); - - // Parse command line arguments - getAnalyzerConfig().parseArgs(args, validate); - - // Display copyright and options that were specified - TestUtils.printToolInfo(toolInfo); - System.out.println(getAnalyzerConfig().toString()); - - // Display message - printMessage( - "progress01", - null, - "Please wait while the specified artifacts are analyzed..."); - } - - /** - * Create an instance of the analyzer tool. - * @param analyzerConfigList analyzer config file list. - * @param toolInfo analyzer tool information. - * @throws WSIException if problems creating the instance of the analyzer tool. - */ - public Analyzer(List analyzerConfigList, ToolInfo toolInfo) - throws WSIException - { - init(toolInfo); - - this.analyzerConfigList = analyzerConfigList; - } - - /** - * Common initialization. - * @param toolInfo analyzer tool information. - * @throws WSIException if problems occur during common initialization. - */ - protected void init(ToolInfo info) throws WSIException - { - this.toolInfo = info; - - // Create message list - messageList = new MessageList(RESOURCE_BUNDLE_NAME); - - // Create profile validator factory - factory = ProfileValidatorFactory.newInstance(); - - // Create document factory - documentFactory = DocumentFactory.newInstance(); - } - - /** - * Process all conformance validation functions. - * @return status code. - * @throws WSIException if problems occur during validation. - */ - public int validateAll() throws WSIException - { - int statusCode = 0; - int tempStatusCode; - - for (int index = 0; index < analyzerConfigList.size(); index++) - { - // DEBUG: - //System.out.println("index: " + index); - - // Set current analyzer config index - setAnalyzerConfig(index); - - if ((tempStatusCode = validateConformance()) > statusCode) - statusCode = tempStatusCode; - } - - return statusCode; - } - - /** - * Process all conformance validation functions. - * @return status code. - * @throws WSIException if problems occur during conformance validation. - */ - public abstract int validateConformance() throws WSIException; - - /** - * Get tool information. - * @return the tool information. - */ - public ToolInfo getToolInfo() - - { - return this.toolInfo; - } - - /** - * Set current analyzer configuration. - * @param index urrent analyzer configuration. - * @see #getAnalyzerConfig - */ - protected void setAnalyzerConfig(int index) - { - this.analyzerConfigIndex = index; - } - - /** - * Get analyzer configuration information. - * @return analyzer configuration information. - * @see #setAnalyzerConfig - */ - public AnalyzerConfig getAnalyzerConfig() - { - return (AnalyzerConfig) this.analyzerConfigList.get(analyzerConfigIndex); - } - - /** - * Print a message from the resource bundle. - * @param key a key. - * @param messageData message data. - * @param defaultMessage a default message. - */ - public void printMessage( - String key, - String messageData, - String defaultMessage) - { - messageList.printMessage(key, messageData, defaultMessage); - } - - /** - * Print message. - * @param key a key. - * @param messageData message data. - * @param defaultMessage a default message. - */ - public static void staticPrintMessage( - String key, - String messageData, - String defaultMessage) - { - MessageList.printMessage( - RESOURCE_BUNDLE_NAME, - key, - messageData, - defaultMessage); - } - - /** - * Return XML string representation of this object. - * @param namespaceName a namespace prefix. - * @return XML string representation of this object. - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - // Start - pw.print(toolInfo.getStartXMLString(namespaceName)); - - // Config - pw.print( - getAnalyzerConfig().toXMLString( - WSIConstants.NS_NAME_WSI_ANALYZER_CONFIG)); - - // End - pw.println(toolInfo.getEndXMLString(namespaceName)); - - return sw.toString(); - } - - /** - * Print a message. - * @param message a message. - */ - public void printMessage(String message) - { - if (getAnalyzerConfig().getVerboseOption()) - { - System.err.println(message); - } - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.properties b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.properties deleted file mode 100644 index d66cb7584..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/Analyzer.properties +++ /dev/null @@ -1,44 +0,0 @@ -# /** -# * <copyright> -# * -# * 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 -# * -# * </copyright> -# */ - -# -# Analyzer resource bundle. -# -usage01=Usage: Analyzer -config <configFilename> -created01=Conformance report has been created. -progress01=Please wait while the specified artifacts are analyzed... -error01=Analyzer Error: -error02=Analyzer Stopped By Exception: -error03=The conformance validation process failed. -exception01=Exception: -config01=Analyzer configuration file was not found. Specified file location: -config02=Could not find log file. Specified file location: -config03=Could not find WSDL file. Specified file location: -config04=Can not specify both the WSDL reference and UDDI reference options. -config05=WSDL document was either not found or could not be processed. -config06=Invalid analyzer configuration element: -config07=Both the <wsdlElement> and <wsdlURI> elements must be specified. -config08=Could not read analyzer configuration file. Specified file location: -config09=The parentElementName attribute must be specified with a WSDL type of port or operation. -config10=The -wsdlElement option must appear after the -wsdlURI or -uddiKey options. -config11=The -serviceLocation option must appear after the -wsdlURI or -uddiKey options. -config12=The specified option is not supported: -config13=Option did not contain a value. Specified option: -config14=Could not find test assertion document. Specified file location: -config15=Report file already exists and replace option was not specified. -config16=Test assertion document location must be specified. -config17=Could not get report file location. -config18=Invalid correlation type specified. -config19=The WSDL element name must be specified. diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AnalyzerContext.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AnalyzerContext.java deleted file mode 100644 index d2f53a6a8..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AnalyzerContext.java +++ /dev/null @@ -1,79 +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.internal.core.analyzer; - -/** - * This class contains contextual information which is required by test assertions across all artifacts. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class AnalyzerContext -{ - protected ServiceReference serviceReference = null; - protected CandidateInfo candidateInfo = null; - - /** - * Do not allow the usage of the null constructor. - */ - private AnalyzerContext() - { - } - - /** - * Create analyzer context with service reference. - * @param serviceReference a service reference. - */ - public AnalyzerContext(ServiceReference serviceReference) - { - this.serviceReference = serviceReference; - } - - /** - * Get service reference. - * @return service reference. - * @see #setServiceReference - */ - public ServiceReference getServiceReference() - { - return this.serviceReference; - } - - /** - * Set service reference. - * @param serviceReference a service reference. - * @see #getServiceReference - */ - public void setServiceReference(ServiceReference serviceReference) - { - this.serviceReference = serviceReference; - } - - /** - * Returns the candidateInfo. - * @return CandidateInfo. - * @see #setCandidateInfo - */ - public CandidateInfo getCandidateInfo() - { - return candidateInfo; - } - - /** - * Sets the candidateInfo. - * @param candidateInfo the candidateInfo to set. - * @see #getCandidateInfo - */ - public void setCandidateInfo(CandidateInfo candidateInfo) - { - this.candidateInfo = candidateInfo; - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionFailException.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionFailException.java deleted file mode 100644 index 8df5a2b34..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionFailException.java +++ /dev/null @@ -1,43 +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.internal.core.analyzer; - -/** - * Base Exception for Assertion Fail. - * - * @author gturrell - * */ -public class AssertionFailException extends Exception -{ - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3257007635743258933L; - - /** - * Constructor for AssertionException. - */ - public AssertionFailException() - { - super(); - } - - /** - * Constructor for AssertionException. - * @param arg0 the detail message. - */ - public AssertionFailException(String arg0) - { - super(arg0); - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionNotApplicableException.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionNotApplicableException.java deleted file mode 100644 index 6434a504d..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionNotApplicableException.java +++ /dev/null @@ -1,43 +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.internal.core.analyzer; - -/** - * Exception for Assertion Not Applicable. - * - * @author gturrell - */ -public class AssertionNotApplicableException extends Exception -{ - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3905523782994112564L; - - /** - * Constructor for AssertionNotApplicableException. - */ - public AssertionNotApplicableException() - { - super(); - } - - /** - * Constructor for AssertionNotApplicableException. - * @param arg0 the detail message. - */ - public AssertionNotApplicableException(String arg0) - { - super(arg0); - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionPassException.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionPassException.java deleted file mode 100644 index 4957d665f..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionPassException.java +++ /dev/null @@ -1,43 +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.internal.core.analyzer; - -/** - * Exception for Assertion Pass. - * - * @author gturrell - */ -public class AssertionPassException extends Exception -{ - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3257285842283541810L; - - /** - * Constructor for AssertionPAssException. - */ - public AssertionPassException() - { - super(); - } - - /** - * Constructor for AssertionPAssException. - * @param arg0 the detail message. - */ - public AssertionPassException(String arg0) - { - super(arg0); - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionResultException.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionResultException.java deleted file mode 100644 index 4e05aec49..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/AssertionResultException.java +++ /dev/null @@ -1,65 +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.internal.core.analyzer; - -/** - * Exception for Assertion Result. - * - * @author gturrell - */ -public class AssertionResultException extends Exception -{ - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3256720684700152632L; - private String detailMessage; - /** - * Constructor for AssertionresultException. - */ - public AssertionResultException() - { - super(); - detailMessage = null; - } - - /** - * Constructor for AssertionResultException. - * @param arg0 the detail message. - */ - public AssertionResultException(String arg0) - { - super(arg0); - detailMessage = null; - } - - /** - * Constructor for AssertionResultException. - * @param arg0 the detail message. - * @param arg1 further detailed message. - */ - public AssertionResultException(String arg0, String arg1) - { - super(arg0); - detailMessage = arg1; - } - - /** - * Returns the detailMessage. - * @return the detailMessage. - */ - public String getDetailMessage() - { - return detailMessage; - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/BasicProfileAnalyzer.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/BasicProfileAnalyzer.java deleted file mode 100644 index d1a936a78..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/BasicProfileAnalyzer.java +++ /dev/null @@ -1,659 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2003 IBM Corporation, Parasoft, Beacon Information Technology Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of 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 - * Parasoft - Initial API and implementation - * BeaconIT - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.analyzer; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.List; - -import javax.wsdl.WSDLException; - -import org.eclipse.wst.wsi.internal.core.ToolInfo; -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.WSIFileNotFoundException; -import org.eclipse.wst.wsi.internal.core.log.LogReader; -import org.eclipse.wst.wsi.internal.core.log.MessageEntryHandler; -import org.eclipse.wst.wsi.internal.core.profile.ProfileAssertionsReader; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.EnvelopeValidator; -import org.eclipse.wst.wsi.internal.core.profile.validator.MessageValidator; -import org.eclipse.wst.wsi.internal.core.profile.validator.UDDIValidator; -import org.eclipse.wst.wsi.internal.core.profile.validator.WSDLValidator; -import org.eclipse.wst.wsi.internal.core.report.ArtifactReference; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.report.Report; -import org.eclipse.wst.wsi.internal.core.report.ReportArtifact; -import org.eclipse.wst.wsi.internal.core.report.ReportContext; -import org.eclipse.wst.wsi.internal.core.report.ReportWriter; -import org.eclipse.wst.wsi.internal.core.report.impl.DefaultReporter; -import org.eclipse.wst.wsi.internal.core.util.ArtifactType; -import org.eclipse.wst.wsi.internal.core.util.WSIProperties; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument; -import org.eclipse.wst.wsi.internal.core.xml.XMLDocumentCache; -import org.uddi4j.transport.TransportFactory; - - -/** - * Analyzes log files to confirm conformance to a profile. - * - * @version 1.0.1 - * @author Jim Clune - * @author Peter Brittenham - * @author Graham Turrell - */ -public class BasicProfileAnalyzer extends Analyzer -{ - /** - * Tool information. - */ - public static final String TOOL_NAME = "Analyzer"; - - /** - * WSDL document to analyze. - */ - protected WSDLDocument wsdlDocument = null; - - /** - * Basic profile analyzer. - * @param args command line arguments. - * @throws WSIException if unable to create a Basic profile analyzer. - */ - public BasicProfileAnalyzer(String[] args) throws WSIException - { - super(args, new ToolInfo(TOOL_NAME)); - new XMLDocumentCache(); - } - - /** - * Basic profile analyzer. - * @param args command line arguments. - * @param validate flag for command line argument validation. - * @throws WSIException if unable to create a Basic profile analyzer. - */ - public BasicProfileAnalyzer(String[] args, boolean validate) throws WSIException - { - super(args, new ToolInfo(TOOL_NAME), validate); - new XMLDocumentCache(); - } - - /** - * Basic profile analyzer. - * @param analyzerConfigList a list of configurations for the analyzer. - * @throws WSIException if unable to create a Basic profile analyzer. - */ - public BasicProfileAnalyzer(List analyzerConfigList) throws WSIException - { - super(analyzerConfigList, new ToolInfo(TOOL_NAME)); - new XMLDocumentCache(); - } - - /** - * Basic profile analyzer. - * @param analyzerConfigList a list of configurations for the analyzer. - * @param wsdlURI a wsdl document location. - * @throws WSIException if unable to create a Basic profile analyzer. - */ - public BasicProfileAnalyzer(List analyzerConfigList, String wsdlURI) - throws WSIException - { - super(analyzerConfigList, new ToolInfo(TOOL_NAME)); - new XMLDocumentCache(); - - try - { - // Get the WSDL document - if (wsdlURI != null) - this.wsdlDocument = new WSDLDocument(wsdlURI); - } - - catch (WSDLException we) - { - throw new WSIException(we.getMessage(), we); - } - - } - - /** - * Process all conformance validation functions. - * @return status code. - * @throws WSIException if conformance validation process failed. - */ - public int validateConformance() throws WSIException - { - int statusCode = 0; - - Report report = null; - ReportArtifact reportArtifact = null; - String wsdlURI = null; - //WSDLDocument wsdlDocument = null; - - // Set up initial analyzer context based on entries in the config file - this.analyzerContext = - new AnalyzerContext(new ServiceReference(getAnalyzerConfig())); - - try - { - // Read profile assertions - ProfileAssertionsReader profileAssertionsReader = - documentFactory.newProfileAssertionsReader(); - this.profileAssertions = - profileAssertionsReader.readProfileAssertions( - getAnalyzerConfig().getTestAssertionsDocumentLocation()); - - // Create report from document factory - report = documentFactory.newReport(); - report.setLocation(getAnalyzerConfig().getReportLocation()); - - // Create report context - ReportContext reportContext = - new ReportContext( - WSIConstants.DEFAULT_REPORT_TITLE, - profileAssertions, - this); - report.setReportContext(reportContext); - - // Create report writer - ReportWriter reportWriter = documentFactory.newReportWriter(); - // I18N: 2003.02.26 modified by K.Nakagome@BeaconIT - //reportWriter.setWriter(new FileWriter(analyzerConfig.getReportLocation())); - reportWriter.setWriter(getAnalyzerConfig().getReportLocation()); - - // Create reporter - this.reporter = new DefaultReporter(report, reportWriter); - - // Start writing report - this.reporter.startReport(); - - // -------------------------------- - // DISCOVERY ARTIFACT: - // -------------------------------- - - // Set current artifact - reportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_DISCOVERY); - - // If UDDI options specified, then process UDDI test assertions - if ((wsdlURI = validateUDDI(reportArtifact, factory.newUDDIValidator())) - == null) - { - if (getAnalyzerConfig().isWSDLReferenceSet()) - { - // Otherwise use the WSDL options to get the WSDL location - wsdlURI = getAnalyzerConfig().getWSDLLocation(); - } - } - - // Indicate that we are done with this artifact - this.reporter.endCurrentArtifact(); - - // -------------------------------- - // DESCRIPTION ARTIFACT: - // -------------------------------- - - // Set current artifact - reportArtifact = - setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_DESCRIPTION); - - // Call WSDLValidator - wsdlDocument = - validateWSDL( - reportArtifact, - factory.newWSDLValidator(), - wsdlURI, - wsdlDocument); - - // If WSDL document object is null, then throw exception - if ((wsdlDocument == null) && (getAnalyzerConfig().isWSDLReferenceSet())) - { - throw new WSIException( - messageList.getMessage( - "config05", - "WSDL document was either not found or could not be processed.")); - } - - // Indicate that we are done with this artifact - this.reporter.endCurrentArtifact(); - - // REMOVE: - // If processing log entries and there isn't a WSDL URI, - // then throw an exception since it is required to process the log entries - //if ((wsdlURI == null) && (analyzerConfig.getLogLocation() != null)) { - // throw new WSIException("Must specify the WSDL document location to validate message log."); - //} - - // -------------------------------- - // MESSAGE ARTIFACT: - // -------------------------------- - - // Set current artifact - reportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_MESSAGE); - - // Process test assertions for the messages - validateMessages( - reportArtifact, - factory.newMessageValidator(), - wsdlDocument); - - // Indicate that we are done with this artifact - this.reporter.endCurrentArtifact(); - - // -------------------------------- - // ENVELOPE ARTIFACT: - // -------------------------------- - - // If that is not the Basic Profile 1.0, then process - // the envelope artifact - if (!profileAssertions.getTADName() - .equals(WSIConstants.BASIC_PROFILE_TAD_NAME)) - { - - // Set current artifact - reportArtifact = setCurrentArtifact(ArtifactType.ARTIFACT_TYPE_ENVELOPE); - - // Process test assertions for the envelopes - validateEnvelopes( - reportArtifact, - factory.newEnvelopeValidator(), - wsdlDocument); - - // Indicate that we are done with this artifact - this.reporter.endCurrentArtifact(); - } - - // Finish the conformance report - reporter.finishReport(); - } - - catch (Exception e) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String message = - messageList.getMessage( - "error03", - "The conformance validation process failed."); - - // Finish report - if (reporter != null) - { - pw.println(message); - pw.println( - messageList.getMessage("exception01", "Exception: ") - + e.getClass().getName()); - e.printStackTrace(pw); - reporter.finishReportWithError(sw.toString()); - } - - if (e instanceof WSIException) - throw (WSIException) e; - else - throw new WSIException(message, e); - } - - if (report != null) - { - statusCode = - (report.getSummaryResult().equals(AssertionResult.RESULT_PASSED) - ? 0 - : 1); - } - - return statusCode; - } - - /** - * Run UDDI test assertions. - */ - private String validateUDDI( - ReportArtifact reportArtifact, - UDDIValidator uddiValidator) - throws WSIException - { - String wsdlURI = null; - - // Init UDDIValidator - uddiValidator.init( - this.analyzerContext, - this.profileAssertions.getArtifact(ArtifactType.TYPE_DISCOVERY), - reportArtifact, - getAnalyzerConfig().getUDDIReference(), - this.reporter); - - // Call UDDIValidator - if (getAnalyzerConfig().isUDDIReferenceSet()) - { - wsdlURI = uddiValidator.validate(); - - // Cleanup - uddiValidator.cleanup(); - } - - else - { - // Set all missingInput - uddiValidator.setAllMissingInput(); - } - - return wsdlURI; - } - - /** - * Run WSDL test assertions. - */ - private WSDLDocument validateWSDL( - ReportArtifact reportArtifact, - WSDLValidator wsdlValidator, - String wsdlURI, - WSDLDocument document) - throws WSIException - { - WSDLDocument returnWSDLDocument = null; - - // Init WSDLValidator - wsdlValidator.init( - this.analyzerContext, - this.profileAssertions.getArtifact(ArtifactType.TYPE_DESCRIPTION), - reportArtifact, - wsdlURI, - document, - this.reporter); - - // If a WSDL URI was specified or located in a UDDI registry, then process the WSDL tests - if (wsdlURI != null || document != null) - { - // Call WSDLValidator - returnWSDLDocument = wsdlValidator.validate(); - - // Cleanup - wsdlValidator.cleanup(); - } - - else - { - // Set all missingInput - wsdlValidator.setAllMissingInput(); - } - - return returnWSDLDocument; - } - - /** - * Run message test assertions. - */ - private void validateMessages( - ReportArtifact reportArtifact, - MessageValidator messageValidator, - WSDLDocument document) - throws WSIException - { - //Log log = null; - //MessageEntry logEntry = null; - - // Init MessageValidator - messageValidator.init( - this.analyzerContext, - this.profileAssertions.getArtifact(ArtifactType.TYPE_MESSAGE), - reportArtifact, - document, - this.reporter); - - // If the log file location was specified, then process test assertions for the messages - if (getAnalyzerConfig().getLogLocation() != null) - { - // Get the log file reader - LogReader logReader = documentFactory.newLogReader(); - - // Create log reader callback - MessageProcessor messageProcessor = - new MessageProcessor(messageValidator); - - // Start reading the log file - logReader.readLog(getAnalyzerConfig().getLogLocation(), messageProcessor); - - // Cleanup - messageValidator.cleanup(); - } - - // Otherwise all are missingInput - else - { - // Set all missingInput - messageValidator.setAllMissingInput(); - } - } - - /** - * Run envelope test assertions. - */ - private void validateEnvelopes( - ReportArtifact reportArtifact, - EnvelopeValidator envelopeValidator, - WSDLDocument document) - throws WSIException - { - // Init envelopeValidator - envelopeValidator.init( - this.analyzerContext, - this.profileAssertions.getArtifact(ArtifactType.TYPE_ENVELOPE), - reportArtifact, - document, - this.reporter); - - // If the log file location was specified, then process test assertions for the messages - if (getAnalyzerConfig().getLogLocation() != null) - { - // Get the log file reader - LogReader logReader = documentFactory.newLogReader(); - - // Create log reader callback - EnvelopeProcessor envelopeProcessor = - new EnvelopeProcessor(envelopeValidator); - - // Start reading the log file - logReader.readLog(getAnalyzerConfig().getLogLocation(), envelopeProcessor); - - // Cleanup - envelopeValidator.cleanup(); - } - - // Otherwise all are missingInput - else - { - // Set all missingInput - envelopeValidator.setAllMissingInput(); - } - } - - /** - * Command line interface for the analyzer tool. - * @param args command line arguments. - * @throws IOException if IO problems occur. - */ - public static void main(String[] args) throws IOException - { - int statusCode = 0; - Analyzer analyzer = null; - - try - { - // Set document builder factory class - System.setProperty( - WSIProperties.PROP_JAXP_DOCUMENT_FACTORY, - WSIProperties.getProperty(WSIProperties.PROP_JAXP_DOCUMENT_FACTORY)); - - // Set the system property for UDDI4J transport - System.setProperty( - TransportFactory.PROPERTY_NAME, - WSIProperties.getProperty(TransportFactory.PROPERTY_NAME)); - - // Create the analyzer object - analyzer = new BasicProfileAnalyzer(args); - - // Have it process the conformance validation functions - statusCode = analyzer.validateConformance(); - - // Display message - analyzer.printMessage( - "created01", - null, - "Conformance report has been created."); - } - - catch (Exception e) - { - statusCode = 1; - - String messageID; - String defaultMessage; - String messageData; - - if ((e instanceof WSIFileNotFoundException) - || (e instanceof IllegalArgumentException)) - { - //printStackTrace = false; - messageID = "error01"; - defaultMessage = "Analyzer Error:"; - messageData = e.getMessage(); - } - - else - { - //printStackTrace = true; - messageID = "error02"; - defaultMessage = "Analyzer Stopped By Exception:"; - messageData = e.toString(); - } - - if (analyzer != null) - analyzer.printMessage(messageID, messageData, defaultMessage); - else - Analyzer.staticPrintMessage(messageID, messageData, defaultMessage); - - if (analyzer != null - && analyzer.getAnalyzerConfig() != null - && analyzer.getAnalyzerConfig().getVerboseOption()) - dump(e); - } - - // Exit - System.exit(statusCode); - } - - /** - * Set current artifact. - * @param artifactType an ArtifactType object. - * @return a ReportArtifact object. - * @throws WSIException if problems creating report artifact. - */ - protected ReportArtifact setCurrentArtifact(ArtifactType artifactType) - throws WSIException - { - // Create artifact - ReportArtifact reportArtifact = reporter.createArtifact(); - reportArtifact.setType(artifactType); - - // Add artifact to report - this.reporter.setCurrentArtifact(reportArtifact); - - return reportArtifact; - } - - /** - * Print exception. - * @param t a Throwable object. - */ - public static void dump(Throwable t) - { - while (t instanceof WSIException) - { - Throwable nested = ((WSIException) t).getTargetException(); - if (nested == null) - break; - else - t = nested; - } - t.printStackTrace(); - } - - /** - * Message processor class. - */ - class MessageProcessor implements MessageEntryHandler - { - MessageValidator messageValidator = null; - - /** - * Create message processor as a log reader callback function. - */ - MessageProcessor(MessageValidator messageValidator) - { - this.messageValidator = messageValidator; - } - - /** - * Process artifact reference. - */ - public void processArtifactReference(ArtifactReference artifactReference) - throws WSIException - { - reporter.addArtifactReference(artifactReference); - } - - /** - * Process a single log entry. - */ - public void processLogEntry(EntryContext entryContext) throws WSIException - { - // Validate message - messageValidator.validate(entryContext); - } - - } - - /** - * Envelope processor class. - */ - class EnvelopeProcessor implements MessageEntryHandler - { - EnvelopeValidator envelopeValidator = null; - - /** - * Create envelope processor as a log reader callback function. - */ - EnvelopeProcessor(EnvelopeValidator envelopeValidator) - { - this.envelopeValidator = envelopeValidator; - } - - /** - * Process artifact reference. - */ - public void processArtifactReference(ArtifactReference artifactReference) - throws WSIException - { - reporter.addArtifactReference(artifactReference); - } - - /** - * Process a single log entry. - */ - public void processLogEntry(EntryContext entryContext) throws WSIException - { - // Validate envelopes - envelopeValidator.validate(entryContext); - } - - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/CandidateInfo.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/CandidateInfo.java deleted file mode 100644 index 553cbee39..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/CandidateInfo.java +++ /dev/null @@ -1,918 +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.internal.core.analyzer; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; - -import javax.wsdl.Binding; -import javax.wsdl.Definition; -import javax.wsdl.Fault; -import javax.wsdl.Import; -import javax.wsdl.Message; -import javax.wsdl.Operation; -import javax.wsdl.Port; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.Types; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.soap.SOAPAddress; -import javax.xml.namespace.QName; - -import org.apache.xerces.util.URI; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLUtils; - -/** - * Provide a normalized set of data relating to the service under test. - * For example, with endpoint correlation and wsdlElement of type "message" - * there could be multiple matches for most element types including WSDL Service. - * (though the objective is to ensure filtering to a single service if at all possible). - * - * @author gturrell - */ - -// ADD:could be better as a singleton? - -public class CandidateInfo -{ - - // Normalized fixed correlation data derived from the analyzer config and the wsdl, - // representing what we know about the service from these two sources. - private Definition[] definitions = null; - - private Import[] imports = null; - private Types[] types = null; - - private Message[] messages = null; - private Operation[] operations = null; - private PortType[] portTypes = null; - private Binding[] bindings = null; - private Port[] ports = null; - - private URI[] endPoints = null; // list obtainable from a port - - private WSDLDocument wsdlDocument; // reference probably not desirable here - - /** - * Constructor for CandidateInfo. - * Extract normalised entry data from wsdl, according to config wsdlElement & serviceLocation - * @param serviceReference a ServiceReference object. - * @param wsdlDocument a WSDL document. - * @throws WSIException if problems occur creating CandidateInfo object. - */ - public CandidateInfo( - ServiceReference serviceReference, - WSDLDocument wsdlDocument) - throws WSIException - { - - // ADD: check for null document? - - WSDLElement wsdlElement = serviceReference.getWSDLElement(); - - this.wsdlDocument = wsdlDocument; - - /* - * Generalised fields independent of wsdlElement: - */ - // ADD: check whether these need to be either expanded or filtered down. - // Assume WSDL4J pulls int the full tree at the root document for now - //this.imports = wsdlDocument.getImports(); - - // ... or if only down to first level.... - this.imports = - (Import[]) getAllImports( - wsdlDocument.getDefinitions()).toArray(new Import[] { - }); - - /* Definitions. - * Note that the the first array element is for the root doc - * which contains all WSDL elements in scope via <import> declarations, - * as well as the root document itself. Therefore the second definitions - * array element and above are redundant, but *may* prove useful to the assertion - * code. - */ - - this.definitions = new Definition[imports.length + 1]; - // allow room for root doc - - this.definitions[0] = wsdlDocument.getDefinitions(); // root document - - // Allocate array for types elements - Types[] tempTypes = new Types[definitions.length]; - - int typesCount = 0; - - if (definitions[0].getTypes() != null) - { - tempTypes[0] = this.definitions[0].getTypes(); // root document - typesCount++; - } - - // Definitions from other (imported) wsdls correlating to the candidate - // Only one level down for now - for (int i = 0; i < imports.length; i++) - { - if (((definitions[i + 1] = imports[i].getDefinition()) != null) - && (definitions[i + 1].getTypes() != null)) - { - tempTypes[typesCount] = definitions[i + 1].getTypes(); - typesCount++; - } - } - - if (typesCount > 0) - { - this.types = new Types[typesCount]; - - for (int i = 0; i < typesCount; i++) - this.types[i] = tempTypes[i]; - } - /* - * Populate element hierachy: - * Port - * Binding - * PortType - * operation(s) - * message(s) - */ - - if (wsdlElement.isPort()) - { - - Port port = null; - - // Use parentElementName to qualify the port within a service. - QName serviceName = wsdlElement.getParentElementQName(); - Service[] s = wsdlDocument.getServices(); - String portName = wsdlElement.getName(); - for (int i = 0; i < s.length && port == null; i++) - { - if (s[i].getQName().equals(serviceName)) - { - port = s[i].getPort(portName); - } - } - - if (port == null) - { - throw new WSIException( - "WSDL Port \'" - + portName - + "\' for Service \'" - + serviceName - + "\' not found in service description"); - } - else - { - this.ports = new Port[] { port }; - // ADD: do serviceLocation check for soapbind:address? - descendents(port); - } - - // ADD: the following could be instantiated here instead to refine context info - // definitions - // imports - // types - - } - - else if (wsdlElement.isBinding()) - { - if (wsdlElement.getQName() != null - && wsdlElement.getQName().getLocalPart() != null - && wsdlElement.getQName().getLocalPart().length() > 0) - { - Binding binding = - wsdlDocument.getDefinitions().getBinding(wsdlElement.getQName()); - - if (binding == null) - { - throw new WSIException( - "WSDL Binding named \'" - + wsdlElement.getQName() - + "\' not found in service description"); - } - else - { - this.bindings = new Binding[] { binding }; - - // the rest ... below binding: - // portTypes from binding - // operations from portTypes - // messages from operations - descendents(binding); - - // above binding: - // ports - // definitions, imports, types (future?) - // ancestors(bindings); - } - } - } - - else if (wsdlElement.isPortType()) - { - - PortType portType = - wsdlDocument.getDefinitions().getPortType(wsdlElement.getQName()); - this.portTypes = new PortType[] { portType }; - - if (portType == null) - { - throw new WSIException( - "WSDL PortType named \'" - + wsdlElement.getQName() - + "\' not found in service description"); - } - else - { - this.portTypes = new PortType[] { portType }; - // the rest ... below portType: - descendents(portType); - - // above portType: - // ports - // definitions, imports, types (future) ? - //ancestors(portTypes); - } - } - else if (wsdlElement.isOperation()) - { - - Operation operation = null; - String configOpName = wsdlElement.getName(); - - // Use parentElementName to qualify the operation within a portType. - QName portTypeName = wsdlElement.getParentElementQName(); - PortType[] p = wsdlDocument.getPortTypes(); - for (int i = 0; i < p.length && operation == null; i++) - { - if (p[i].getQName().equals(portTypeName)) - { - // wsdl4j available method call below implies that only - // name+inputname+outputname uniquely defines operation! - // Since we do not have <input> & <output> name information - // available in the config, use this instead for now: - - // Get the first operation we find: - Iterator opIt = p[i].getOperations().iterator(); - Operation op = null; - while (opIt.hasNext() && operation == null) - { - op = (Operation) opIt.next(); - if (configOpName.equals(op.getName())) - { - operation = op; - } - } - } - } - - if (operation == null) - { - throw new WSIException( - "No WSDL Operation named \'" - + wsdlElement.getQName() - + "\' found in service description"); - } - else - { - this.operations = new Operation[] { operation }; - - descendents(operation); - //ancestors(operations); - } - } - - else if (wsdlElement.isMessage()) - { - - Message message = - wsdlDocument.getDefinitions().getMessage(wsdlElement.getQName()); - if (message == null) - { - throw new WSIException( - "No WSDL Message named \'" - + wsdlElement.getQName() - + "\' found in service description"); - } - else - { - this.messages = new Message[] { message }; - - //ancestors(messages); - } - } - - else - { - throw new WSIException( - "Unrecognised <WSDLElement type> in config: " + wsdlElement.getType()); - } - - // get info about the effective service location (s) - //this.endPoints = deriveEndpoints(analyzerConfig, this.ports, this.definitions); - this.endPoints = - deriveEndpoints(serviceReference, this.ports, this.definitions); - } - - /** - * ancestor code is not used at present. - * - */ - /* - protected void ancestors(Port[] ports) { - // no ancestors of Port required (for now) - } - protected void ancestors(Binding[] bindings) { - // Ports from Bindings 1-2-1 - - // *** cheat for now - get ports from all services in the wsdl doc - // ADD: find correct mapping based on the supplied bindings - Service[] service = wsdlDocument.getServices(); - HashSet set = new HashSet(); - for (int i=0; i>service.length; i++) { - set.add(service[i].getPorts()); - } - - // assign the parent group and process the grandparents if any - ancestors(this.ports = (Port[])set.toArray(this.ports = new Port[0])); - } - protected void ancestors(PortType[] portTypes) { - // Bindings from PortTypes 1-2-1 - - // add have to start with all bindings in doc and search for those - // with the portType - HashSet set = new HashSet(); - for (int i=0; i>portTypes.length; i++) { - // set.add(portTypes[i].get()); - } - - // assign the parent group and process the grandparents if any - ancestors(this.bindings = (Binding[])set.toArray(this.bindings = new Binding[0])); - } - protected void ancestors(Operation[] operations) { - // PortTypes from Operations 1-2-1 - - HashSet set = new HashSet(); - for (int i=0; i>operations.length; i++) { - // set.add(operations[i].get()); - } - - // assign the parent group and process the grandparents if any - ancestors(this.portTypes = (PortType[])set.toArray(this.portTypes = new PortType[0])); - } - protected void ancestors(Message[] messages) { - // Operations from Messages 1-2-1 - // ADD fix it! - HashSet set = new HashSet(); - for (int i=0; i>messages.length; i++) { - // set.add(messages[i].get()); - } - - // assign the parent group - this.portTypes = (PortType[])set.toArray(this.portTypes = new PortType[0]); - } - */ - - /** - * Descendant method for completing candidate service context creation. - * @param port a Port object - * @throws WSIException if port is null. - */ - protected void descendents(Port port) throws WSIException - { - // Binding from Port 1-2-1 - - if (port == null) - { - throw new WSIException("Internal error: expected a Port value"); - } - else - { - this.bindings = new Binding[] { port.getBinding()}; - if (this.bindings[0] != null) - { - /* Assign the child group and process the grandchildren if any. - * Null argument value passed into the following method would - * suggest a WSDL definition inconsistency - * which will be picked up during Description Artifact TA testing. - */ - descendents(this.bindings[0]); - } - } - } - - /** - * Descendant method for completing candidate service context creation. - * @param binding a Binding object - * @throws WSIException if binding is null. - */ - protected void descendents(Binding binding) throws WSIException - { - // portType from Binding 1-2-1 - - if (binding == null) - { - throw new WSIException("Internal error: expected a Binding value"); - } - else - { - this.portTypes = new PortType[] { binding.getPortType()}; - if (this.portTypes[0] != null) - { - /* Assign the child group and process the grandchildren if any. - * Null argument value passed into the following method would - * suggest a WSDL definition inconsistency - * which will be picked up during Description Artifact TA testing. - */ - descendents(this.portTypes[0]); - - // Get any messages that are referenced from headers and headerfaults - - // Get reference to definition - Definition definition = definitions[0]; - - // If there are messages already, then get them as a collection - HashSet messageSet = new HashSet(); - if (messages != null) - { - for (int i = 0; i < messages.length; i++) - { - messageSet.add(messages[i]); - } - } - - // Get the messages that are referenced only by a binding - HashSet bindingMessages = WSDLUtils.findMessages(definition, binding); - - // Add these messages to the complete message list - messageSet.addAll(bindingMessages); - - // Create array from message set - this.messages = - (Message[]) messageSet.toArray(this.messages = new Message[0]); - } - } - } - - /** - * Descendant method for completing candidate service context creation. - * @param portType a PortType object - * @throws WSIException if portType is null. - */ - protected void descendents(PortType portType) throws WSIException - { - // Operations from PortType 1-2-n - - if (portType == null) - { - throw new WSIException("Internal error: expected a PortType value"); - } - else - { - this.operations = - (Operation[]) (portType - .getOperations() - .toArray(this.operations = new Operation[0])); - if (this.operations.length > 0) - { - descendents(this.operations); - } - } - } - - /** - * Descendant method for completing candidate service context creation. - * @param operation a Operation object - * @throws WSIException if operation is null. - */ - protected void descendents(Operation operation) throws WSIException - { - // Messages from Operation - - if (operation == null) - { - throw new WSIException("Internal error: expected an Operation value"); - } - else - { - descendents(new Operation[] { operation }); - } - } - - /** - * Descendant method for completing candidate service context creation. - * @param operations an array of operations. - * @throws WSIException if operations is null. - */ - protected void descendents(Operation[] operations) throws WSIException - { - // Messages from Operations 1-2-n - - if (operations == null) - { - throw new WSIException("Internal error: expected an Operation[] value"); - } - - HashSet set = new HashSet(); - for (int i = 0; i < operations.length; i++) - { - if (operations[i].getInput() != null) - set.add(operations[i].getInput().getMessage()); //1-2-1 - if (operations[i].getOutput() != null) - set.add(operations[i].getOutput().getMessage()); //1-2-1 - - // get messages associated with faults for this operation - // 1-2-n - Iterator it = operations[i].getFaults().values().iterator(); - while (it.hasNext()) - { - set.add(((Fault) it.next()).getMessage()); - } - } - this.messages = (Message[]) set.toArray(this.messages = new Message[0]); - // no descendents of messages so stop. - } - - /** - * Provide a recursive non-repeating list of imports for the specified - * WSDL document definition. - */ - /* private HashSet getAllImports(Definition rootDef) throws WSIException { - - HashSet importSet = new HashSet(); - - Collection importList = rootDef.getImports().values(); - Iterator i = importList.iterator(); - - while (i.hasNext()) { - Import nextImport = (Import)(i.next()); - if (nextImport != null) { - // its a wsdl document - importSet.addAll(getAllImports(nextImport.getDefinition())); - } - } - - return (importSet); - } - */ - private HashSet getAllImports(Definition rootDef) throws WSIException - { - - HashSet importSet = new HashSet(); - - Map importMap = rootDef.getImports(); - Iterator i = importMap.values().iterator(); - - while (i.hasNext()) - { - List nextImportList = (List) (i.next()); - Iterator listIt = nextImportList.iterator(); - while (listIt.hasNext()) - { - Import nextImport = (Import) listIt.next(); - if (nextImport != null) - { - // its a wsdl document - importSet.add(nextImport); - if (nextImport.getDefinition() != null) - { - HashSet subTreeImports = getAllImports(nextImport.getDefinition()); - Iterator subIt = subTreeImports.iterator(); - while (subIt.hasNext()) - { - importSet.add((Import) (subIt.next())); - } - } - } - } - } - - return (importSet); - } - - /** - * get all service location endpoint values - * relevant to the service under test. - * - * If the service location is specified in the config we use - * just that. - * Otherwise, if the port is specified, we get all endpoints - * associated with that port. - * If we have neither the service location value or the port, - * then all endpoints in the definition are used. - */ - private URI[] deriveEndpoints( - //AnalyzerConfig analyzerConfig, - ServiceReference serviceReference, Port[] ports, Definition[] definitions) - { - - URI[] endp = null; - //Port port = null; - try - { - String serviceLocation = null; - // try service location... - //if ((serviceLocation = analyzerConfig.getServiceLocation()) != null) { - if ((serviceLocation = serviceReference.getServiceLocation()) != null) - { - endp = new URI[] { new URI(serviceLocation)}; - } - //else if (analyzerConfig.getWSDLElement().isPort()) { - else if (serviceReference.getWSDLElement().isPort()) - { - if (ports.length != 1) - { - throw new WSIException("Internal error - expected 1-element Port array"); - } - //else { - // port = ports[0]; // if Port was given in config, there is just one - //} - //QName soapAddress = new QName(WSIConstants.NS_URI_WSDL_SOAP, "address"); - Iterator i = ports[0].getExtensibilityElements().iterator(); - while (i.hasNext() && serviceLocation == null) - { - ExtensibilityElement extElem = (ExtensibilityElement) i.next(); - if (extElem instanceof SOAPAddress) - { - //if (extEl.getElementType().equals(soapAddress) { - // this element is our SOAPAddress - get the location - serviceLocation = ((SOAPAddress) extElem).getLocationURI(); - endp = new URI[] { new URI(serviceLocation)}; - } - } - } - else - { // no port info from config, so supply all in document - // QName soapAddress = new QName(WSIConstants.NS_URI_WSDL_SOAP, "address"); - HashSet endpointSet = new HashSet(); - Iterator i = definitions[0].getExtensibilityElements().iterator(); - while (i.hasNext()) - { - ExtensibilityElement extElem = (ExtensibilityElement) i.next(); - if (extElem instanceof SOAPAddress) - { - //if (extEl.getElementType().equals(soapAddress) { - // this element is our SOAPAddress - get the location - endpointSet.add(((SOAPAddress) extElem).getLocationURI()); - } - } - // Convert the derived List to a URI array - endp = (URI[]) endpointSet.toArray(endp = new URI[0]); - } - } - catch (Exception e) - { - } - return endp; - } - - /** - * Returns the binding. - * @return Binding - */ - public Binding[] getBindings() - { - return bindings; - } - - /** - * Returns the endPoints. - * @return URI[] - */ - public URI[] getEndPoints() - { - // get list of matching endpoint(s) associated with service. - return endPoints; - } - - /** - * Returns the endPoints matching the specified host and port. - * @param hostAndPort host and port location. - * @return URI[] if matched, null otherwise. - */ - public URI[] getEndPoints(String hostAndPort) - { - // get list of matching endpoints associated with service, - // having the specified host and port configuration - String port; - - Vector matchedEndpoints = new Vector(); - for (int i = 0; i < endPoints.length; i++) - { - // PB: If the endpoint does not contain a port number, then default it to "80" - port = - (endPoints[i].getPort() == -1) - ? "80" - : String.valueOf(endPoints[i].getPort()); - if (hostAndPort.equals(endPoints[i].getHost() + ":" + port)) - { - matchedEndpoints.add(endPoints[i]); - } - } - return (URI[]) matchedEndpoints.toArray(new URI[0]); - } - - /** - * Returns the operation. - * @return Operation - */ - public Operation[] getOperations() - { - return operations; - } - - /** - * Returns the portType. - * @return PortType - */ - public PortType[] getPortType() - { - return portTypes; - } - - /** - * Returns true if the hostAndPort matches at least one context endpoint. - * @param hostAndPortString a host and port location. - * @return true if the hostAndPort matches at least one context endpoint. - * @throws WSIException if given hostandPort String does not convert to URI. - */ - public boolean hasHostAndPort(String hostAndPortString) throws WSIException - { - URI hostAndPort; - try - { - hostAndPort = new URI(hostAndPortString); - } - catch (Exception e) - { - throw new WSIException( - "Could not convert string to URI: " + hostAndPortString); - } - String host = hostAndPort.getHost(); - int port = hostAndPort.getPort(); - for (int i = 0; i < this.endPoints.length; i++) - { - if (this.endPoints[i].getHost().equals(host) - && this.endPoints[i].getPort() == port) - { - return true; - } - } - return false; // for now - } - - /** - * Returns the definitions. - * @return Definition[] - */ - public Definition[] getDefinitions() - { - return definitions; - } - - /** - * Returns the imports. - * @return Import[] - */ - public Import[] getImports() - { - return imports; - } - - /** - * Returns the messages. - * @return Message[] - */ - public Message[] getMessages() - { - return messages; - } - - /** - * Returns the ports. - * @return Port[] - */ - public Port[] getPorts() - { - return ports; - } - - /** - * Returns the portTypes. - * @return PortType[] - */ - public PortType[] getPortTypes() - { - return portTypes; - } - - /** - * Returns the types. - * @return Types[] - */ - public Types[] getTypes() - { - return types; - } - /** - * Returns the wsdlDocument. - * @return WSDLDocument - */ - public WSDLDocument getWsdlDocument() - { - return wsdlDocument; - } - - /** - * Return the definition element that contains the types element. - * @param types a Types object. - * @return the definition element that contains the types element. - */ - public Definition getDefinition(Types types) - { - Definition definition = null; - Types checkTypes; - - for (int i = 0; i < definitions.length && definition == null; i++) - { - if (((checkTypes = definitions[i].getTypes()) != null) - && (checkTypes.equals(types))) - { - definition = definitions[i]; - } - } - - return definition; - } - - /** - * Return the definition element that contains the binding element. - * @param binding a Binding object. - * @return the definition element that contains the binding element. - */ - public Definition getDefinition(Binding binding) - { - Definition definition = null; - - for (int i = 0; i < definitions.length && definition == null; i++) - { - if (definitions[i].getBinding(binding.getQName()) != null) - definition = definitions[i]; - } - - return definition; - } - - /** - * Return the definition element that contains the portType element. - * @param portType a PortType object. - * @return the definition element that contains the portType element. - */ - public Definition getDefinition(PortType portType) - { - Definition definition = null; - - for (int i = 0; i < definitions.length && definition == null; i++) - { - if (definitions[i].getPortType(portType.getQName()) != null) - definition = definitions[i]; - } - - return definition; - } - - /** - * Return the definition element that contains the message. - * @param message a Message object. - * @return the definition element that contains the message. - */ - public Definition getDefinition(Message message) - { - Definition definition = null; - - for (int i = 0; i < definitions.length && definition == null; i++) - { - if (definitions[i].getMessage(message.getQName()) != null) - definition = definitions[i]; - } - - return definition; - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/EnvironmentInfo.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/EnvironmentInfo.java deleted file mode 100644 index 3f3eb4d1c..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/EnvironmentInfo.java +++ /dev/null @@ -1,83 +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.internal.core.analyzer; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.util.XMLInfo; - -/** - * This class maintains the Environment information. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class EnvironmentInfo implements XMLInfo -{ - /** - * Log timestamp. - */ - protected String logTimestamp = null; - - /** - * Monitor config comment. - */ - protected String monitorConfigComment = null; - - /** - * Create object. - * @param logTimestamp the log timestamp. - * @param monitorConfigComment the Monitor config comment. - */ - public EnvironmentInfo(String logTimestamp, String monitorConfigComment) - { - this.logTimestamp = logTimestamp; - this.monitorConfigComment = monitorConfigComment; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.util.XMLInfo#toXMLString(String) - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if (!nsName.equals("")) - nsName += ":"; - - // Start element - pw.print(" <" + nsName + WSIConstants.ELEM_LOG + " "); - pw.println( - WSIConstants.ATTR_TIMESTAMP + "=\"" + this.logTimestamp + "\"/>"); - - pw.print( - " <" - + WSIConstants.NS_NAME_WSI_LOG - + WSIConstants.ELEM_COMMENT - + ">"); - pw.print(this.monitorConfigComment); - pw.println( - " </" - + WSIConstants.NS_NAME_WSI_LOG - + WSIConstants.ELEM_COMMENT - + ">"); - - // End element - pw.println(" </" + nsName + WSIConstants.ELEM_LOG + ">"); - - return sw.toString(); - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/ServiceReference.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/ServiceReference.java deleted file mode 100644 index 773e484ff..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/ServiceReference.java +++ /dev/null @@ -1,109 +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.internal.core.analyzer; - -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; - -/** - * This class contains all of the information that is needed to process description test assertions. The infromation - * in this object will be derived from analyzer configuration information, UDDI entries, or the WSDL port element. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class ServiceReference -{ - protected WSDLElement wsdlElement; - protected String wsdlLocation; - protected String serviceLocation; - - /** - * Create service reference without references. All of them will be set later as test assertions are - * being processed. - */ - public ServiceReference() - { - } - - /** - * Create service reference from entries specified in the analyzer config file. This information may include - * the information extracted from the wsdlElement, wsdlURI and serviceLocation elements. - * @param analyzerConfig an AnalyzerConfig object. - */ - public ServiceReference(AnalyzerConfig analyzerConfig) - { - this.wsdlElement = analyzerConfig.getWSDLElement(); - this.wsdlLocation = analyzerConfig.getWSDLLocation(); - this.serviceLocation = analyzerConfig.getServiceLocation(); - - } - - /** - * Get the WSDL element where analysis should begin. - * @return he WSDL element where analysis should begin. - * @see #setWSDLElement - */ - public WSDLElement getWSDLElement() - { - return this.wsdlElement; - } - - /** - * Set the WSDL element where analysis should begin. - * @param wsdlElement the WSDL element where analysis should begin. - * @see #getWSDLElement - */ - public void setWSDLElement(WSDLElement wsdlElement) - { - this.wsdlElement = wsdlElement; - } - - /** - * Get WSDL document location. - * @return WSDL document location. - * @see #setWSDLLocation - */ - public String getWSDLLocation() - { - return this.wsdlLocation; - } - - /** - * Set WSDL document location. - * @param wsdlLocation WSDL document location. - * @see #getWSDLLocation - */ - public void setWSDLLocation(String wsdlLocation) - { - this.wsdlLocation = wsdlLocation; - } - - /** - * Get Web service location. - * @return Web service location. - * @see #setServiceLocation - */ - public String getServiceLocation() - { - return this.serviceLocation; - } - - /** - * Set Web service location. - * @param serviceLocation eb service location. - * @see #getServiceLocation - */ - public void setServiceLocation(String serviceLocation) - { - this.serviceLocation = serviceLocation; - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfig.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfig.java deleted file mode 100644 index 14a219943..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfig.java +++ /dev/null @@ -1,256 +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.internal.core.analyzer.config; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet; -import org.eclipse.wst.wsi.internal.core.document.WSIDocument; -import org.eclipse.wst.wsi.internal.core.util.MessageList; - -/** - * This is the interface for the analzyer configuration file. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface AnalyzerConfig extends WSIDocument -{ - /** - * Element name. - */ - public static final String ELEM_NAME = WSIConstants.ELEM_CONFIG; - - /** - * QName. - */ - public static final QName QNAME = - new QName(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG, ELEM_NAME); - - /** - * Correlation types. - */ - public static final String CORRELATION_TYPE_OPERATION = "operation"; - public static final String CORRELATION_TYPE_NAMESPACE = "namespace"; - public static final String CORRELATION_TYPE_ENDPOINT = "endpoint"; - - /** - * Initialize analyzer config. - * @param messageList a MessageList object. - */ - public void init(MessageList messageList); - - /** - * Get optional description. - * @return optional description. - * @see #setDescription - */ - public String getDescription(); - - /** - * Set optional description. - * @param description an optional description. - * @see #getDescription - */ - public void setDescription(String description); - - /** - * Get verbose option. - * @return true if verbose. - * @see #setVerboseOption - */ - public boolean getVerboseOption(); - - /** - * Set verbose option. - * @param verbose verbose option. - * @see #getVerboseOption - */ - public void setVerboseOption(boolean verbose); - - /** - * Get assertion results option. - * @return assertion results option. - * @see #setAssertionResultsOption - */ - public AssertionResultsOption getAssertionResultsOption(); - - /** - * Set assertion results option. - * @param assertionResultsOption assertion results option. - * @see #getAssertionResultsOption - */ - public void setAssertionResultsOption(AssertionResultsOption assertionResultsOption); - - /** - * Get replace report file option. - * @return replace report file option. - * @see #setReplaceReport - */ - public boolean getReplaceReport(); - - /** - * Set replace report file option. - * @param replaceReport eplace report file option. - * @see #getReplaceReport - */ - public void setReplaceReport(boolean replaceReport); - - /** - * Get report file location. - * @return report file location. - * @see #setReportLocation - */ - public String getReportLocation(); - - /** - * Set replace report file option. - * @param reportURI report location. - * @see #getReportLocation - */ - public void setReportLocation(String reportURI); - - /** - * Get style sheet. - * @return style sheet. - * @see #setAddStyleSheet - */ - public AddStyleSheet getAddStyleSheet(); - - /** - * Set style sheet. - * @param addStyleSheet a style sheet. - * @see #getAddStyleSheet - */ - public void setAddStyleSheet(AddStyleSheet addStyleSheet); - - /** - * Get profile test assertions document location. - * @return rofile test assertions document location. - * @see #setTestAssertionsDocumentLocation - */ - public String getTestAssertionsDocumentLocation(); - - /** - * Set profile test assertions document location. - * @param testAssertionsDocumentURI profile test assertions document location. - * @see #getTestAssertionsDocumentLocation - */ - public void setTestAssertionsDocumentLocation(String testAssertionsDocumentURI); - - /** - * Get mesage log location. - * @return mesage log location. - * @see #setLogLocation - */ - public String getLogLocation(); - - /** - * Set message log location. - * @param logURI message log location. - * @see #getLogLocation - */ - public void setLogLocation(String logURI); - - /** - * Is message log location specified. - * @return true if message log location is set. - */ - public boolean isLogSet(); - - /** - * Get correlation type. - * @return correlation type. - * @see #setCorrelationType - */ - public String getCorrelationType(); - - /** - * Set correlation type. - * @param correlationType correlation type. - * @see #getCorrelationType - */ - public void setCorrelationType(String correlationType); - - /** - * Is WSDL reference set. - * @return true if WSDL reference is set. - */ - public boolean isWSDLReferenceSet(); - - /** - * Get WSDL reference. - * @return WSDL reference. - * @see #setWSDLReference - */ - public WSDLReference getWSDLReference(); - - /** - * Set WSDL reference. - * @param wsdlReference WSDL reference. - * @see #getWSDLReference - */ - public void setWSDLReference(WSDLReference wsdlReference); - - /** - * Get WSDL element. - * @return WSDL element. - */ - public WSDLElement getWSDLElement(); - - /** - * Get WSDL document location. - * @return WSDL document location. - */ - public String getWSDLLocation(); - - /** - * Get service location. - * @return service location. - */ - public String getServiceLocation(); - - /** - * Is UDDI reference set. - * @return true if UDDI reference is set. - */ - public boolean isUDDIReferenceSet(); - - /** - * Get UDDI reference. - * @return UDDI reference. - * @see #setUDDIReference - */ - public UDDIReference getUDDIReference(); - - /** - * Set UDDI reference. - * @param uddiReference UDDI reference. - * @see #getUDDIReference - */ - public void setUDDIReference(UDDIReference uddiReference); - - /** - * Parse the command line arguments. - * @param args the command line arguments. - * @param validate flag for command line validation. - * @throws WSIException if problems parsing the command line arguments. - */ - public void parseArgs(String[] args, boolean validate) throws WSIException; - - /** - * Get string representation of this object. - * @return string representation of this object. - */ - public String toString(); -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfigReader.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfigReader.java deleted file mode 100644 index 7c364fb4e..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AnalyzerConfigReader.java +++ /dev/null @@ -1,51 +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.internal.core.analyzer.config; - -import java.io.Reader; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.document.DocumentReader; -import org.eclipse.wst.wsi.internal.core.util.MessageList; - - -/** - * Defines the interface used to read the analyzer config documents. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface AnalyzerConfigReader extends DocumentReader { - - /** - * Initialize analyzer config reader. - * @param messageList a MessageList object. - */ - public void init(MessageList messageList); - - /** - * Read the analyzer config file. - * @param analyzerConfigURI the analyzer config file location. - * @return the AnalyzerConfig object. - * @throws WSIException if unable to read the analyzer config file. - */ - public AnalyzerConfig readAnalyzerConfig(String analyzerConfigURI) throws WSIException; - - /** - * Read the analyzer config file. - * @param reader a Reader object. - * @return the AnalyzerConfig object. - * @throws WSIException if unable to parse the analyzer config file. - */ - public AnalyzerConfig readAnalyzerConfig(Reader reader) throws WSIException; -} - - diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultType.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultType.java deleted file mode 100644 index 020c9d136..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultType.java +++ /dev/null @@ -1,160 +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.internal.core.analyzer.config; - -import org.eclipse.wst.wsi.internal.core.WSIException; - -/** - * Test assertion result type. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public final class AssertionResultType -{ - /** - * This type. - */ - private String resultType = _ALL; - - /** - * String version of result types. - */ - private static final String _ALL = "all"; - private static final String _NOT_INFO = "notInfo"; - private static final String _ONLY_FAILED = "onlyFailed"; - private static final String _NOT_PASSED = "notPassed"; - - /** - * Result types. - */ - public static final AssertionResultType ALL = new AssertionResultType(_ALL); - public static final AssertionResultType NOT_INFO = new AssertionResultType(_NOT_INFO); - public static final AssertionResultType ONLY_FAILED = - new AssertionResultType(_ONLY_FAILED); - public static final AssertionResultType NOT_PASSED = - new AssertionResultType(_NOT_PASSED); - - /** - * Do not allow this object to be created with null constructor. - */ - private AssertionResultType() - { - } - - /** - * Create result type. - * @param resultType a result type. - */ - private AssertionResultType(String resultType) - { - this.resultType = resultType; - } - - /** - * Is result type all. - * @return true if the result type is all. - */ - public boolean isAll() - { - return resultType.equals(_ALL); - } - - /** - * Is result type failed only. - * @return true if the result type is failed only. - */ - public boolean isFailedOnly() - { - return resultType.equals(_ONLY_FAILED); - } - - /** - * Is result type not passed. - * @return true if the result type is not passed. - */ - public boolean isNotPassed() - { - return resultType.equals(_NOT_PASSED); - } - - /** - * Is result type not info. - * @return true if the result type is not info. - */ - public boolean isNotInfo() - { - return resultType.equals(_NOT_INFO); - } - - /** - * Get result type. - * @return result type. - */ - public String getType() - { - return resultType; - } - - /** - * Create new assertion result type. - * @param resultType an assertion result type. - * @return new assertion result type. - * @throws WSIException if invalid assertion result type was specified. - */ - public static AssertionResultType newInstance(String resultType) - throws WSIException - { - AssertionResultType assertionResultType = null; - - if (resultType == null) - { - assertionResultType = NOT_INFO; - } - - else if (resultType.equals(_ALL)) - { - assertionResultType = ALL; - } - - else if (resultType.equals(_ONLY_FAILED)) - { - assertionResultType = ONLY_FAILED; - } - - else if (resultType.equals(_NOT_PASSED)) - { - assertionResultType = NOT_PASSED; - } - else if (resultType.equals(_NOT_INFO)) - { - assertionResultType = NOT_INFO; - } - - else - { - throw new WSIException( - "An invalid assertion result type was specified: " + resultType + "."); - } - - return assertionResultType; - } - - /** - * Get string representation of this object. - * @return string representation of this object. - */ - public String toString() - { - return resultType; - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultsOption.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultsOption.java deleted file mode 100644 index 34ed56f14..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/AssertionResultsOption.java +++ /dev/null @@ -1,100 +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.internal.core.analyzer.config; - -import org.eclipse.wst.wsi.internal.core.document.DocumentElement; - -/** - * This interface contains a definition of the assertion results that - * should be included in the report. It also contains information - * that indicates which messages should be included in the report. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface AssertionResultsOption extends DocumentElement -{ - /** - * Get assertion result type. - * @return assertion result type. - * @see #setAssertionResultType - */ - public AssertionResultType getAssertionResultType(); - - /** - * Set assertion result type. - * @param resultType assertion result type. - * @see #getAssertionResultType - */ - public void setAssertionResultType(AssertionResultType resultType); - - /** - * Get show message entry indicator. - * @return show message entry indicator. - * @see #setShowMessageEntry - */ - public boolean getShowMessageEntry(); - - /** - * Set show message entry indictor. - * @param showMessageEntry show message entry indictor. - * @see #getShowMessageEntry - */ - public void setShowMessageEntry(boolean showMessageEntry); - - /** - * Get show assertion description indicator. - * @return show assertion description indicator. - * @see #setShowAssertionDescription - */ - public boolean getShowAssertionDescription(); - - /** - * Set show assertion description indictor. - * @param showAssertionDescription show assertion description indictor. - * @see #getShowAssertionDescription - */ - public void setShowAssertionDescription(boolean showAssertionDescription); - - /** - * Get show failure message indicator. - * @return show failure message indicator. - * @see #setShowFailureMessage - */ - public boolean getShowFailureMessage(); - - /** - * Set show failure message indicator. - * @param showFailureMessage show failure message indicator. - * @see #getShowFailureMessage - */ - public void setShowFailureMessage(boolean showFailureMessage); - - /** - * Get show error detail indicator. - * @return show error detail indicator. - * @see #setShowFailureDetail - */ - public boolean getShowFailureDetail(); - - /** - * Set show error detail indicator. - * @param showfailureDetail show error detail indicator. - * @see #getShowFailureDetail - */ - public void setShowFailureDetail(boolean showfailureDetail); - - /** - * Get string representation of this object. - * @return string representation of this object. - */ - public String toString(); -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/UDDIReference.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/UDDIReference.java deleted file mode 100644 index 2a3bcd215..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/UDDIReference.java +++ /dev/null @@ -1,116 +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.internal.core.analyzer.config; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.document.DocumentElement; - -/** - * The interface for a reference to a discovery artifact. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface UDDIReference extends DocumentElement -{ - /** - * Element name. - */ - public static final String ELEM_NAME = WSIConstants.ELEM_UDDI_REFERENCE; - - /** - * QName. - */ - public static final QName QNAME = - new QName(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG, ELEM_NAME); - - /** - * UDDI key type: bindingKey. - */ - public static final String BINDING_KEY = "bindingKey"; - - /** - * UDDI key type: tModelKey. - */ - public static final String TMODEL_KEY = "tModelKey"; - - /** - * Get UDDI key type. - * @return UDDI key type. - * @see #setKeyType - */ - public String getKeyType(); - - /** - * Set UDDI key type. - * @param keyType UDDI key type. - * @see #getKeyType - */ - public void setKeyType(String keyType); - - /** - * Get UDDI key. - * @return UDDI key. - * @see #setKey - */ - public String getKey(); - - /** - * Set UDDI key. - * @param key UDDI key. - * @see #getKey - */ - public void setKey(String key); - - /** - * Get UDDI inquiry URL. - * @return UDDI inquiry URL. - * @see #setInquiryURL - */ - public String getInquiryURL(); - - /** - * Set UDDI inquiryURL. - * @param inquiryURL UDDI inquiryURL. - * @see #getInquiryURL - */ - public void setInquiryURL(String inquiryURL); - - /** - * Get WSDL element. - * @return WSDL element. - * @see #setWSDLElement - */ - public WSDLElement getWSDLElement(); - - /** - * Set WSDL element. - * @param wsdlElement WSDL element. - * @see #getWSDLElement - */ - public void setWSDLElement(WSDLElement wsdlElement); - - /** - * Get service location. - * @return service location. - * @see #setServiceLocation - */ - public String getServiceLocation(); - - /** - * Set service location. - * @param serviceLocation service location. - * @see #getServiceLocation - */ - public void setServiceLocation(String serviceLocation); -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLElement.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLElement.java deleted file mode 100644 index 2be33e22c..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLElement.java +++ /dev/null @@ -1,135 +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.internal.core.analyzer.config; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.document.DocumentElement; - -/** - * The base interface for WSDL definitions. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface WSDLElement extends DocumentElement -{ - /** - * Element name. - */ - public static final String ELEM_NAME = WSIConstants.ELEM_WSDL_ELEMENT; - - /** - * QName. - */ - public static final QName QNAME = - new QName(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG, ELEM_NAME); - - /** - * Get WSDL element type. - * @return WSDL element type. - * @see #setType - */ - public String getType(); - - /** - * Set WSDL element type. - * @param type WSDL element type. - * @see #getType - */ - public void setType(String type); - - /** - * Get WSDL element namespace. - * @return WSDL element namespace. - * @see #setNamespace - */ - public String getNamespace(); - - /** - * Set WSDL element namespace. - * @param namespace WSDL element namespace. - * @see #getNamespace - */ - public void setNamespace(String namespace); - - /** - * Get WSDL element name. - * @return WSDL element name. - * @see #setName - */ - public String getName(); - - /** - * Set WSDL element name. - * @param name WSDL element name. - * @see #getName - */ - public void setName(String name); - - /** - * Get WSDL element qualified name. - * @return WSDL element qualified name. - */ - public QName getQName(); - - /** - * Get WSDL parent element name. - * @return WSDL parent element name. - * @see #setParentElementName - * - */ - public String getParentElementName(); - - /** - * Set WSDL parent element name. - * @param parentElementName WSDL parent element name. - * @see #getParentElementName - */ - public void setParentElementName(String parentElementName); - - /** - * Get WSDL parent element QName. - * @return WSDL parent element QName. - */ - public QName getParentElementQName(); - - /** - * Is port element. - * @return true if the element is a port. - */ - public boolean isPort(); - - /** - * Is binding element. - * @return true if the lement is a binding. - */ - public boolean isBinding(); - - /** - * Is portType element. - * @return true if element is a port type. - */ - public boolean isPortType(); - - /** - * Is operation element. - * @return true if the element is an operation. - */ - public boolean isOperation(); - - /** - * Is message element. - * @return true if element is a message. - */ - public boolean isMessage(); -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLReference.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLReference.java deleted file mode 100644 index ec550c249..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/WSDLReference.java +++ /dev/null @@ -1,78 +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.internal.core.analyzer.config; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.document.DocumentElement; - -/** - * The interface for a reference to a description artifact. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public interface WSDLReference extends DocumentElement -{ - /** - * Element name. - */ - public static final String ELEM_NAME = WSIConstants.ELEM_WSDL_REFERENCE; - - /** - * QName. - */ - public static final QName QNAME = - new QName(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG, ELEM_NAME); - - /** - * Get WSDL element. - * @return WSDL element. - * @see #setWSDLElement - */ - public WSDLElement getWSDLElement(); - - /** - * Set WSDL element. - * @param wsdlElement WSDL element. - * @see #getWSDLElement - */ - public void setWSDLElement(WSDLElement wsdlElement); - - /** - * Get WSDL location. - * @return WSDL location. - * @see #setWSDLLocation - */ - public String getWSDLLocation(); - - /** - * Set WSDL location. - * @param wsdlLocation WSDL location. - * @see #getWSDLLocation - */ - public void setWSDLLocation(String wsdlLocation); - - /** - * Get service location. - * @return service location. - * @see #setServiceLocation - */ - public String getServiceLocation(); - - /** - * Set service location. - * @param serviceLocation service location. - * @see #getServiceLocation - */ - public void setServiceLocation(String serviceLocation); -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigImpl.java deleted file mode 100644 index 95ee74a0d..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigImpl.java +++ /dev/null @@ -1,1060 +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.internal.core.analyzer.config.impl; - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.analyzer.Analyzer; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfigReader; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultType; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultsOption; -import org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference; -import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet; -import org.eclipse.wst.wsi.internal.core.common.impl.AddStyleSheetImpl; -import org.eclipse.wst.wsi.internal.core.util.MessageList; -import org.eclipse.wst.wsi.internal.core.util.Utils; - -/** - * This class is an implementation of the analyzer configuration file interface. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class AnalyzerConfigImpl implements AnalyzerConfig -{ - /** - * Message list reference. - */ - protected MessageList messageList = null; - - /** - * Analyzer configuration file URI. - */ - protected String configURI = null; - - /** - * Optional description. - */ - protected String description = null; - - /** - * Verbose option. - */ - protected boolean verbose = false; - - /** - * Assertion results option. - */ - protected AssertionResultsOption assertionResultsOption = - new AssertionResultsOptionImpl(); - - /** - * Report location. - */ - protected String reportURI = WSIConstants.DEFAULT_REPORT_URI; - - /** - * Replace report indicator. - */ - protected boolean replaceReport = false; - - /** - * Add style sheet. - */ - protected AddStyleSheet addStyleSheet; - - /** - * Profile test assertions document location. - */ - protected String testAssertionsDocumentURI = - WSIConstants.DEFAULT_TEST_ASSERTIONS_DOCUMENT_URI; - - /** - * Message log location. - */ - protected String logURI = null; - - /** - * Message correlation type. - */ - protected String correlationType = - WSIConstants.ATTRVAL_CORRELATION_TYPE_OPERATION; - - /** - * WSDL reference. - */ - protected WSDLReference wsdlReference = null; - - /** - * UDDI reference. - */ - protected UDDIReference uddiReference = null; - - /** - * Default constructor. - */ - public AnalyzerConfigImpl() - { - } - - /** - * Constructor with all settings. - * @param description an optional description. - * @param verbose the verbose option. - * @param assertionResultsOption an assertion results option. - * @param reportURI report location. - * @param replaceReport a replace report indicator. - * @param addStyleSheet add style sheet. - * @param testAssertionsDocumentURI profile test assertions document location. - * @param logURI message log location. - * @param correlationType message correlation type. - * @param wsdlReference a WSDL reference.. - * @param uddiReference a UUDDI reference. - */ - public AnalyzerConfigImpl( - String description, - boolean verbose, - AssertionResultsOption assertionResultsOption, - String reportURI, - boolean replaceReport, - AddStyleSheet addStyleSheet, - String testAssertionsDocumentURI, - String logURI, - String correlationType, - WSDLReference wsdlReference, - UDDIReference uddiReference) - { - this.description = description; - this.verbose = verbose; - this.assertionResultsOption = assertionResultsOption; - this.reportURI = reportURI; - this.replaceReport = replaceReport; - this.addStyleSheet = addStyleSheet; - this.testAssertionsDocumentURI = testAssertionsDocumentURI; - this.logURI = logURI; - this.correlationType = correlationType; - this.wsdlReference = wsdlReference; - this.uddiReference = uddiReference; - } - - /** - * Initialize analyzer config. - */ - public void init(MessageList messageList) - { - this.messageList = messageList; - } - - /** - * Get optional description. - * @see #setDescription - */ - public String getDescription() - { - return this.description; - } - - /** - * Set optional description. - * @see #getDescription - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @see #setVerboseOption - */ - public boolean getVerboseOption() - { - return this.verbose; - } - - /** - * @see #getVerboseOption - */ - public void setVerboseOption(boolean verbose) - { - this.verbose = verbose; - } - - /** - * Get assertion results option. - * @see #setAssertionResultsOption - */ - public AssertionResultsOption getAssertionResultsOption() - { - return this.assertionResultsOption; - } - - /** - * Set assertion results option. - * @see #getAssertionResultsOption - */ - public void setAssertionResultsOption(AssertionResultsOption assertionResultsOption) - { - this.assertionResultsOption = assertionResultsOption; - } - - /** - * @see #setReportLocation - */ - public String getReportLocation() - { - return this.reportURI; - } - - /** - * @see #getReportLocation - */ - public void setReportLocation(String reportURI) - { - this.reportURI = reportURI; - } - - /** - * Get replace report file option. - * @see #setReplaceReport - */ - public boolean getReplaceReport() - { - return this.replaceReport; - } - - /** - * Set report file location. - * @see #getReplaceReport - */ - public void setReplaceReport(boolean replaceReport) - { - this.replaceReport = replaceReport; - } - - /** - * Get add style sheet. - * @see #setAddStyleSheet - */ - public AddStyleSheet getAddStyleSheet() - { - return this.addStyleSheet; - } - - /** - * Set replace report file option. - * @see #getAddStyleSheet - */ - public void setAddStyleSheet(AddStyleSheet addStyleSheet) - { - this.addStyleSheet = addStyleSheet; - } - - /** - * @see #setTestAssertionDocumentLocation - */ - public String getTestAssertionsDocumentLocation() - { - return this.testAssertionsDocumentURI; - } - - /** - * @see #getTestAssertionDocumentLocation - */ - public void setTestAssertionsDocumentLocation(String testAssertionsDocumentURI) - { - this.testAssertionsDocumentURI = testAssertionsDocumentURI; - } - - /** - * @see #setLogLocation - */ - public String getLogLocation() - { - return logURI; - } - - /** - * @see #getLogLocation - */ - public void setLogLocation(String logURI) - { - this.logURI = logURI; - } - - public boolean isLogSet() - { - return (logURI != null); - } - - /** - * Get correlation type. - * @see #setCorrelationType - */ - public String getCorrelationType() - { - return this.correlationType; - } - - /** - * Set correlation type. - * @see #getCorrelationType - * - */ - public void setCorrelationType(String correlationType) - { - this.correlationType = correlationType; - } - - /** - * Is WSDL reference set. - */ - public boolean isWSDLReferenceSet() - { - return (this.wsdlReference == null ? false : true); - } - - /** - * Get WSDL reference. - * @see #setWSDLReference - */ - public WSDLReference getWSDLReference() - { - return this.wsdlReference; - } - - /** - * Set WSDL reference. - * @see #getWSDLReference - */ - public void setWSDLReference(WSDLReference wsdlReference) - { - this.wsdlReference = wsdlReference; - } - - /** - * Get WSDL element. - * - */ - public WSDLElement getWSDLElement() - { - return (this.wsdlReference == null) - ? null - : this.wsdlReference.getWSDLElement(); - } - - /** - * Get service location. - */ - public String getServiceLocation() - { - return (this.wsdlReference == null) - ? null - : this.wsdlReference.getServiceLocation(); - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig#getWSDLLocation() - */ - public String getWSDLLocation() - { - return (this.wsdlReference == null) - ? null - : this.wsdlReference.getWSDLLocation(); - } - - /** - * @see org.wsi.test.analyzer.config.AnalyzerConfig#isUddiReferenceSet) - */ - public boolean isUDDIReferenceSet() - { - return (this.uddiReference == null ? false : true); - } - - /** - * Get UDDI reference. - * @see #setUDDIReference - */ - public UDDIReference getUDDIReference() - { - return this.uddiReference; - } - - /** - * Set UDDI reference. - * @see #getUDDIReference - */ - public void setUDDIReference(UDDIReference uddiReference) - { - this.uddiReference = uddiReference; - } - - /** - * @see #setLocation - */ - public String getLocation() - { - return configURI; - } - - /** - * @see getLocation - */ - public void setLocation(String configURI) - { - this.configURI = configURI; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.document.WSIDocument#toXMLString() - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if ((!nsName.equals("") && (!nsName.endsWith(":")))) - nsName += ":"; - - // Start element - pw.println(" <" + nsName + ELEM_NAME + ">"); - - // Verbose option - pw.print(" <" + nsName + WSIConstants.ELEM_VERBOSE + ">"); - pw.print(getVerboseOption()); - pw.println("</" + nsName + WSIConstants.ELEM_VERBOSE + ">"); - - // Get assertion results option - pw.print(assertionResultsOption.toXMLString(nsName)); - - // report file - pw.print(" <" + nsName + WSIConstants.ELEM_REPORT_FILE + " "); - pw.print(WSIConstants.ATTR_REPLACE + "=\"" + getReplaceReport() + "\" "); - pw.println( - WSIConstants.ATTR_LOCATION + "=\"" + getReportLocation() + "\">"); - pw.print(getAddStyleSheet().toXMLString(namespaceName)); - pw.println(" </" + nsName + WSIConstants.ELEM_REPORT_FILE + ">"); - - // test assertion file - pw.print( - " <" + nsName + WSIConstants.ELEM_TEST_ASSERTIONS_FILE + ">"); - pw.print(getTestAssertionsDocumentLocation()); - pw.println("</" + nsName + WSIConstants.ELEM_TEST_ASSERTIONS_FILE + ">"); - - // log file - pw.print(" <" + nsName + WSIConstants.ELEM_LOG_FILE); - pw.print( - " " - + WSIConstants.ATTR_CORRELATION_TYPE - + "=\"" - + this.correlationType - + "\">"); - pw.print(getLogLocation()); - pw.println("</" + nsName + WSIConstants.ELEM_LOG_FILE + ">"); - - // WSDL reference - if (this.wsdlReference != null) - { - pw.print(getWSDLReference().toXMLString(nsName)); - } - - // UDDI Reference - if (this.uddiReference != null) - { - pw.print(getUDDIReference().toXMLString(nsName)); - } - - // End element - pw.println(" </" + nsName + ELEM_NAME + ">"); - - return sw.toString(); - } - - /** - * Get string representation of this object. - */ - public String toString() - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - // verbose option - pw.println(" verbose .................... " + this.verbose); - - // assertionResults options - pw.print(this.assertionResultsOption.toString()); - - // reportFile options - pw.println(" Report File:"); - pw.println(" replace .................. " + this.replaceReport); - pw.println(" location ................. " + this.reportURI); - if (this.addStyleSheet != null) - { - pw.println(" Style Sheet:"); - if (this.addStyleSheet.getHref() != null) - pw.println( - " href ................... " + this.addStyleSheet.getHref()); - if (this.addStyleSheet.getType() != null) - pw.println( - " type ................... " + this.addStyleSheet.getType()); - if (this.addStyleSheet.getTitle() != null) - pw.println( - " title .................. " + this.addStyleSheet.getTitle()); - if (this.addStyleSheet.getMedia() != null) - pw.println( - " media .................. " + this.addStyleSheet.getMedia()); - if (this.addStyleSheet.getCharset() != null) - pw.println( - " charset ................ " + this.addStyleSheet.getCharset()); - if (this.addStyleSheet.getAlternate() != null) - pw.println( - " alternate .............. " - + this.addStyleSheet.getAlternate()); - } - - // testAssertionsFile parameter - pw.println( - " testAssertionsFile ......... " + this.testAssertionsDocumentURI); - - // logFile options - if (this.logURI != null) - { - pw.println(" Message Log File:"); - pw.println(" location ................. " + this.logURI); - pw.println(" correlationType .......... " + this.correlationType); - } - - // wsdlReference options - if (this.isWSDLReferenceSet()) - { - pw.print(this.wsdlReference.toString()); - } - - // uddiReference options - if (this.isUDDIReferenceSet()) - { - pw.print(this.uddiReference.toString()); - } - - // description parameter - if (this.description != null) - { - pw.println(" description ................ " + this.description); - } - - return sw.toString(); - } - - /** - * Set config values from another analyzer config object. - */ - private void setConfig(AnalyzerConfig analyzerConfig) - { - this.configURI = analyzerConfig.getLocation(); - this.description = analyzerConfig.getDescription(); - this.verbose = analyzerConfig.getVerboseOption(); - this.assertionResultsOption = analyzerConfig.getAssertionResultsOption(); - this.reportURI = analyzerConfig.getReportLocation(); - this.replaceReport = analyzerConfig.getReplaceReport(); - this.logURI = analyzerConfig.getLogLocation(); - this.correlationType = analyzerConfig.getCorrelationType(); - this.testAssertionsDocumentURI = - analyzerConfig.getTestAssertionsDocumentLocation(); - this.addStyleSheet = analyzerConfig.getAddStyleSheet(); - this.wsdlReference = analyzerConfig.getWSDLReference(); - this.uddiReference = analyzerConfig.getUDDIReference(); - } - - /** - * Parse command line arguments. - */ - public void parseArgs(String[] args, boolean validate) throws WSIException - { - WSDLReference wsdlReference = null; - UDDIReference uddiReference = null; - - // Get new config reader - AnalyzerConfigReader analyzerConfigReader = new AnalyzerConfigReaderImpl(); - analyzerConfigReader.init(this.messageList); - - // Analyzer config object which will be merged after all of the input parms are processed - AnalyzerConfig analyzerConfigFromArgs = null; - - // Assertion results option - AssertionResultsOption assertionResultsOption = null; - - // If no input arguments, then throw exception - if (args.length == 0) - { - // ADD: - throw new IllegalArgumentException( - getMessage("usage01", Analyzer.USAGE_MESSAGE)); - } - - // Parse the command line arguments to locate the config file option (if it was specified) - for (int argCount = 0; argCount < args.length; argCount++) - { - // -config - if ((args[argCount].equalsIgnoreCase("-config")) - || (args[argCount].equals("-c"))) - { - argCount++; - analyzerConfigFromArgs = - analyzerConfigReader.readAnalyzerConfig( - getOptionValue(args, argCount)); - } - } - - // If config file was not specified, then create analyzer config object - if (analyzerConfigFromArgs == null) - { - analyzerConfigFromArgs = new AnalyzerConfigImpl(); - analyzerConfigFromArgs.init(this.messageList); - } - - // Get assertion results option - if ((assertionResultsOption = - analyzerConfigFromArgs.getAssertionResultsOption()) - == null) - { - assertionResultsOption = new AssertionResultsOptionImpl(); - analyzerConfigFromArgs.setAssertionResultsOption(assertionResultsOption); - } - - // Parse all of the command line arguments - for (int argCount = 0; argCount < args.length; argCount++) - { - // -config - if ((args[argCount].equalsIgnoreCase("-config")) - || (args[argCount].equals("-c"))) - { - // Skip this option since it was already processed - argCount++; - } - - // -verbose - else if ( - (args[argCount].equalsIgnoreCase("-verbose")) - || (args[argCount].equals("-v"))) - { - argCount++; - analyzerConfigFromArgs.setVerboseOption( - Boolean.valueOf(getOptionValue(args, argCount)).booleanValue()); - } - - // -assertionResults - else if ( - (args[argCount].equalsIgnoreCase("-assertionResults")) - || (args[argCount].equals("-a"))) - { - argCount++; - assertionResultsOption.setAssertionResultType( - AssertionResultType.newInstance(getOptionValue(args, argCount))); - } - - // -messageEntry - else if ( - (args[argCount].equalsIgnoreCase("-messageEntry")) - || (args[argCount].equals("-M"))) - { - argCount++; - assertionResultsOption.setShowMessageEntry( - Boolean.valueOf(getOptionValue(args, argCount)).booleanValue()); - } - - // -assertionDescription - else if ( - (args[argCount].equalsIgnoreCase("-assertionDescription")) - || (args[argCount].equals("-A"))) - { - argCount++; - assertionResultsOption.setShowAssertionDescription( - Boolean.valueOf(args[argCount]).booleanValue()); - } - - // -failureMessage - else if ( - (args[argCount].equalsIgnoreCase("-failureMessage")) - || (args[argCount].equals("-F"))) - { - argCount++; - assertionResultsOption.setShowFailureMessage( - Boolean.valueOf(getOptionValue(args, argCount)).booleanValue()); - } - - // -failureDetail - else if ( - (args[argCount].equalsIgnoreCase("-failureDetail")) - || (args[argCount].equals("-D"))) - { - argCount++; - assertionResultsOption.setShowFailureDetail( - Boolean.valueOf(getOptionValue(args, argCount)).booleanValue()); - } - - // -logFile - else if ( - (args[argCount].equalsIgnoreCase("-logFile")) - || (args[argCount].equals("-l"))) - { - argCount++; - analyzerConfigFromArgs.setLogLocation(getOptionValue(args, argCount)); - } - - // -testAssertionFile - else if ( - (args[argCount].equalsIgnoreCase("-testAssertionFile")) - || (args[argCount].equals("-t"))) - { - argCount++; - analyzerConfigFromArgs.setTestAssertionsDocumentLocation( - getOptionValue(args, argCount)); - } - - // -reportFile - else if ( - (args[argCount].equalsIgnoreCase("-reportFile")) - || (args[argCount].equals("-r"))) - { - argCount++; - analyzerConfigFromArgs.setReportLocation( - getOptionValue(args, argCount)); - } - - // -replace - else if ( - (args[argCount].equalsIgnoreCase("-replace")) - || (args[argCount].equals("-R"))) - { - argCount++; - analyzerConfigFromArgs.setReplaceReport( - Boolean.valueOf(getOptionValue(args, argCount)).booleanValue()); - } - - // -correlationType - else if ( - (args[argCount].equalsIgnoreCase("-correlationType")) - || (args[argCount].equals("-C"))) - { - argCount++; - analyzerConfigFromArgs.setCorrelationType( - getOptionValue(args, argCount)); - } - - // -wsdlElement - else if ( - (args[argCount].equalsIgnoreCase("-wsdlElement")) - || (args[argCount].equals("-W"))) - { - String optionName = args[argCount]; - argCount++; - - WSDLElement wsdlElement = new WSDLElementImpl(); - wsdlElement.setName(getOptionValue(args, argCount, optionName)); - argCount++; - wsdlElement.setType(getOptionValue(args, argCount, optionName)); - argCount++; - wsdlElement.setNamespace(getOptionValue(args, argCount, optionName)); - if (!args[argCount].startsWith("-")) - { - argCount++; - wsdlElement.setParentElementName( - getOptionValue(args, argCount, optionName)); - } - - if (wsdlReference != null) - { - wsdlReference.setWSDLElement(wsdlElement); - } - else if (uddiReference != null) - { - uddiReference.setWSDLElement(wsdlElement); - } - else - { - throw new IllegalArgumentException( - getMessage( - "config10", - "The -wsdlElement option must appear after the -wsdlURI or -uddiKey options.")); - } - - analyzerConfigFromArgs.setWSDLReference(wsdlReference); - } - - // -serviceLocation - else if ( - (args[argCount].equalsIgnoreCase("-serviceLocation")) - || (args[argCount].equals("-S"))) - { - argCount++; - - if (wsdlReference != null) - { - wsdlReference.setServiceLocation(getOptionValue(args, argCount)); - } - else if (uddiReference != null) - { - uddiReference.setServiceLocation(getOptionValue(args, argCount)); - } - else - { - throw new IllegalArgumentException( - getMessage( - "config11", - "The -serviceLocation option must appear after the -wsdlURI or -uddiKey options.")); - } - } - - // -wsdlURI - else if ( - (args[argCount].equalsIgnoreCase("-wsdlURI")) - || (args[argCount].equals("-W"))) - { - argCount++; - if (wsdlReference == null) - wsdlReference = new WSDLReferenceImpl(); - wsdlReference.setWSDLLocation(getOptionValue(args, argCount)); - analyzerConfigFromArgs.setWSDLReference(wsdlReference); - } - - // -uddiKeyType - else if ( - (args[argCount].equalsIgnoreCase("-uddiKeyType")) - || (args[argCount].equals("-K"))) - { - argCount++; - if (uddiReference == null) - uddiReference = new UDDIReferenceImpl(); - uddiReference.setKeyType(getOptionValue(args, argCount)); - analyzerConfigFromArgs.setUDDIReference(uddiReference); - } - - // -uddiKey - else if ( - (args[argCount].equalsIgnoreCase("-uddiKey")) - || (args[argCount].equals("-k"))) - { - argCount++; - if (uddiReference == null) - uddiReference = new UDDIReferenceImpl(); - uddiReference.setKey(getOptionValue(args, argCount)); - analyzerConfigFromArgs.setUDDIReference(uddiReference); - } - - // -inquiryURL - else if ( - (args[argCount].equalsIgnoreCase("-inquiryURL")) - || (args[argCount].equals("-i"))) - { - argCount++; - if (uddiReference == null) - uddiReference = new UDDIReferenceImpl(); - uddiReference.setInquiryURL(getOptionValue(args, argCount)); - analyzerConfigFromArgs.setUDDIReference(uddiReference); - } - - // ADD: Need to add support for other options (-config, -binding, etc.) - else - { - throw new IllegalArgumentException( - getMessage( - "config12", - args[argCount], - "The specified option is not supported:")); - } - } - - // If addStyleSheet was not specified, then create a comment version of it - if (analyzerConfigFromArgs.getAddStyleSheet() == null) - { - AddStyleSheet addStyleSheet = new AddStyleSheetImpl(); - addStyleSheet.setHref(WSIConstants.DEFAULT_REPORT_XSL); - addStyleSheet.setType(WSIConstants.DEFAULT_XSL_TYPE); - addStyleSheet.setComment(true); - analyzerConfigFromArgs.setAddStyleSheet(addStyleSheet); - } - - // Merge config info into this object - setConfig(analyzerConfigFromArgs); - - if (validate) - { - // Verify that all required options were specified and - // that the specified ones were correct - checkConfigOptions(); - } - } - - /** - * Verify config options. - */ - private void checkConfigOptions() throws WSIException - { - String fileLocation; - - // If wsdlReference and uddiReference specified, then throw exception - if ((this.isWSDLReferenceSet()) && (this.isUDDIReferenceSet())) - { - throw new IllegalArgumentException( - getMessage( - "config04", - "Can not specify both the WSDL reference and UDDI reference options")); - } - - // Check if test assertion file exists - if ((fileLocation = this.getTestAssertionsDocumentLocation()) == null) - { - throw new IllegalArgumentException( - getMessage( - "config16", - "Test assertion document location must be specified.")); - } - - else if (!Utils.fileExists(fileLocation)) - { - throw new IllegalArgumentException( - getMessage( - "config14", - fileLocation, - "Could not find test assertion document. Specified file location:")); - } - - // Check if log file exists - if ((fileLocation = this.getLogLocation()) != null) - { - if (!Utils.fileExists(fileLocation)) - throw new IllegalArgumentException( - messageList.getMessage( - "config02", - fileLocation, - "Could not find log file:")); - } - - // Check if WSDL file exists - if ((this.getWSDLReference() != null) - && (fileLocation = this.getWSDLReference().getWSDLLocation()) != null) - { - if (!Utils.fileExists(fileLocation)) - throw new IllegalArgumentException( - messageList.getMessage( - "config03", - fileLocation, - "Could not find WSDL file:")); - } - - File file = null; - try - { - // Get file object for report file - file = new File(this.getReportLocation()); - } - - catch (Exception e) - { - throw new IllegalArgumentException( - messageList.getMessage( - "config17", - "Could not get report file location.")); - } - - // If replace flag is false and file exists, then throw exception - if (file.exists() && !this.getReplaceReport()) - { - throw new IllegalArgumentException( - messageList.getMessage( - "config15", - "Report file already exists and replace option was not specified.")); - } - - if (correlationType != null - && !this.correlationType.equals( - WSIConstants.ATTRVAL_CORRELATION_TYPE_ENDPOINT) - && !this.correlationType.equals( - WSIConstants.ATTRVAL_CORRELATION_TYPE_NAMESPACE) - && !this.correlationType.equals( - WSIConstants.ATTRVAL_CORRELATION_TYPE_OPERATION)) - { - throw new IllegalArgumentException( - messageList.getMessage( - "config18", - "Invalid correlation type specified.")); - } - } - - /** - * Get option value. - */ - private String getOptionValue(String[] args, int index) throws WSIException - { - return getOptionValue(args, index, args[index - 1]); - } - - /** - * Get option value. - */ - private String getOptionValue(String[] args, int index, String optionName) - throws WSIException - { - // If index greater than array length, then throw exception - if (index >= args.length) - { - throw new IllegalArgumentException( - getMessage( - "config13", - optionName, - "Option did not contain a value. Specified option:")); - } - - // If the value is an option (i.e. starts with a "-"), then throw exception - if (args[index].startsWith("-")) - { - throw new IllegalArgumentException( - getMessage( - "config13", - optionName, - "Option did not contain a value. Specified option:")); - } - - return (args[index]); - } - - /** - * Get message from resource bundle. - */ - private String getMessage(String messageID, String defaultMessage) - { - return getMessage(messageID, null, defaultMessage); - } - - /** - * Get message from resource bundle. - */ - private String getMessage( - String messageID, - String messageData, - String defaultMessage) - { - String message = defaultMessage; - if (messageList != null) - message = messageList.getMessage(messageID, messageData, defaultMessage); - else if (messageData != null) - message += " " + messageData + "."; - - return message; - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigReaderImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigReaderImpl.java deleted file mode 100644 index 1a4de8679..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AnalyzerConfigReaderImpl.java +++ /dev/null @@ -1,559 +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.internal.core.analyzer.config.impl; - -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.WSIFileNotFoundException; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfigReader; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultType; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultsOption; -import org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference; -import org.eclipse.wst.wsi.internal.core.common.AddStyleSheet; -import org.eclipse.wst.wsi.internal.core.common.impl.AddStyleSheetImpl; -import org.eclipse.wst.wsi.internal.core.util.EntryType; -import org.eclipse.wst.wsi.internal.core.util.MessageList; -import org.eclipse.wst.wsi.internal.core.util.TestUtils; -import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - - -/** - * This class is the implementation used to read the analyzer config documents. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class AnalyzerConfigReaderImpl implements AnalyzerConfigReader -{ - /** - * Message list. - */ - protected MessageList messageList; - - /** - * Document location. - */ - protected String documentURI; - - /** - * Initialize analyzer config reader. - */ - public void init(MessageList messageList) - { - this.messageList = messageList; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfigReader#readAnalyzerConfig(String) - */ - public AnalyzerConfig readAnalyzerConfig(String analyzerConfigURI) - throws WSIException - { - FileReader fileReader = null; - try - { - fileReader = new FileReader(analyzerConfigURI); - } - - catch (FileNotFoundException fnfe) - { - throw new WSIFileNotFoundException( - getMessage( - "config01", - analyzerConfigURI, - "Could not find analyzer config file: "), - fnfe); - } - - catch (Exception e) - { - throw new WSIException( - getMessage( - "config08", - analyzerConfigURI, - "Could not read analyzer config file: "), - e); - } - - return readAnalyzerConfig(fileReader); - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfigReader#readAnalyzerConfig(Reader) - */ - public AnalyzerConfig readAnalyzerConfig(Reader reader) throws WSIException - { - AnalyzerConfig analyzerConfig = new AnalyzerConfigImpl(); - - // Parse XML - Document doc = XMLUtils.parseXML(reader); - - // Parse elements in the config document - parseConfigElement(analyzerConfig, doc.getDocumentElement()); - - return analyzerConfig; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.document.DocumentReader#getLocation() - */ - public String getLocation() - { - return this.documentURI; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.document.DocumentReader#setLocation(String) - */ - public void setLocation(String documentURI) - { - this.documentURI = documentURI; - } - - /** - * Parse config element. - */ - private void parseConfigElement( - AnalyzerConfig analyzerConfig, - Element element) - throws WSIException - { - // ADD: Get name and version - - // ADD: Verify that this is the config element - - // Get first child element - Element nextElement = XMLUtils.getFirstChild(element); - - // DEBUG: - //System.out.println("Element name: " + nextElement.getClass().getName()); - - // Process each child element - while (nextElement != null) - { - // <description> - if (isElement(nextElement, WSIConstants.ELEM_DESCRIPTION)) - { - analyzerConfig.setDescription(XMLUtils.getText(nextElement)); - } - - // <verbose> - else if (isElement(nextElement, WSIConstants.ELEM_VERBOSE)) - { - analyzerConfig.setVerboseOption( - XMLUtils.getBooleanValue(nextElement, false)); - } - - // <assertionResults> - else if (isElement(nextElement, WSIConstants.ELEM_ASSERTION_RESULTS)) - { - // Create assertion results option object - AssertionResultsOption assertionResultsOption = - new AssertionResultsOptionImpl(); - analyzerConfig.setAssertionResultsOption(assertionResultsOption); - - // Set result type - String resultType = - XMLUtils.getAttributeValue(nextElement, WSIConstants.ATTR_TYPE); - assertionResultsOption.setAssertionResultType( - AssertionResultType.newInstance(resultType)); - - // Set show log entry - assertionResultsOption.setShowMessageEntry( - XMLUtils.getBooleanValue( - nextElement, - WSIConstants.ATTR_MESSAGE_ENTRY, - assertionResultsOption.getShowMessageEntry())); - - // Set show failure message - assertionResultsOption.setShowFailureMessage( - XMLUtils.getBooleanValue( - nextElement, - WSIConstants.ATTR_FAILURE_MESSAGE, - assertionResultsOption.getShowFailureMessage())); - - // Set show failure detail - assertionResultsOption.setShowFailureDetail( - XMLUtils.getBooleanValue( - nextElement, - WSIConstants.ATTR_FAILURE_DETAIL, - assertionResultsOption.getShowFailureDetail())); - - // REMOVE: Set show warning message - //assertionResultsOption.setShowWarningMessage(XMLUtils.getBooleanValue(nextElement, - // WSIConstants.ATTR_WARNING_MESSAGE, assertionResultsOption.getShowWarningMessage())); - } - - // <reportFile> - else if (isElement(nextElement, WSIConstants.ELEM_REPORT_FILE)) - { - parseReportFileElement(analyzerConfig, nextElement); - } - - // <testAssertionFile> - else if (isElement(nextElement, WSIConstants.ELEM_TEST_ASSERTIONS_FILE)) - { - analyzerConfig.setTestAssertionsDocumentLocation( - XMLUtils.getText(nextElement)); - } - - // <logFile> - else if (isElement(nextElement, WSIConstants.ELEM_LOG_FILE)) - { - String correlationType = - XMLUtils.getAttributeValue( - nextElement, - WSIConstants.ATTR_CORRELATION_TYPE); - analyzerConfig.setCorrelationType( - correlationType == null ? "operation" : correlationType); - analyzerConfig.setLogLocation(XMLUtils.getText(nextElement)); - } - - // <wsdlReference> - else if (isElement(nextElement, WSIConstants.ELEM_WSDL_REFERENCE)) - { - parseWsdlReference(analyzerConfig, nextElement); - } - - // <uddiReference> - else if (isElement(nextElement, WSIConstants.ELEM_UDDI_REFERENCE)) - { - parseUddiReference(analyzerConfig, nextElement); - } - - else - { - // Throw exception - throw new IllegalArgumentException( - getMessage( - "config06", - nextElement.getLocalName(), - "Invalid analyzer config element:")); - } - - // Get next element - nextElement = XMLUtils.getNextSibling(nextElement); - } - } - - /** - * Parse reportFile element. - */ - private void parseReportFileElement( - AnalyzerConfig analyzerConfig, - Element element) - throws WSIException - { - // Get report location and replace indicator - analyzerConfig.setReplaceReport( - XMLUtils.getBooleanValue(element, WSIConstants.ATTR_REPLACE, false)); - analyzerConfig.setReportLocation( - XMLUtils.getAttributeValue( - element, - WSIConstants.ATTR_LOCATION, - WSIConstants.DEFAULT_REPORT_URI)); - - // ADD: If the report location wasn't specified, then throw an exception - //if (analyzerConfig.getReportLocation() == null) - // throw new WSIException("The analyzer configuration file must contain the report file location."); - - // Get first child element - Element nextElement = XMLUtils.getFirstChild(element); - - // Process each child element - while (nextElement != null) - { - // <addStyleSheet> - if (isElement(nextElement, WSIConstants.ELEM_ADD_STYLE_SHEET)) - { - AddStyleSheet addStyleSheet = new AddStyleSheetImpl(); - - // Parse the element - TestUtils.parseAddStyleSheet( - nextElement, - addStyleSheet, - WSIConstants.DEFAULT_REPORT_XSL); - - // Set add style sheet - analyzerConfig.setAddStyleSheet(addStyleSheet); - } - - else - { - // Throw exception - throw new IllegalArgumentException( - getMessage( - "config06", - nextElement.getLocalName(), - "Invalid analyzer config element:")); - } - - // Get next element - nextElement = XMLUtils.getNextSibling(nextElement); - } - } - - /** - * Parse wsdl reference element. - */ - private void parseWsdlReference( - AnalyzerConfig analyzerConfig, - Element element) - throws WSIException - { - // Create UDDI reference - WSDLReference wsdlReference = new WSDLReferenceImpl(); - - // Set WSDL reference - analyzerConfig.setWSDLReference(wsdlReference); - - // Get first child element - Element nextElement = XMLUtils.getFirstChild(element); - - // Process each child element - while (nextElement != null) - { - // <wsdlURI> - if (isElement(nextElement, WSIConstants.ELEM_WSDL_URI)) - { - // Set WSDL location - wsdlReference.setWSDLLocation(XMLUtils.getText(nextElement)); - } - - // <serviceLocation> - else if (isElement(nextElement, WSIConstants.ELEM_SERVICE_LOCATION)) - { - // Set service location - wsdlReference.setServiceLocation(XMLUtils.getText(nextElement)); - } - - // <wsdlElement> - else if (isElement(nextElement, WSIConstants.ELEM_WSDL_ELEMENT)) - { - // Set WSDL element - wsdlReference.setWSDLElement(parseWsdlElement(nextElement)); - } - - else - { - // Throw exception - throw new IllegalArgumentException( - getMessage( - "config06", - nextElement.getLocalName(), - "Invalid analyzer config element:")); - } - - // Get next element - nextElement = XMLUtils.getNextSibling(nextElement); - } - - // If WSDL element or WSL URI not specified, then throw exception - if ((wsdlReference.getWSDLElement() == null) - || (wsdlReference.getWSDLLocation() == null)) - { - throw new IllegalArgumentException( - getMessage( - "config07", - "Both the <wsdlElement> and <wsdlURI> elements must be specified.")); - } - - // If type is port or operation, then parent element name must be specified - if (((wsdlReference - .getWSDLElement() - .getType() - .equalsIgnoreCase(EntryType.TYPE_DESCRIPTION_PORT)) - || (wsdlReference - .getWSDLElement() - .getType() - .equalsIgnoreCase(EntryType.TYPE_DESCRIPTION_OPERATION))) - && (wsdlReference.getWSDLElement().getParentElementName() == null)) - { - throw new IllegalArgumentException( - getMessage( - "config09", - "The parentElementName attribute must be specified with a WSDL type of " - + EntryType.TYPE_DESCRIPTION_PORT - + " or " - + EntryType.TYPE_DESCRIPTION_OPERATION - + ".")); - } - } - - /** - * Parse uddi reference. - */ - private void parseUddiReference( - AnalyzerConfig analyzerConfig, - Element element) - throws WSIException - { - // Create UDDI reference - UDDIReference uddiReference = new UDDIReferenceImpl(); - - // Set UDDI reference - analyzerConfig.setUDDIReference(uddiReference); - - // Get first child element - Element nextElement = XMLUtils.getFirstChild(element); - - // Process each child element - while (nextElement != null) - { - // <inquiryURL> - if (isElement(nextElement, WSIConstants.ELEM_INQUIRY_URL)) - { - // Set inquiry URL - uddiReference.setInquiryURL(XMLUtils.getText(nextElement)); - } - - // <uddiKey> - else if (isElement(nextElement, WSIConstants.ELEM_UDDI_KEY)) - { - // Set UDDI key and key type - uddiReference.setKey(XMLUtils.getText(nextElement)); - uddiReference.setKeyType( - XMLUtils.getAttributeValue(nextElement, WSIConstants.ATTR_TYPE)); - } - - // <wsdlElement> - else if (isElement(nextElement, WSIConstants.ELEM_WSDL_ELEMENT)) - { - // Set WSDL element - uddiReference.setWSDLElement(parseWsdlElement(nextElement)); - } - - // <serviceLocation> - else if (isElement(nextElement, WSIConstants.ELEM_SERVICE_LOCATION)) - { - // Set service location - uddiReference.setServiceLocation(XMLUtils.getText(nextElement)); - } - - /* REMOVE: - // <wsdlElement> - else if (isElement(nextElement, WSIConstants.ELEM_WSDL_ELEMENT)) { - // Set service location - parseWsdlElement(analyzerConfig, nextElement); - } - */ - - else - { - // Throw exception - throw new IllegalArgumentException( - getMessage( - "config06", - nextElement.getLocalName(), - "Invalid analyzer config element:")); - } - - // Get next element - nextElement = XMLUtils.getNextSibling(nextElement); - } - } - - /** - * Parse WSDL element. - */ - private WSDLElement parseWsdlElement(Element element) throws WSIException - { - WSDLElement wsdlElement = new WSDLElementImpl(); - - // Set type, namespace, parent element name and name - wsdlElement.setType( - XMLUtils.getAttributeValue(element, WSIConstants.ATTR_TYPE)); - wsdlElement.setNamespace( - XMLUtils.getAttributeValue(element, WSIConstants.ATTR_NAMESPACE)); - wsdlElement.setParentElementName( - XMLUtils.getAttributeValue( - element, - WSIConstants.ATTR_PARENT_ELEMENT_NAME)); - - String wsdlElementName = XMLUtils.getText(element); - if (wsdlElementName.equals("")) - { - // Throw exception - throw new IllegalArgumentException( - getMessage("config19", "The WSDL element name must be specified.")); - } - wsdlElement.setName(wsdlElementName); - - return wsdlElement; - } - - /** - * Determine if this element matches specified local name in the analyzer config namespace. - */ - private boolean isElement(Element element, String localName) - { - return isElement( - element, - getValidWSIAnalyzerConfigNamespaces(), - localName); - } - - - static public List getValidWSIAnalyzerConfigNamespaces() - { - ArrayList list = new ArrayList(); - list.add(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG_2003); - list.add(WSIConstants.NS_URI_WSI_ANALYZER_CONFIG); - return list; - } - - /** - * Determine if this element matches specified local name in the analyzer config namespace. - */ - private boolean isElement( - Element element, - List namespaces, - String localName) - { - return XMLUtils.isElement(element, namespaces, localName); - } - - /** - * Get message from resource bundle. - */ - private String getMessage(String messageID, String defaultMessage) - { - return getMessage(messageID, null, defaultMessage); - } - - /** - * Get message from resource bundle. - */ - private String getMessage( - String messageID, - String messageData, - String defaultMessage) - { - String message = defaultMessage; - if (messageList != null) - message = messageList.getMessage(messageID, messageData, defaultMessage); - else - message += " " + messageData + "."; - - return message; - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AssertionResultsOptionImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AssertionResultsOptionImpl.java deleted file mode 100644 index fbe3d0f74..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/AssertionResultsOptionImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2003 IBM Corporation, Parasoft and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of 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 - * Parasoft - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.analyzer.config.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultType; -import org.eclipse.wst.wsi.internal.core.analyzer.config.AssertionResultsOption; - -/** - * This class contains the assertion results option definition. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class AssertionResultsOptionImpl implements AssertionResultsOption -{ - /** - * Assertion result type. - */ - protected AssertionResultType resultType = AssertionResultType.ALL; - - /** - * Show message entry indicator. - */ - protected boolean showMessageEntry = true; - - /** - * Show assertion description indicator. - */ - protected boolean showAssertionDescription = false; - - /** - * Show failure message indicator. - */ - protected boolean showFailureMessage = true; - - /** - * Show failure detail indicator. - */ - protected boolean showFailureDetail = true; - - /** - * Get assertion result type. - * @see #setAssertionResultType - */ - public AssertionResultType getAssertionResultType() - { - return resultType; - } - - /** - * Set assertion result type. - * @see #getAssertionResultType - */ - public void setAssertionResultType(AssertionResultType resultType) - { - this.resultType = resultType; - } - - /** - * Get show message entry indicator. - * @see #setShowMessageEntry - */ - public boolean getShowMessageEntry() - { - return this.showMessageEntry; - } - - /** - * Set show message entry indictor. - * @see #getShowMessageEntry - */ - public void setShowMessageEntry(boolean showMessageEntry) - { - this.showMessageEntry = showMessageEntry; - } - - /** - * Get show assertion description indicator. - * @see #setShowAssertionDescription - */ - public boolean getShowAssertionDescription() - { - return this.showAssertionDescription; - } - - /** - * Set show assertion description indictor. - * @see #getShowAssertionDescription - */ - public void setShowAssertionDescription(boolean showAssertionDescription) - { - this.showAssertionDescription = showAssertionDescription; - } - - /** - * Get show failure message indicator. - * @see #setShowFailureMessage - */ - public boolean getShowFailureMessage() - { - return this.showFailureMessage; - } - - /** - * Set show failure mesage indicator. - * @see #getShowFailureMessage - */ - public void setShowFailureMessage(boolean showFailureMessage) - { - this.showFailureMessage = showFailureMessage; - } - - /** - * Get show failure detail indicator. - * @see #setShowFailureDetail - */ - public boolean getShowFailureDetail() - { - return this.showFailureDetail; - } - - /** - * Set show failure detail indicator. - * @see #getShowFailureDetail - */ - public void setShowFailureDetail(boolean showFailureDetail) - { - this.showFailureDetail = showFailureDetail; - } - - /** - * Get string representation of this object. - */ - public String toString() - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println(" Assertion Results:"); - pw.println(" type ..................... " + this.resultType); - pw.println(" messageEntry ............. " + this.showMessageEntry); - pw.println( - " assertionDescription ..... " + this.showAssertionDescription); - pw.println(" failureMessage ........... " + this.showFailureMessage); - pw.println(" failureDetail ............ " + this.showFailureDetail); - - return sw.toString(); - } - - /** - * Get representation of this object as an XML string. - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if ((!nsName.equals("") && (!nsName.endsWith(":")))) - nsName += ":"; - - // Config options - pw.print(" <" + nsName + WSIConstants.ELEM_ASSERTION_RESULTS + " "); - pw.print(WSIConstants.ATTR_TYPE + "=\"" + getAssertionResultType() + "\" "); - pw.print( - WSIConstants.ATTR_MESSAGE_ENTRY + "=\"" + getShowMessageEntry() + "\" "); - pw.print( - WSIConstants.ATTR_ASSERTION_DESCRIPTION - + "=\"" - + getShowAssertionDescription() - + "\" "); - pw.print( - WSIConstants.ATTR_FAILURE_MESSAGE - + "=\"" - + getShowFailureMessage() - + "\" "); - pw.println( - WSIConstants.ATTR_FAILURE_DETAIL - + "=\"" - + getShowFailureDetail() - + "\"/>"); - // REMOVE: - //pw.println(WSIConstants.ATTR_WARNING_MESSAGE + "=\"" + getShowWarningMessage() + "\"/>"); - - return sw.toString(); - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/UDDIReferenceImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/UDDIReferenceImpl.java deleted file mode 100644 index 8dc7b6c72..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/UDDIReferenceImpl.java +++ /dev/null @@ -1,197 +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.internal.core.analyzer.config.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; - -/** - * The iimplementation for a reference to a discovery artifact. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class UDDIReferenceImpl implements UDDIReference -{ - /** - * UDDI key type. - */ - protected String keyType = null; - - /** - * UDDI key. - */ - protected String key = null; - - /** - * UDDI inquiry URL. - */ - protected String inquiryURL = null; - - /** - * WSDL element. - */ - protected WSDLElement wsdlElement = null; - - /** - * Service location. - */ - protected String serviceLocation = null; - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#getKeyType() - */ - public String getKeyType() - { - return this.keyType; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#setKeyType(String) - */ - public void setKeyType(String keyType) - { - if (keyType.equals(BINDING_KEY) || keyType.equals(TMODEL_KEY)) - this.keyType = keyType; - else - throw new IllegalArgumentException( - "Invalid UDDI key type: [" + keyType + "]."); - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#getKey() - */ - public String getKey() - { - return this.key; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#setKey(String) - */ - public void setKey(String key) - { - this.key = key; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#getInquiryURL() - */ - public String getInquiryURL() - { - return this.inquiryURL; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference#setInquiryURL(String) - */ - public void setInquiryURL(String inquiryURL) - { - this.inquiryURL = inquiryURL; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#getWSDLElement() - */ - public WSDLElement getWSDLElement() - { - return this.wsdlElement; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#setWSDLElement(WSDLElement) - */ - public void setWSDLElement(WSDLElement wsdlElement) - { - this.wsdlElement = wsdlElement; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#getServiceLocation() - */ - public String getServiceLocation() - { - return this.serviceLocation; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#setServiceLocation() - */ - public void setServiceLocation(String serviceLocation) - { - this.serviceLocation = serviceLocation; - } - - /** - * Get string representation of this object. - */ - public String toString() - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println(" UDDI Reference: "); - pw.println(" UDDI Key: "); - pw.println(" type ................... " + this.keyType); - pw.println(" key .................... " + this.key); - pw.println(" inquiryURL ............... " + this.inquiryURL); - if (this.serviceLocation != null) - pw.println(" serviceLocation .......... " + this.serviceLocation); - if (this.wsdlElement != null) - pw.print(this.wsdlElement.toString()); - - return sw.toString(); - } - - /** - * @see org.eclipse.wst.wsi.internal.core.document.DocumentElement#toXMLString(String) - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if ((!nsName.equals("") && (!nsName.endsWith(":")))) - nsName += ":"; - - // Element - pw.println(" <" + nsName + ELEM_NAME + ">"); - pw.print(" <" + nsName + WSIConstants.ELEM_UDDI_KEY + " "); - pw.print(WSIConstants.ATTR_TYPE + "=\"" + getKeyType() + "\">"); - pw.print(getKey()); - pw.println("</" + nsName + WSIConstants.ELEM_UDDI_KEY + ">"); - pw.print(" <" + nsName + WSIConstants.ELEM_INQUIRY_URL + ">"); - pw.print(getInquiryURL()); - pw.println("</" + nsName + WSIConstants.ELEM_INQUIRY_URL + ">"); - - if (this.wsdlElement != null) - pw.print(getWSDLElement().toXMLString(nsName)); - - if (this.serviceLocation != null) - { - pw.print(" <" + nsName + WSIConstants.ELEM_SERVICE_LOCATION + ">"); - pw.print(getServiceLocation()); - pw.println( - " </" + nsName + WSIConstants.ELEM_SERVICE_LOCATION + ">"); - } - - pw.println(" </" + nsName + ELEM_NAME + ">"); - - return sw.toString(); - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLElementImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLElementImpl.java deleted file mode 100644 index ff14b85d9..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLElementImpl.java +++ /dev/null @@ -1,202 +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.internal.core.analyzer.config.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.util.EntryType; - -/** - * The implementation for WSDL definitions. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class WSDLElementImpl implements WSDLElement -{ - protected String type; - protected String namespace; - protected String name; - protected String parentElementName; - - /** - * @see #setType - */ - public String getType() - { - return this.type; - } - - /** - * @see #getType - */ - public void setType(String type) - { - this.type = type; - } - - /** - * @see #setNamespace - */ - public String getNamespace() - { - return this.namespace; - } - - /** - * @see #getNamespace - */ - public void setNamespace(String namespace) - { - this.namespace = namespace; - } - - /** - * @see #setName - */ - public String getName() - { - return this.name; - } - - /** - * @see #getName - */ - public void setName(String name) - { - this.name = name; - } - - public QName getQName() - { - return new QName(this.namespace, this.name); - } - - /** - * Get WSDL parent element name. - * @see #setParentElementName - - */ - public String getParentElementName() - { - return this.parentElementName; - } - - /** - * Set WSDL parent element name. - * @see #getParentElementName - */ - public void setParentElementName(String parentElementName) - { - this.parentElementName = parentElementName; - } - - /** - * @see org.eclipse.wst.wsi.test.analyzer.config.WSDLElement#getParentElementQName() - */ - public QName getParentElementQName() - { - return new QName(this.namespace, this.parentElementName); - } - - /** - * Is port element. - */ - public boolean isPort() - { - return type.equals(EntryType.TYPE_DESCRIPTION_PORT); - } - - /** - * Is binding element. - */ - public boolean isBinding() - { - return type.equals(EntryType.TYPE_DESCRIPTION_BINDING); - } - - /** - * Is portType element. - */ - public boolean isPortType() - { - return type.equals(EntryType.TYPE_DESCRIPTION_PORTTYPE); - } - - /** - * Is operation element. - */ - public boolean isOperation() - { - return type.equals(EntryType.TYPE_DESCRIPTION_OPERATION); - } - - /** - * Is message element. - */ - public boolean isMessage() - { - return type.equals(EntryType.TYPE_DESCRIPTION_MESSAGE); - } - - /** - * Get string representation of this object. - */ - public String toString() - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println(" WSDL Element: "); - pw.println(" type ................... " + this.type); - pw.println(" namespace .............. " + this.namespace); - pw.println(" name ................... " + this.name); - - if (this.parentElementName != null) - pw.println(" parentElementName ...... " + this.parentElementName); - - return sw.toString(); - } - - /** - * Get representation of this object as an XML string. - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if ((!nsName.equals("") && (!nsName.endsWith(":")))) - nsName += ":"; - - // Config options - pw.print(" <" + nsName + ELEM_NAME + " "); - pw.print(WSIConstants.ATTR_TYPE + "=\"" + getType() + "\" "); - pw.print(WSIConstants.ATTR_NAMESPACE + "=\"" + getNamespace() + "\" "); - if (this.parentElementName != null) - pw.print( - WSIConstants.ATTR_PARENT_ELEMENT_NAME - + "=\"" - + getParentElementName() - + "\""); - pw.print(">"); - pw.print(getName()); - pw.println("</" + nsName + ELEM_NAME + ">"); - - return sw.toString(); - } -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLReferenceImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLReferenceImpl.java deleted file mode 100644 index 64bff4363..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/analyzer/config/impl/WSDLReferenceImpl.java +++ /dev/null @@ -1,163 +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.internal.core.analyzer.config.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference; -import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; - -/** - * The implementation for a reference to a description artifact. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class WSDLReferenceImpl implements WSDLReference -{ - /** - * WSDL element. - */ - protected WSDLElement wsdlElement = null; - - /** - * Service location. - */ - protected String serviceLocation = null; - - /** - * WSDL document location. - */ - protected String wsdlLocation = null; - - /** - * Default constructor. - */ - public WSDLReferenceImpl() - { - } - - /** - * Constructor with all settings. - * @param wsdlElement a WSDL element. - * @param wsdlLocation a WSDL document location. - * @param serviceLocation a service location. - */ - public WSDLReferenceImpl( - WSDLElement wsdlElement, - String wsdlLocation, - String serviceLocation) - { - this.wsdlElement = wsdlElement; - this.wsdlLocation = wsdlLocation; - this.serviceLocation = serviceLocation; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#getWSDLElement() - */ - public WSDLElement getWSDLElement() - { - return this.wsdlElement; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#setWSDLElement(WSDLElement) - */ - public void setWSDLElement(WSDLElement wsdlElement) - { - this.wsdlElement = wsdlElement; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#getWSDLLocation() - */ - public String getWSDLLocation() - { - return this.wsdlLocation; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#setWSDLLocation() - */ - public void setWSDLLocation(String wsdlLocation) - { - this.wsdlLocation = wsdlLocation; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#getServiceLocation() - */ - public String getServiceLocation() - { - return this.serviceLocation; - } - - /** - * @see org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLReference#setServiceLocation() - */ - public void setServiceLocation(String serviceLocation) - { - this.serviceLocation = serviceLocation; - } - - /** - * Get string representation of this object. - */ - public String toString() - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println(" WSDL Reference:"); - pw.print(this.wsdlElement.toString()); - pw.println(" wsdlURI .................. " + this.wsdlLocation); - if (this.serviceLocation != null) - pw.println(" serviceLocation .......... " + this.serviceLocation); - - return sw.toString(); - } - - /** - * @see org.eclipse.wst.wsi.internal.core.document.DocumentElement#toXMLString(String) - */ - public String toXMLString(String namespaceName) - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - String nsName = namespaceName; - if ((!nsName.equals("") && (!nsName.endsWith(":")))) - nsName += ":"; - - // Element - pw.println(" <" + nsName + ELEM_NAME + ">"); - pw.print(getWSDLElement().toXMLString(nsName)); - pw.print(" <" + nsName + WSIConstants.ELEM_WSDL_URI + ">"); - pw.print(getWSDLLocation()); - pw.println("</" + nsName + WSIConstants.ELEM_WSDL_URI + ">"); - - if (this.serviceLocation != null) - { - pw.print(" <" + nsName + WSIConstants.ELEM_SERVICE_LOCATION + ">"); - pw.print(XMLUtils.xmlEscapedString(getServiceLocation())); - pw.println("</" + nsName + WSIConstants.ELEM_SERVICE_LOCATION + ">"); - } - - pw.println(" </" + nsName + ELEM_NAME + ">"); - - return sw.toString(); - } - -} |