diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco')
3 files changed, 0 insertions, 178 deletions
diff --git a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOContractReference.java b/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOContractReference.java deleted file mode 100644 index a96dad292..000000000 --- a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOContractReference.java +++ /dev/null @@ -1,28 +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.ws.internal.parser.disco; - -public class DISCOContractReference extends DISCOReference -{ - private String docRef_; - - public DISCOContractReference(String ref,String docRef) - { - super(ref); - docRef_ = docRef; - } - - public String getDocRef() - { - return docRef_; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOParser.java b/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOParser.java deleted file mode 100644 index 620944923..000000000 --- a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOParser.java +++ /dev/null @@ -1,123 +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.ws.internal.parser.disco; - -import java.util.Vector; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -/** - * See http://msdn.microsoft.com/msdnmag/issues/02/02/xml/default.aspx for more - * details on DISCO. - */ -public class DISCOParser -{ - private DocumentBuilder parser_; - private final String NS_DISCO = "http://schemas.xmlsoap.org/disco/"; - private final String DISCOVERY = "discovery"; - private final String DISCOVERY_REF = "discoveryRef"; - private final String NS_CONTRACT_REF = "http://schemas.xmlsoap.org/disco/scl/"; - private final String CONTRACT_REF = "contractRef"; - private final String REF = "ref"; - private final String DOC_REF = "docRef"; - - public DISCOParser() - { - try - { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); - docBuilderFactory.setNamespaceAware(true); - parser_ = docBuilderFactory.newDocumentBuilder(); - } - catch (ParserConfigurationException pce) - { - parser_ = null; - } - } - - public DISCOReference[] parse(String discoURI, InputSource source) throws Exception - { - if (parser_ != null) - { - Document doc = parser_.parse(source); - Element rootElement = doc.getDocumentElement(); - // Root element must by <disco:discovery - // xmlns:disco="http://schemas.xmlsoap.org/disco/"> - if (rootElement != null && rootElement.getNamespaceURI().equals(NS_DISCO) && rootElement.getLocalName().equals(DISCOVERY)) - { - NodeList childNodes = rootElement.getChildNodes(); - Vector discoReferences = new Vector(); - for (int i = 0; i < childNodes.getLength(); i++) - { - Node childNode = childNodes.item(i); - if (childNode instanceof Element) - { - Element element = (Element)childNode; - String localName = element.getLocalName(); - String nsURI = element.getNamespaceURI(); - if (nsURI.equals(NS_DISCO) && localName.equals(DISCOVERY_REF)) - { - // DISCO link. - String ref = convertToAbsoluteURI(discoURI, element.getAttribute(REF)); - discoReferences.addElement(new DISCOReference(ref)); - } - else if (nsURI.equals(NS_CONTRACT_REF) && localName.equals(CONTRACT_REF)) - { - // WSDL link. - String ref = convertToAbsoluteURI(discoURI, element.getAttribute(REF)); - String docRef = convertToAbsoluteURI(discoURI, element.getAttribute(DOC_REF)); - discoReferences.addElement(new DISCOContractReference(ref, docRef)); - } - } - } - int numberOfDISCOReferences = discoReferences.size(); - if (numberOfDISCOReferences > 0) - { - DISCOReference[] references = new DISCOReference[numberOfDISCOReferences]; - discoReferences.copyInto(references); - return references; - } - } - else - { - // The document is not a valid DISCO document. - throw new Exception(); - } - } - return null; - } - - private String convertToAbsoluteURI(String discoURI, String refURI) - { - if (refURI != null) - { - if (refURI.indexOf("://") > -1) - { - // refURI is already absolute. - return refURI; - } - else - { - StringBuffer absoluteURI = new StringBuffer(discoURI.substring(0, Math.max(discoURI.lastIndexOf('\\'), discoURI.lastIndexOf('/') + 1))); - absoluteURI.append(refURI); - return absoluteURI.toString(); - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOReference.java b/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOReference.java deleted file mode 100644 index dd2175edb..000000000 --- a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/disco/DISCOReference.java +++ /dev/null @@ -1,27 +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.ws.internal.parser.disco; - -public class DISCOReference -{ - private String ref_; - - public DISCOReference(String ref) - { - ref_ = ref; - } - - public String getRef() - { - return ref_; - } -}
\ No newline at end of file |