Refine search
for (int catPos = 0; catPos < catalogs.size(); catPos++) { Catalog c = null; c = (Catalog) catalogs.elementAt(catPos); } catch (ClassCastException e) { String catfile = (String) catalogs.elementAt(catPos); c = newCatalog(); c.parseCatalog(catfile); catalogs.setElementAt(c, catPos); c.parseAllCatalogs(); Enumeration en = catalogEntries.elements(); while (en.hasMoreElements()) { CatalogEntry e = (CatalogEntry) en.nextElement(); if (e.getEntryType() == DELEGATE_PUBLIC || e.getEntryType() == DELEGATE_SYSTEM || e.getEntryType() == DELEGATE_URI) { Catalog dcat = newCatalog(); dcat.parseCatalog(e.getEntryArg(1));
catalog = new Catalog(); } else { try { + catalogClassName + "' could not be found. Using default."); catalog = new Catalog(); } catch (ClassCastException cnfe) { debug.message(1,"Class named '" + catalogClassName + "' is not a Catalog. Using default."); catalog = new Catalog(); catalog.setCatalogManager(this); catalog.setupReaders(); catalog.loadSystemCatalogs(); } catch (Exception ex) { ex.printStackTrace();
/** * Copies the reader list from the current Catalog to a new Catalog. * * <p>This method is used internally when constructing a new catalog. * It copies the current reader associations over to the new catalog. * </p> * * @param newCatalog The new Catalog. */ protected void copyReaders(Catalog newCatalog) { // Have to copy the readers in the right order...convert hash to arr Vector mapArr = new Vector(readerMap.size()); // Pad the mapArr out to the right length for (int count = 0; count < readerMap.size(); count++) { mapArr.add(null); } Enumeration en = readerMap.keys(); while (en.hasMoreElements()) { String mimeType = (String) en.nextElement(); Integer pos = (Integer) readerMap.get(mimeType); mapArr.set(pos.intValue(), mimeType); } for (int count = 0; count < mapArr.size(); count++) { String mimeType = (String) mapArr.get(count); Integer pos = (Integer) readerMap.get(mimeType); newCatalog.addReader(mimeType, (CatalogReader) readerArr.get(pos.intValue())); } }
/** The SAX <code>startDocument</code> method does nothing. */ public void startDocument () throws SAXException { baseURIStack.push(catalog.getCurrentBase()); overrideStack.push(catalog.getDefaultOverride()); return; }
/** * Instruct the <code>Catalog</code> to parse each of the * catalogs in the list. Only the first catalog will actually be * parsed immediately. The others will be queued and read if * they are needed later. */ private void parseCatalogs () throws IOException { if (fCatalogsList != null) { fCatalog = new Catalog(fResolverCatalogManager); attachReaderToCatalog(fCatalog); for (int i = 0; i < fCatalogsList.length; ++i) { String catalog = fCatalogsList[i]; if (catalog != null && catalog.length() > 0) { fCatalog.parseCatalog(catalog); } } } else { fCatalog = null; } }
Enumeration en = catalogEntries.elements(); while (en.hasMoreElements()) { CatalogEntry e = (CatalogEntry) en.nextElement(); if (e.getEntryType() == URI && (e.getEntryArg(0).equals(uri))) { en = catalogEntries.elements(); String startString = null; String prefix = null; while (en.hasMoreElements()) { CatalogEntry e = (CatalogEntry) en.nextElement(); en = catalogEntries.elements(); String suffixString = null; String suffixURI = null; Catalog dcat = newCatalog(); enCats = delCats.elements(); while (enCats.hasMoreElements()) { String delegatedCatalog = (String) enCats.nextElement(); dcat.parseCatalog(delegatedCatalog); return dcat.resolveURI(uri);
/** * Parse an XML Catalog file. * * @param catalog The catalog to which this catalog file belongs * @param fileUrl The URL or filename of the catalog file to process * * @throws MalformedURLException Improper fileUrl * @throws IOException Error reading catalog file */ public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException, CatalogException { URL url = null; try { url = new URL(fileUrl); } catch (MalformedURLException e) { url = new URL("file:///" + fileUrl); } debug = catalog.getCatalogManager().debug; try { URLConnection urlCon = url.openConnection(); readCatalog(catalog, urlCon.getInputStream()); } catch (FileNotFoundException e) { catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found", url.toString()); } }
base = new URL(catalogCwd, fixSlashes(fileName)); } catch (MalformedURLException e) { try { base = new URL("file:" + fixSlashes(fileName)); } catch (MalformedURLException e2) { catalogManager.debug.message(1, "Malformed URL on catalog filename", fixSlashes(fileName)); base = null; catalogManager.debug.message(4, "Default BASE", base.toString()); fileName = base.toString(); boolean notFound = false; for (int count = 0; !parsed && count < readerArr.size(); count++) { CatalogReader reader = (CatalogReader) readerArr.get(count);
try { if (baseURL != null) { catalog = new URL(baseURL, data); } else { catalog = new URL(data); catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString()); oasisXMLCatalogPI = true; piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); } catch (Exception e) { catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: "
String resolved = resolveLocalSystem(systemId); if (resolved != null) { return resolved; Enumeration en = catalogEntries.elements(); while (en.hasMoreElements()) { CatalogEntry e = (CatalogEntry) en.nextElement(); if (e.getEntryType() == OVERRIDE) { over = e.getEntryArg(0).equalsIgnoreCase("YES"); en = catalogEntries.elements(); Vector delCats = new Vector(); while (en.hasMoreElements()) { CatalogEntry e = (CatalogEntry) en.nextElement(); if (e.getEntryType() == OVERRIDE) { Catalog dcat = newCatalog(); enCats = delCats.elements(); while (enCats.hasMoreElements()) { String delegatedCatalog = (String) enCats.nextElement(); dcat.parseCatalog(delegatedCatalog); return dcat.resolvePublic(publicId, null);
value = fixSlashes(value); newbase = new URL(base, value); } catch (MalformedURLException e) { try { newbase = new URL("file:" + value); } catch (MalformedURLException e2) { catalogManager.debug.message(1, "Malformed URL on base", value); String fsi = makeAbsolute(entry.getEntryArg(0)); localCatalogFiles.addElement(fsi); } else if (type == PUBLIC) { String publicid = PublicId.normalize(entry.getEntryArg(0)); String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1))); catalogEntries.addElement(entry); } else if (type == SYSTEM) { String systemid = normalizeURI(entry.getEntryArg(0)); String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1))); catalogEntries.addElement(entry); } else if (type == URI) { String uri = normalizeURI(entry.getEntryArg(0)); String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1))); String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0))); entry.setEntryArg(0, fsi); String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
/** * Construct an absolute URI from a relative one, using the current * base URI. * * @param sysid The (possibly relative) system identifier * @return The system identifier made absolute with respect to the * current {@link #base}. */ protected String makeAbsolute(String sysid) { URL local = null; sysid = fixSlashes(sysid); try { local = new URL(base, sysid); } catch (MalformedURLException e) { catalogManager.debug.message(1, "Malformed URL on system identifier", sysid); } if (local != null) { return local.toString(); } else { return sysid; } }
/** * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml * @return */ public static EntityResolver createDefaultCatalogResolver() { // set up a manager CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); // Using static catalog may result in to sharing of the catalog by multiple apps running in a container manager.setUseStaticCatalog(false); // parse the catalog ClassLoader cl = Thread.currentThread().getContextClassLoader(); Enumeration<URL> catalogEnum; Catalog catalog = manager.getCatalog(); try { if (cl == null) { catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml"); } else { catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml"); } while (catalogEnum.hasMoreElements()) { URL url = catalogEnum.nextElement(); catalog.parseCatalog(url); } } catch (IOException e) { throw new WebServiceException(e); } return workaroundCatalogResolver(catalog); }
Vector entryArgs = new Vector(); entryArgs.add(baseURI); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { entryArgs.add(override); overrideStack.push(override); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
for (int count = 0; count < catalogs.size(); count++) { catalogFiles.addElement(catalogs.elementAt(count)); String catfile = (String) catalogFiles.lastElement(); catalogFiles.removeElement(catfile); parseCatalog(catfile);
catalog.unknownEntry(unknownEntry); unknownEntry = null; int type = CatalogEntry.getEntryType(entryToken); int numArgs = CatalogEntry.getEntryArgCount(type); Vector args = new Vector(); catalog.unknownEntry(unknownEntry); unknownEntry = null; args.addElement(nextToken()); catalog.addEntry(new CatalogEntry(entryToken, args)); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { if (unknownEntry == null) { unknownEntry = new Vector(); unknownEntry.addElement(token); } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) { catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token); unknownEntry = null; } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) { catalog.getCatalogManager().debug.message(1, cex.getMessage()); catalog.getCatalogManager().debug.message(1, cex2.getMessage());
catalog.getCatalogManager().debug.message(4, "Base", atts.getValue("HRef")); } else if (localName.equals("Delegate")) { entryType = catalog.DELEGATE_PUBLIC; entryArgs.add(atts.getValue("PublicId")); catalog.getCatalogManager().debug.message(4, "Delegate", PublicId.normalize(atts.getValue("PublicId")), atts.getValue("HRef")); catalog.getCatalogManager().debug.message(4, "Extend", atts.getValue("HRef")); } else if (localName.equals("Map")) { entryType = catalog.PUBLIC; catalog.getCatalogManager().debug.message(4, "Map", PublicId.normalize(atts.getValue("PublicId")), atts.getValue("HRef")); catalog.getCatalogManager().debug.message(4, "Remap", atts.getValue("SystemId"), atts.getValue("HRef")); catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName); try { CatalogEntry ce = new CatalogEntry(entryType, entryArgs); catalog.addEntry(ce); } catch (CatalogException cex) { if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) { catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
private void parseResolvedCatalogURIs() throws MojoExecutionException { for (URI catalogURI : getResolvedCatalogURIs()) { if (catalogURI != null) { try { getCatalogResolverInstance().getCatalog().parseCatalog(catalogURI.toURL()); } catch (IOException ioex) { throw new MojoExecutionException( MessageFormat.format("Error parsing catalog [{0}].", catalogURI.toString()), ioex); } } } }
c.setCatalogManager(catalogManager); copyReaders(c); return c; } catch (ClassNotFoundException cnfe) { Catalog c = new Catalog(); c.setCatalogManager(catalogManager); copyReaders(c); return c;
/** * Setup readers. */ public void setupReaders() { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.setValidating(false); SAXCatalogReader saxReader = new SAXCatalogReader(spf); saxReader.setCatalogParser(null, "XMLCatalog", "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader"); saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog", "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader"); addReader("application/xml", saxReader); TR9401CatalogReader textReader = new TR9401CatalogReader(); addReader("text/plain", textReader); }