private void addFileAndDecendents(URL fileUrl, ArrayList<SDDocumentSource> cumulative) throws Exception { //make sure we have not processed this file before boolean alreadyProcessed = false; for (SDDocumentSource source: cumulative) { if ((fileUrl.toString()).equals(source.getSystemId().toString())) { alreadyProcessed = true; break; } } if (!alreadyProcessed) { cumulative.add(0, SDDocumentSource.create(fileUrl)); getWsdlsAndSchemas(fileUrl, cumulative); } }
/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
public Collection getWsdlsAndSchemas(File pkgedWsdl) throws Exception { ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>(); getWsdlsAndSchemas(pkgedWsdl, cumulative); //if there are circular imports of wsdls, the original wsdl might //be in this Collection of imported metadata documents. If so, remove it. URL id = pkgedWsdl.toURL(); SDDocumentSource toRemove = null; for (SDDocumentSource source: cumulative) { if ((id.toString()).equals(source.getSystemId().toString())) { toRemove = source; } } if (toRemove != null) { cumulative.remove(toRemove); } return cumulative; }
public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException { return source.read(xif); }
/** * This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes * it easy when the wsdl is loaded from the archive. * @param pkgedWsdl URL * @return * @throws Exception */ public Collection getWsdlsAndSchemas(URL pkgedWsdl) throws Exception { ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>(); getWsdlsAndSchemas(pkgedWsdl, cumulative); //if there are circular imports of wsdls, the original wsdl might //be in this Collection of imported metadata documents. If so, remove it. SDDocumentSource toRemove = null; for (SDDocumentSource source: cumulative) { if ((pkgedWsdl.toString()).equals(source.getSystemId().toString())) { toRemove = source; } } if (toRemove != null) { cumulative.remove(toRemove); } return cumulative; }
public XMLStreamReader read() throws IOException, XMLStreamException { return source.read(); }
private void addFileAndDecendents(File file, ArrayList<SDDocumentSource> cumulative) throws Exception { try { //JAX-WS has trouble with "..'s" in paths here file = file.getCanonicalFile(); } catch (IOException e) { //hope JAX-WS can deal with the original path } //make sure we have not processed this file before URL id = file.toURL(); boolean alreadyProcessed = false; for (SDDocumentSource source: cumulative) { if ((id.toString()).equals(source.getSystemId().toString())) { alreadyProcessed = true; break; } } if (!alreadyProcessed) { cumulative.add(0, SDDocumentSource.create(id)); getWsdlsAndSchemas(file, cumulative); } }
/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }
public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException { return source.read(xif); }
public static SDDocumentSource create(final Class implClass, final String wsdlLocation) { ClassLoader cl = implClass.getClassLoader(); URL url = cl.getResource(wsdlLocation); if (url != null) { return create(url); } throw new ServerRtException("cannot.load.wsdl", wsdlLocation); }
primaryWsdl = SDDocumentSource.create(pkgedWsdl); docs = wsu.getWsdlsAndSchemas(pkgedWsdl); primaryWsdl.getSystemId().toString()); logger.log(Level.FINE, "Metadata documents:"); for (Object source : docs) { logger.log(Level.FINE, ((SDDocumentSource) source).getSystemId().toString());
/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }
public XMLStreamReader read() throws IOException, XMLStreamException { return source.read(); }
@Override public SDDocument resolve(String systemId) { SDDocument sdi = docs.get(systemId); if (sdi == null) { SDDocumentSource sds; try { sds = SDDocumentSource.create(new URL(systemId)); } catch(MalformedURLException e) { throw new WebServiceException(e); } sdi = SDDocumentImpl.create(sds, new QName(""), new QName("")); docs.put(systemId, sdi); } return sdi; }
URL systemId = src.getSystemId(); XMLStreamReader reader = src.read(); try { XMLStreamReaderUtil.nextElementContent(reader); String importedDoc = reader.getAttributeValue(null, "schemaLocation"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString()); String importedDoc = reader.getAttributeValue(null, "location"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString()); String importedDoc = reader.getAttributeValue(null, "schemaLocation"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString());
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }