diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml')
11 files changed, 0 insertions, 1480 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/AbstractXMLConformanceFactory.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/AbstractXMLConformanceFactory.java deleted file mode 100644 index d7cb52e10..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/AbstractXMLConformanceFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -/** - * Factory for generating objects needed for XML Conformance validation. - */ -public abstract class AbstractXMLConformanceFactory -{ - protected static AbstractXMLConformanceFactory instance; - - /** - * Returns the instance of this factory. - * - * @return the instance of this factory - */ - public static AbstractXMLConformanceFactory getInstance() - { - if (instance == null) - { - instance = new DefaultXMLConformanceFactory(); - } - return instance; - } - - /** - * Set the implementation for this factory to use. - * - * @param factory - the implementation this factory will use - */ - public static void setImplementation(AbstractXMLConformanceFactory factory) - { - instance = factory; - } - - /** - * Return an XML validator. - * - * @return an XML validator - */ - abstract public IXMLValidator getXMLValidator(); -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLConformanceFactory.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLConformanceFactory.java deleted file mode 100644 index 1e4e15c4d..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLConformanceFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - - -/** - * The default implementation of AbstractXMLConformanceFactory. - */ -public class DefaultXMLConformanceFactory extends AbstractXMLConformanceFactory -{ - - /** - * Constructor. - */ - public DefaultXMLConformanceFactory() - { - } - - /** - * @see org.eclipse.wst.wsdl.validation.internal.xml.AbstractXMLConformanceFactory#getXMLValidator() - */ - public IXMLValidator getXMLValidator() - { - return new DefaultXMLValidator(); - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLValidator.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLValidator.java deleted file mode 100644 index c653304b8..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/DefaultXMLValidator.java +++ /dev/null @@ -1,473 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.Stack; -import java.util.TreeSet; - -import org.apache.xerces.impl.XMLErrorReporter; -import org.apache.xerces.parsers.SAXParser; -import org.apache.xerces.parsers.StandardParserConfiguration; -import org.apache.xerces.xni.XMLResourceIdentifier; -import org.apache.xerces.xni.XNIException; -import org.apache.xerces.xni.grammars.XMLGrammarPool; -import org.apache.xerces.xni.parser.XMLEntityResolver; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.eclipse.wst.wsdl.validation.internal.ValidationMessageImpl; -import org.eclipse.wst.wsdl.validation.internal.logging.ILogger; -import org.eclipse.wst.wsdl.validation.internal.logging.LoggerFactory; -import org.eclipse.wst.wsdl.validation.internal.resolver.IURIResolutionResult; -import org.eclipse.wst.wsdl.validation.internal.resolver.URIResolver; -import org.eclipse.wst.wsdl.validation.internal.wsdl11.xsd.XSDValidator; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; - -import com.ibm.wsdl.Constants; - -/** - * The default implementation of IXMLValidator. - */ -public class DefaultXMLValidator implements IXMLValidator -{ - protected String uri; - protected URIResolver uriResolver = null; - protected List errors = new ArrayList(); - //protected StringBuffer schemaLocationString = new StringBuffer(); - protected List ignoredNamespaceList = new ArrayList(); - - protected InputStream inputStream = null; - - protected String currentErrorKey = null; - protected Object[] currentMessageArguments = null; - - protected boolean isChildOfDoc = false; - protected XMLGrammarPool grammarPool = null; - - /** - * A stack of start tag locations, used to move errors - * reported at the close tag to be reported at the start tag. - */ - protected Stack startElementLocations = new Stack(); - protected Set adjustLocationErrorKeySet = new TreeSet(); - -/** - * Constructor. - */ - public DefaultXMLValidator() - { - super(); - - ignoredNamespaceList.add(Constants.NS_URI_XSD_1999); - ignoredNamespaceList.add(Constants.NS_URI_XSD_2000); - ignoredNamespaceList.add(Constants.NS_URI_XSD_2001); - - adjustLocationErrorKeySet.add("cvc-complex-type.2.4.b"); - adjustLocationErrorKeySet.add("cvc-complex-type.2.3"); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.validation.internal.xml.IXMLValidator#setFile(java.lang.String) - */ - public void setFile(String uri) - { - this.uri = uri; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.validation.internal.xml.IXMLValidator#setURIResolver(org.eclipse.wst.wsdl.validation.internal.resolver.URIResolver) - */ - public void setURIResolver(URIResolver uriResolver) - { - this.uriResolver = uriResolver; - } - - /** - * @param grammarPool - */ - public void setGrammarPool(XMLGrammarPool grammarPool) - { - this.grammarPool = grammarPool; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.validation.internal.xml.IXMLValidator#run() - */ - public void run() - { - // Validate the XML file. - try - { - Reader reader1 = null; // Used for validation parse. - - InputSource validateInputSource; - - validateInputSource = new InputSource(uri); - if (this.inputStream != null) - { - String string = createStringForInputStream(inputStream); - reader1 = new StringReader(string); - - validateInputSource.setByteStream(inputStream); - validateInputSource.setCharacterStream(reader1); - } - - XMLReader reader = createXMLReader(); - reader.parse(validateInputSource); - } - catch (SAXParseException e) - { - // No need to add an error here. SAXParseExceptions are reported by the error reporter. - } - catch (IOException e) - { - // No need to log this error. The WSDL validator will catch this error when creating the dom model. - //LoggerFactory.getInstance().getLogger().log("The WSDL validator was unable to read file " + uri + ".", ILogger.SEV_ERROR, e); - } - catch (Exception e) - { - LoggerFactory.getInstance().getLogger().log("An exception occurred while performing WSDL XML conformance validation for file " + uri + ".", ILogger.SEV_ERROR, e); - } - } - - /** - * @param inputStream - * @return - */ - final String createStringForInputStream(InputStream inputStream) - { - // Here we are reading the file and storing to a stringbuffer. - StringBuffer fileString = new StringBuffer(); - try - { - InputStreamReader inputReader = new InputStreamReader(inputStream); - BufferedReader reader = new BufferedReader(inputReader); - char[] chars = new char[1024]; - int numberRead = reader.read(chars); - while (numberRead != -1) - { - fileString.append(chars, 0, numberRead); - numberRead = reader.read(chars); - } - } - catch (Exception e) - { - LoggerFactory.getInstance().getLogger().log("The WSDL valdiator was unable to create to create a string representation of an input stream. WSDL XML validation may not have run correctly.", ILogger.SEV_ERROR, e); - } - return fileString.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.validation.internal.xml.IXMLValidator#hasErrors() - */ - public boolean hasErrors() - { - return !errors.isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.validation.internal.xml.IXMLValidator#getErrors() - */ - public List getErrors() - { - return errors; - } - - /** - * @param message - * @param line - * @param column - * @param uri - */ - public void addError(String message, int line, int column, String uri) - { - // For the following errors the line number will be modified to use that of the start - // tag instead of the end tag. - if (currentErrorKey != null && adjustLocationErrorKeySet.contains(currentErrorKey)) - { - LocationCoordinate adjustedCoordinates = (LocationCoordinate)startElementLocations.peek(); - line = adjustedCoordinates.getLineNumber(); - column = adjustedCoordinates.getColumnNumner(); - } - - errors.add(new ValidationMessageImpl(message, line, column, ValidationMessageImpl.SEV_WARNING, uri, currentErrorKey, currentMessageArguments)); - } - - /** - * The handler for the SAX parser. This handler will obtain the WSDL - * namespace, handle errors and resolve entities. - */ - protected class XMLConformanceDefaultHandler extends DefaultHandler - { - private Locator locator = null; - - public void setDocumentLocator(Locator locator) - { - this.locator = locator; - super.setDocumentLocator(locator); - } - - /** - * @see org.xml.sax.ErrorHandler#error(SAXParseException) - */ - public void error(SAXParseException arg0) throws SAXException - { - String tempURI = arg0.getSystemId(); - if (inputStream!= null && arg0.getSystemId() == null) - { - //mh: In this case we are validating a stream so the URI may be null in this exception - tempURI = uri; - } - addError(arg0.getMessage(), arg0.getLineNumber(), arg0.getColumnNumber(), tempURI); - } - - /** - * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) - */ - public void fatalError(SAXParseException arg0) throws SAXException - { - addError(arg0.getMessage(), arg0.getLineNumber(), arg0.getColumnNumber(), arg0.getSystemId()); - } - - /** - * @see org.xml.sax.ErrorHandler#warning(SAXParseException) - */ - public void warning(SAXParseException arg0) throws SAXException - { - addError(arg0.getMessage(), arg0.getLineNumber(), arg0.getColumnNumber(), arg0.getSystemId()); - } - - /** - * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) - */ - public void endElement(String uri, String localName, String qName) - throws SAXException { - if(localName.equals("documentation") && (uri.equals(Constants.NS_URI_WSDL) || uri.equals(Constants.NS_URI_XSD_2001)|| uri.equals(Constants.NS_URI_XSD_1999) || uri.equals(Constants.NS_URI_XSD_2000))) - { - isChildOfDoc = false; - } - super.endElement(uri, localName, qName); - startElementLocations.pop(); - } - /** - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement(String uri, String localName, String qName, - Attributes atts) throws SAXException { - startElementLocations.push(new LocationCoordinate(locator.getLineNumber(), locator.getColumnNumber())); - if(localName.equals("documentation") && (uri.equals(Constants.NS_URI_WSDL) || uri.equals(Constants.NS_URI_XSD_2001)|| uri.equals(Constants.NS_URI_XSD_1999) || uri.equals(Constants.NS_URI_XSD_2000))) - { - isChildOfDoc = true; - } - super.startElement(uri, localName, qName, atts); - } - } - - /** - * @param inputStream - set the inputStream to validate - */ - public void setInputStream(InputStream inputStream) - { - this.inputStream = inputStream; - } - - protected class XMLValidatorParserConfiguration extends StandardParserConfiguration - { - /* (non-Javadoc) - * @see org.apache.xerces.parsers.DTDConfiguration#createErrorReporter() - */ - protected XMLErrorReporter createErrorReporter() - { - return new XMLErrorReporter() - { - /* (non-Javadoc) - * @see org.apache.xerces.impl.XMLErrorReporter#reportError(java.lang.String, java.lang.String, java.lang.Object[], short) - */ - public void reportError(String domain, String key, Object[] arguments, - short severity) throws XNIException - { - currentErrorKey = key; - currentMessageArguments = arguments; - super.reportError(domain, key, arguments, severity); - } - }; - } - } - - /** - * Create an XML Reader. - * - * @return The newly created XML reader or null if unsuccessful. - * @throws Exception - */ - protected XMLReader createXMLReader() throws Exception - { - SAXParser reader = null; - try - { - reader = new org.apache.xerces.parsers.SAXParser(new XMLValidatorParserConfiguration()); - - XMLConformanceDefaultHandler conformanceDefaultHandler = new XMLConformanceDefaultHandler(); - reader.setErrorHandler(conformanceDefaultHandler); - reader.setContentHandler(conformanceDefaultHandler); - - // Older Xerces versions will thrown a NPE if a null grammar pool is set. - if(grammarPool != null) - { - reader.setProperty(org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY, grammarPool); - } - reader.setProperty(org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + org.apache.xerces.impl.Constants.ENTITY_RESOLVER_PROPERTY, new MyEntityResolver(uriResolver)); - reader.setFeature(org.apache.xerces.impl.Constants.XERCES_FEATURE_PREFIX + org.apache.xerces.impl.Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE, false); - reader.setFeature(org.apache.xerces.impl.Constants.SAX_FEATURE_PREFIX + org.apache.xerces.impl.Constants.NAMESPACES_FEATURE, true); - reader.setFeature(org.apache.xerces.impl.Constants.SAX_FEATURE_PREFIX + org.apache.xerces.impl.Constants.NAMESPACE_PREFIXES_FEATURE, true); - reader.setFeature(org.apache.xerces.impl.Constants.SAX_FEATURE_PREFIX + org.apache.xerces.impl.Constants.VALIDATION_FEATURE, true); - reader.setFeature(org.apache.xerces.impl.Constants.XERCES_FEATURE_PREFIX + org.apache.xerces.impl.Constants.SCHEMA_VALIDATION_FEATURE, true); - } - catch(Exception e) - { - LoggerFactory.getInstance().getLogger().log("Error creating XML reader for WSDL XML conformance validation.", ILogger.SEV_ERROR, e); - } - return reader; - } - - /** - * A custom entity resolver that uses the URI resolver specified to resolve entities. - */ - protected class MyEntityResolver implements XMLEntityResolver - { - private URIResolver uriResolver; - - /** - * Constructor. - * - * @param uriResolver The URI resolver to use with this entity resolver. - */ - public MyEntityResolver(URIResolver uriResolver) - { - this.uriResolver = uriResolver; - } - - /* (non-Javadoc) - * @see org.apache.xerces.xni.parser.XMLEntityResolver#resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier) - */ - public XMLInputSource resolveEntity(XMLResourceIdentifier rid) throws XNIException, IOException - { - // If we're currently examining a subelement of the - // WSDL or schema documentation element we don't want to resolve it - // as anything is allowed as a child of documentation. - if(isChildOfDoc) - { - return new XMLInputSource(rid); - } - - boolean nsUsed = false; - - String ns = rid.getNamespace(); - if(ns != null && ignoredNamespaceList.contains(ns)) - { - return new XMLInputSource(rid); - } - - String systemId = rid.getLiteralSystemId(); - if(systemId == null) - { - systemId = ns; - nsUsed = true; - } - String publicId = rid.getPublicId(); - if(publicId == null) - { - publicId = systemId; - } - - // Xerces tends to try to resolve locations with no information. - // No need to do any processing if we have no information. - if(publicId != null || systemId != null) - { - IURIResolutionResult result = uriResolver.resolve("", publicId, systemId); - String uri = result.getPhysicalLocation(); - if (uri != null && !uri.equals("")) - { - // If the namespace was used to resolve this reference ensure a schema - // has been returned. Namespaces tend to point to Web resources that - // may or may not be schemas. - boolean createEntityResult = true; - if(nsUsed) - { - XSDValidator xsdVal = new XSDValidator(); - xsdVal.validate(uri, uriResolver, null); - if(!xsdVal.isValid()) - createEntityResult = false; - } - - if(createEntityResult) - { - try - { - URL entityURL = new URL(uri); - XMLInputSource is = new XMLInputSource(rid.getPublicId(), systemId, result.getLogicalLocation()); - is.setByteStream(entityURL.openStream()); - if (is != null) - { - return is; - } - } - catch(Exception e) - { - // No need to report this error. Simply continue below. - } - } - } - } - return null; - } - } - - /** - * A line and column number coordinate. - */ - protected class LocationCoordinate - { - private int lineNo = -1; - private int columnNo = -1; - - public LocationCoordinate(int lineNumber, int columnNumber) - { - this.lineNo = lineNumber; - this.columnNo = columnNumber; - } - - public int getLineNumber() - { - return this.lineNo; - } - - public int getColumnNumner() - { - return this.columnNo; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/ElementLocation.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/ElementLocation.java deleted file mode 100644 index 57d9a3abe..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/ElementLocation.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -/** - * Holds the location information for an element in the model. - */ -public class ElementLocation -{ - public static final String ID = "location"; - protected int line; - protected int column; - /** - * Constructor. - * - * @param line - the line location of the element - * @param column - the column location of the element - */ - public ElementLocation(int line, int column) - { - this.line = line; - this.column = column; - } - - /** - * Return the line number for this element. - * - * @return the line number for this element - */ - public int getLineNumber() - { - return line; - } - - /** - * Return the column number for this element. - * - * @return the column number for this element - */ - public int getColumnNumber() - { - return column; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLCatalog.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLCatalog.java deleted file mode 100644 index 43f456e45..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLCatalog.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -/** - * An interface for an XML catalog. - */ -public interface IXMLCatalog -{ - - /** - * Add a public id and a location to the catalog. - * - * @param publicId - - * the public id of the entry - * @param systemId - - * the system id of the entry - */ - public abstract void addEntryToCatalog(String publicId, String systemId); - - /** - * Resolve the location of an entity given public and system ids. - * - * @param publicId - - * the public id of the entity to be resolved - * @param systemId - - * the system id of the entity to be resolved - * @return the location of the entity - */ - public abstract String resolveEntityLocation(String publicId, String systemId); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLValidator.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLValidator.java deleted file mode 100644 index f97001407..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/IXMLValidator.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -import java.util.List; - -import org.eclipse.wst.wsdl.validation.internal.resolver.URIResolver; - -/** - * An interface for an XML validator. - */ -public interface IXMLValidator -{ - /** - * Set the file to be validated. - * - * @param uri - the uri of the file to be validated - */ - public void setFile(String uri); - - /** - * Validate the file. - */ - public void run(); - - /** - * Returns true if there were validation errors, false otherwise. - * - * @return true if there were validation errors, false otherwise - */ - public boolean hasErrors(); - - /** - * Returns the list of errors. - * - * @return the list of errors - */ - public List getErrors(); - - /** - * Set the URI resolver to use. - * - * @param uriResolver The URI resolver to use. - */ - public void setURIResolver(URIResolver uriResolver); -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/LineNumberDOMParser.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/LineNumberDOMParser.java deleted file mode 100644 index 0ade3673c..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/LineNumberDOMParser.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -import org.apache.xerces.dom.ElementImpl; -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.xni.Augmentations; -import org.apache.xerces.xni.NamespaceContext; -import org.apache.xerces.xni.QName; -import org.apache.xerces.xni.XMLAttributes; -import org.apache.xerces.xni.XMLLocator; -import org.apache.xerces.xni.XNIException; -import org.apache.xerces.xni.grammars.XMLGrammarPool; -import org.apache.xerces.xni.parser.XMLParserConfiguration; -import org.w3c.dom.Element; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; - -import com.ibm.wsdl.Constants; - -/** - * A DOM parser that will register location information with the elements in the model. - */ -public class LineNumberDOMParser extends DOMParser -{ - XMLLocator locator = null; - - /** - * Constructor. - */ - public LineNumberDOMParser() - { - super(); - try - { - setFeature(DEFER_NODE_EXPANSION, false); - } - catch (SAXNotSupportedException e) - { - System.out.println(e); - } - catch (SAXNotRecognizedException e) - { - System.out.println(e); - } - } - - /** - * Constuctor. - * - * @param arg0 The parser configuration. - */ - public LineNumberDOMParser(XMLParserConfiguration arg0) - { - super(arg0); - try - { - setFeature(DEFER_NODE_EXPANSION, false); - } - catch (SAXNotSupportedException e) - { - System.out.println(e); - } - catch (SAXNotRecognizedException e) - { - System.out.println(e); - } - } - - /** - * Constructor. - * - * @param arg0 A symbol table for the parser. - */ - public LineNumberDOMParser(SymbolTable arg0) - { - super(arg0); - } - - /** - * Constructor. - * - * @param arg0 A symbol table for the parser. - * @param arg1 A grammar pool for the parser. - */ - public LineNumberDOMParser(SymbolTable arg0, XMLGrammarPool arg1) - { - super(arg0, arg1); - } - - /** - * @see org.apache.xerces.xni.XMLDocumentHandler#startElement(org.apache.xerces.xni.QName, org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations) - */ - public void startElement(QName arg0, XMLAttributes arg1, Augmentations arg2) throws XNIException - { - Element element; - // For elements from the Schema namespace we want to preserve them - // the way they were entered. Revert the values to the non-normalized values. - String ns = arg0.uri; - if(ns != null && (ns.equals(Constants.NS_URI_XSD_2001) || ns.equals(Constants.NS_URI_XSD_1999) || ns.equals(Constants.NS_URI_XSD_2000))) - { - int numatts = arg1.getLength(); - for(int i = 0; i < numatts; i++) - { - String nonNormalizedValue = arg1.getNonNormalizedValue(i); - arg1.setValue(i, nonNormalizedValue); - } - } - super.startElement(arg0, arg1, arg2); - try - { - element = (Element)getProperty(CURRENT_ELEMENT_NODE); - ElementImpl elementImpl = (ElementImpl)element; - // Setting the user data with an identifier such as ElementLocation.KEY_NAME - // may be a long term good idea. The setUserData method with no id is used - // to support JVMs with alternate versions of Xerces. - elementImpl.setUserData(new ElementLocation(locator.getLineNumber(), locator.getColumnNumber())); - } - // catch SAXNotRecognizedException and SAXNotSupportedException if can't get element - catch (ClassCastException e) - { - //System.out.println(e); - } - catch (SAXNotRecognizedException e) - { - //System.out.println(e); - } - catch (SAXNotSupportedException e) - { - //System.out.println(e); - } - } - - /** - * @see org.apache.xerces.xni.XMLDocumentHandler#startDocument(org.apache.xerces.xni.XMLLocator, java.lang.String, org.apache.xerces.xni.NamespaceContext, org.apache.xerces.xni.Augmentations) - */ - public void startDocument(XMLLocator arg0, String arg1, NamespaceContext arg2, Augmentations arg3) - throws XNIException - { - locator = arg0; - super.startDocument(arg0, arg1, arg2, arg3); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalog.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalog.java deleted file mode 100644 index f99887bcf..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalog.java +++ /dev/null @@ -1,364 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.wst.wsdl.validation.internal.xml; - -import java.io.File; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.xerces.jaxp.SAXParserFactoryImpl; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * XMLCatalog This class can be used to register, obtain and delete an instance - * of an XML catalog. Method definitions are provided for the catalog to set a - * location in the catalog and resolve an entity from the catalog. - */ -public class XMLCatalog implements IXMLCatalog -{ - //private final static String _APACHE_FEATURE_CONTINUE_AFTER_FATAL_ERROR = "http://apache.org/xml/features/continue-after-fatal-error"; - - private final static String _APACHE_FEATURE_NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; - - private final static String _APACHE_FEATURE_NAMESPACES = "http://xml.org/sax/features/namespaces"; - - //private final static String _APACHE_FEATURE_VALIDATION = "http://xml.org/sax/features/validation"; - - //private final static String _APACHE_FEATURE_VALIDATION_SCHEMA = "http://apache.org/xml/features/validation/schema"; - - private final static String FILE_PROTOCOL = "file:///"; - - private static IXMLCatalog instance = null; - - private static String extxmlcatalogclass = null; - - private static ClassLoader extclassLoader = null; - - private static IXMLCatalog extXMLCatalogInstance = null; - - private static List schemadirs = new ArrayList(); - - private static List entities = new ArrayList(); - - /** - * A hashtable to hold the XML catalog entries. - */ - protected Map catalog = new Hashtable(); - - /** - * Return an instance of the XML catalog. Assigns all registered schemas to - * the XML catalog. - * - * @return The instance of the XML catalog. - */ - public static IXMLCatalog getInstance() - { - if (instance == null) - { - instance = new XMLCatalog(); - - // Add the registered entities to the catalog. - Iterator entityIter = entities.iterator(); - while (entityIter.hasNext()) - { - XMLCatalogEntityHolder entity = (XMLCatalogEntityHolder) entityIter.next(); - instance.addEntryToCatalog(entity.getPublicId(), entity.getSystemId()); - } - - // Add the schemas in the schema directories to the catalog. - if (schemadirs.size() > 0) - { - SAXParser saxParser = null; - try - { - SAXParserFactory parserfactory = new SAXParserFactoryImpl(); - parserfactory.setFeature(_APACHE_FEATURE_NAMESPACE_PREFIXES, true); - parserfactory.setFeature(_APACHE_FEATURE_NAMESPACES, true); - saxParser = parserfactory.newSAXParser(); - } - catch (FactoryConfigurationError e) - { - } - catch (SAXNotRecognizedException e) - { - } - catch (ParserConfigurationException e) - { - } - catch (SAXNotSupportedException e) - { - } - catch (SAXException e) - { - } - Iterator schemadirIter = schemadirs.iterator(); - SchemaNamespaceHandler handler = ((XMLCatalog) instance).new SchemaNamespaceHandler(); - while (schemadirIter.hasNext()) - { - String schemadir = (String) schemadirIter.next(); - registerSchemasForDir(instance, schemadir, saxParser, handler); - } - } - } - return instance; - } - - /** - * Register the schemas in the given directory and all subdirectories with the - * XML catalog. - * - * @param catalog - * The catalog to register the schemas with. - * @param schemadir - * The schema directory to search for schema files. - * @param parser - * The SAXParser to use to parse the schemas for their - * targetNamespace. - * @param handler - * The handler to use to get the targetNamespace. - */ - private static void registerSchemasForDir(IXMLCatalog catalog, String schemadir, SAXParser parser, - SchemaNamespaceHandler handler) - { - // Remove file: and file:/ from beginning of file location if they are present. - if(schemadir.startsWith("file:")) - { - schemadir = schemadir.substring(5); - } - while(schemadir.startsWith("//")) - { - schemadir = schemadir.substring(1); - } - - File dir = new File(schemadir); - if (dir.isDirectory()) - { - File[] files = dir.listFiles(); - int numfiles = files.length; - for (int i = 0; i < numfiles; i++) - { - File tempfile = files[i]; - String tempfilepath = tempfile.getAbsolutePath(); - tempfilepath = tempfilepath.replace('\\','/'); - while(tempfilepath.startsWith("/")) - { - tempfilepath = tempfilepath.substring(1); - } - tempfilepath = FILE_PROTOCOL + tempfilepath; - if (tempfile.isDirectory()) - { - registerSchemasForDir(catalog, tempfilepath, parser, handler); - } else - { - handler.reset(); - try - { - parser.parse(tempfilepath, handler); - } - catch (Exception e) - { - // TODO: log error. - } - String targetNamespace = handler.getTargetNamespace(); - if (targetNamespace != null) - { - catalog.addEntryToCatalog(targetNamespace, tempfilepath); - } - } - } - } - } - - /** - * Get the instance of the extension XML catalog. Returns the instance if one - * is registered and can be created, null otherwise. - * - * @return The instance of the extension XML catalog if one is registered, - * null otherwise. - */ - public static IXMLCatalog getExtensionCatalogInstance() - { - if (extXMLCatalogInstance == null) - { - if (extxmlcatalogclass != null && extclassLoader != null) - { - try - { - Class catalogClass = extclassLoader != null ? extclassLoader.loadClass(extxmlcatalogclass) : Class - .forName(extxmlcatalogclass); - extXMLCatalogInstance = (IXMLCatalog) catalogClass.newInstance(); - } - catch (Exception e) - { - //TODO: Log error - } - } - } - return extXMLCatalogInstance; - } - - /** - * Set the class of the XML catalog to be used. - * - * @param xmlcatalog - * The class of the XML catalog to be used. - * @param classloader - * The classloader to use to load the catalog. - */ - public static void setExtensionXMLCatalog(String xmlcatalog, ClassLoader classloader) - { - extxmlcatalogclass = xmlcatalog; - extclassLoader = classloader; - } - - /** - * Resets the instance of the XML catalog to null. For deleting the catalog if - * necessary. - */ - public static void reset() - { - instance = null; - extxmlcatalogclass = null; - extclassLoader = null; - extXMLCatalogInstance = null; - entities = new ArrayList(); - schemadirs = new ArrayList(); - } - - /** - * Add a schema directory to be checked for schemas to register in the - * catalog. - * - * @param schemadir - * The directory to check for schemas. - */ - public static void addSchemaDir(String schemadir) - { - schemadirs.add(schemadir); - } - - /** - * Add an entity to the catalog. - * - * @param entity - * The entity to add to the catalog. - */ - public static void addEntity(XMLCatalogEntityHolder entity) - { - entities.add(entity); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wsdl.validate.internal.xml.IXMLCatalog#addEntryToCatalog(java.lang.String, - * java.lang.String) - */ - public void addEntryToCatalog(String publicId, String systemId) - { - catalog.put(publicId, systemId); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wsdl.validate.internal.xml.IXMLCatalog#resolveEntityLocation(java.lang.String, - * java.lang.String) - */ - public String resolveEntityLocation(String publicId, String systemId) - { - String resolvedlocation = null; - // First try to resolve using the ext catalog. - IXMLCatalog extcatalog = getExtensionCatalogInstance(); - if (extcatalog != null) - { - resolvedlocation = extcatalog.resolveEntityLocation(publicId, systemId); - } - if (resolvedlocation == null) - { - // if there's no system id use the public id - if (systemId == null || systemId.equals("")) - { - systemId = publicId; - } - resolvedlocation = (String) catalog.get(systemId); - } - return resolvedlocation; - } - - /** - * A handler used in parsing to get the targetNamespace string of a schema. - */ - protected class SchemaNamespaceHandler extends DefaultHandler - { - private final String TARGET_NAMESPACE = "targetNamespace"; - - private final String SCHEMA = "schema"; - - private String targetNamespace = null; - - /** - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, - * java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement(String uri, String localname, String arg2, Attributes attributes) throws SAXException - { - if (localname.equals(SCHEMA)) - { - - int numAtts = attributes.getLength(); - for (int i = 0; i < numAtts; i++) - { - - String attname = attributes.getQName(i); - if (attname.equals(TARGET_NAMESPACE)) - { - targetNamespace = attributes.getValue(i); - } - } - - } - super.startElement(uri, localname, arg2, attributes); - } - - /** - * Return the targetNamespace found by parsing the file. - * - * @return The targetNamespace found by parsing the file. - */ - public String getTargetNamespace() - { - return targetNamespace; - } - - /** - * Reset the state of the handler so it can be reused. - */ - public void reset() - { - targetNamespace = null; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogEntityHolder.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogEntityHolder.java deleted file mode 100644 index 5eca6ac92..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogEntityHolder.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -/** - * A container to hold the entity information until an XML catalog is - * to be initialized. - */ -public class XMLCatalogEntityHolder -{ - private String publicId; - private String systemId; - - /** - * Constructor. - * - * @param publicId The public id of the entity. - * @param systemId The system id of the entity. - */ - public XMLCatalogEntityHolder(String publicId, String systemId) - { - this.publicId = publicId; - this.systemId = systemId; - } - - /** - * Returns the public id of the entity. - * @return The public id of the entity. - */ - public String getPublicId() - { - return publicId; - } - - /** - * Returns the system id of the entity. - * @return The system id of the entity. - */ - public String getSystemId() - { - return systemId; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogResolver.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogResolver.java deleted file mode 100644 index 0e850c0e5..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogResolver.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -import java.io.IOException; - -import org.apache.xerces.xni.XMLResourceIdentifier; -import org.apache.xerces.xni.XNIException; -import org.apache.xerces.xni.parser.XMLEntityResolver; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.eclipse.wst.wsdl.validation.internal.util.LazyURLInputStream; - -/** - * A resolver to resolver entities from the XML catalog. - */ -public class XMLCatalogResolver implements XMLEntityResolver -{ - protected static XMLCatalogResolver xmlCatalog; - - /** - * Constructor. - */ - protected XMLCatalogResolver() - { - } - - /** - * Get the instance of this resolver. - * - * @return the instance of this resolver - */ - public static XMLCatalogResolver getInstance() - { - if (xmlCatalog == null) - { - xmlCatalog = new XMLCatalogResolver(); - } - return xmlCatalog; - } - - /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException - { - String publicId = resourceIdentifier.getPublicId(); - if(publicId == null) - { - publicId = resourceIdentifier.getNamespace(); - } - String systemId = resourceIdentifier.getLiteralSystemId(); - String location = XMLCatalog.getInstance().resolveEntityLocation(publicId, systemId); - if (location != null) - { - LazyURLInputStream is = new LazyURLInputStream(location); - XMLInputSource inputSource = new XMLInputSource(publicId, systemId, systemId, is, null); - return inputSource; - } - // otherwise return null to tell the parser to locate the systemId as a URI - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLMessageInfoHelper.java b/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLMessageInfoHelper.java deleted file mode 100644 index 443ab84ae..000000000 --- a/bundles/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLMessageInfoHelper.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.wsdl.validation.internal.xml; - -public class XMLMessageInfoHelper -{ - - //see org.eclipse.wst.xml.ui.reconcile.DelegatingSourceValidator - protected static final String ALL_ATTRIBUTES = "ALL_ATTRIBUTES"; - protected static final String ATTRIBUTE_NAME ="ATTRIBUTE_NAME"; - protected static final String ATTRIBUTE_VALUE = "ATTRIBUTE_VALUE"; - protected static final String START_TAG = "START_TAG"; - protected static final String TEXT = "TEXT"; - protected static final String FIRST_NON_WHITESPACE_TEXT = "FIRST_NON_WHITESPACE_TEXT"; - protected static final String TEXT_ENTITY_REFERENCE = "TEXT_ENTITY_REFERENCE"; - protected static final String VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE = "VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE"; - - - public XMLMessageInfoHelper() - { - super(); - } - - /** - * returns an array containing information about what should be underlined with the red "squiggles" - * using the errorKey, and the messageArguments - * <br>Position 0 of the array returned contains the selection Strategy,or what DOM Element to underline. - * For example "ATTRIBUTE_NAME" - * <br>Position 1 contains the name or value to squiggle. - * <p>For example, if we wanted to squiggle the attribute name of an attribute name - * foo this method would return {"ATTRIBUTE_NAME", "foo"} - * </p> - * @param errorKey the error key given by the Xerces parser - * @param messageArguments the arguments used by Xerces to "fill in the blanks" of their messages - * @return an array containing the squiggle information - * @see org.eclipse.wst.xml.ui.reconcile.DelegatingReconcileValidator - * - */ - public String[] createMessageInfo(String errorKey, Object[] messageArguments) - { - String selectionStrategy = null; - String nameOrValue = null; - - //XML Errors - if (errorKey.equals("cvc-complex-type.2.4.a") || errorKey.equals("cvc-complex-type.2.4.d") || errorKey.equals("cvc-complex-type.2.4.b") || errorKey.equals("MSG_CONTENT_INVALID") - | errorKey.equals("MSG_CONTENT_INCOMPLETE") || errorKey.equals("MSG_REQUIRED_ATTRIBUTE_NOT_SPECIFIED") || errorKey.equals("cvc-complex-type.4")) - { - selectionStrategy = START_TAG; - } - else if (errorKey.equals("cvc-type.3.1.3")) - { - selectionStrategy = TEXT; - } - else if (errorKey.equals("cvc-complex-type.2.3")) - { - selectionStrategy = FIRST_NON_WHITESPACE_TEXT; - } - else if (errorKey.equals("cvc-type.3.1.1")) - { - selectionStrategy = ALL_ATTRIBUTES; - } - else if (errorKey.equals("cvc-complex-type.3.2.2") || errorKey.equals("MSG_ATTRIBUTE_NOT_DECLARED")) - { - selectionStrategy = ATTRIBUTE_NAME; - //in this case we need nameOrValue to be the name of the attribute to underline - nameOrValue = (String)messageArguments[1]; - } - else if (errorKey.equals("cvc-attribute.3") || errorKey.equals("MSG_ATTRIBUTE_VALUE_NOT_IN_LIST")) - { - selectionStrategy = ATTRIBUTE_VALUE; - //in this case we need nameOrValue to be the name of the Attribute - if (errorKey.equals("cvc-attribute.3")) - { nameOrValue = (String)messageArguments[1]; - } - else if (errorKey.equals("MSG_ATTRIBUTE_VALUE_NOT_IN_LIST")) - { nameOrValue = (String)messageArguments[0]; - } - } - else if (errorKey.equals("cvc-elt.4.2")) - { selectionStrategy=VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE; - //in this case we need nameOrValue to be the value of the attribute we want to unerline - nameOrValue = (String)messageArguments[1]; - } - else if (errorKey.equals("EntityNotDeclared")) - { selectionStrategy=TEXT_ENTITY_REFERENCE; - } - - - //WSDL Errors - else if (errorKey.equals("_MESSAGE_UNDEFINED_FOR_OUTPUT") || - errorKey.equals("_MESSAGE_UNDEFINED_FOR_INPUT") || - errorKey.equals("_MESSAGE_UNDEFINED_FOR_FAULT")) - { - selectionStrategy=ATTRIBUTE_VALUE; - nameOrValue= "message"; - } - else if (errorKey.equals("_PORTTYPE_UNDEFINED_FOR_BINDING")) - { - selectionStrategy=ATTRIBUTE_VALUE; - nameOrValue="type"; - } - else if (errorKey.equals("_OPERATION_UNDEFINED_FOR_PORTTYPE")) - { - selectionStrategy=ATTRIBUTE_VALUE; - nameOrValue="name"; - } - else if (errorKey.equals("_PART_INVALID_ELEMENT")) - { - selectionStrategy=ATTRIBUTE_VALUE; - nameOrValue="element"; - } - else if (errorKey.equals("_NO_BINDING_FOR_PORT")) - { - selectionStrategy=ATTRIBUTE_VALUE; - nameOrValue="binding"; - } - - String messageInfo[] = new String[2]; - messageInfo[0] = selectionStrategy; - messageInfo[1] = nameOrValue; - return messageInfo; - } -} |