src/main/java/org/jboss/util/xml/catalog/Catalog.java
protected synchronized String resolveSubordinateCatalogs(int entityType,
							   String entityName,
							   String publicId,
							   String systemId)
    throws MalformedURLException, IOException {

    for (int catPos = 0; catPos < catalogs.size(); catPos++) {
      Catalog c = null;

      try {
	c = (Catalog) catalogs.elementAt(catPos);
      } catch (ClassCastException e) {
	String catfile = (String) catalogs.elementAt(catPos);
	c = newCatalog();

	try {
	  c.parseCatalog(catfile);
	} catch (MalformedURLException mue) {
	  catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
	} catch (FileNotFoundException fnfe) {
	  catalogManager.debug.message(1, "Failed to load catalog, file not found",
			catfile);
	} catch (IOException ioe) {
	  catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
	}

	catalogs.setElementAt(c, catPos);
      }

      String resolved = null;

      // Ok, now what are we supposed to call here?
      if (entityType == DOCTYPE) {
	resolved = c.resolveDoctype(entityName,
				    publicId,
				    systemId);
      } else if (entityType == DOCUMENT) {
	resolved = c.resolveDocument();
      } else if (entityType == ENTITY) {
	resolved = c.resolveEntity(entityName,
				   publicId,
				   systemId);
      } else if (entityType == NOTATION) {
	resolved = c.resolveNotation(entityName,
				     publicId,
				     systemId);
      } else if (entityType == PUBLIC) {
	resolved = c.resolvePublic(publicId, systemId);
      } else if (entityType == SYSTEM) {
	resolved = c.resolveSystem(systemId);
      } else if (entityType == URI) {
	resolved = c.resolveURI(systemId);
      }

      if (resolved != null) {
	return resolved;
      }
    }

    return null;
  }
protected synchronized String resolveSubordinateCatalogs(int entityType,
							   String entityName,
							   String publicId,
							   String systemId)
    throws MalformedURLException, IOException {

    for (int catPos = 0; catPos < catalogs.size(); catPos++) {
      Catalog c = null;

      try {
	c = (Catalog) catalogs.elementAt(catPos);
      } catch (ClassCastException e) {
	String catfile = (String) catalogs.elementAt(catPos);
	c = newCatalog();

	try {
	  c.parseCatalog(catfile);
	} catch (MalformedURLException mue) {
	  catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
	} catch (FileNotFoundException fnfe) {
	  catalogManager.debug.message(1, "Failed to load catalog, file not found",
			catfile);
	} catch (IOException ioe) {
	  catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
	}

	catalogs.setElementAt(c, catPos);
      }

      String resolved = null;

      // Ok, now what are we supposed to call here?
      if (entityType == DOCTYPE) {
	resolved = c.resolveDoctype(entityName,
				    publicId,
				    systemId);
      } else if (entityType == DOCUMENT) {
	resolved = c.resolveDocument();
      } else if (entityType == ENTITY) {
	resolved = c.resolveEntity(entityName,
				   publicId,
				   systemId);
      } else if (entityType == NOTATION) {
	resolved = c.resolveNotation(entityName,
				     publicId,
				     systemId);
      } else if (entityType == PUBLIC) {
	resolved = c.resolvePublic(publicId, systemId);
      } else if (entityType == SYSTEM) {
	resolved = c.resolveSystem(systemId);
      } else if (entityType == URI) {
	resolved = c.resolveURI(systemId);
      }

      if (resolved != null) {
	return resolved;
      }
    }

    return null;
  }
protected synchronized String resolveSubordinateCatalogs ( int entityType , String entityName , String publicId , String systemId ) throws MalformedURLException , IOException { for ( int catPos = 0 ; catPos < catalogs . size ( ) ; catPos ++ ) { Catalog c = null ; try { c = ( Catalog ) catalogs . elementAt ( catPos ) ; } catch ( ClassCastException e ) { String catfile = ( String ) catalogs . elementAt ( catPos ) ; c = newCatalog ( ) ; try { c . parseCatalog ( catfile ) ; } catch ( MalformedURLException mue ) { catalogManager . debug . message ( 1 , "Malformed Catalog URL" , catfile ) ; } catch ( FileNotFoundException fnfe ) { catalogManager . debug . message ( 1 , "Failed to load catalog, file not found" , catfile ) ; } catch ( IOException ioe ) { catalogManager . debug . message ( 1 , "Failed to load catalog, I/O error" , catfile ) ; } catalogs . setElementAt ( c , catPos ) ; } String resolved = null ; // Ok, now what are we supposed to call here? if ( entityType == DOCTYPE ) { resolved = c . resolveDoctype ( entityName , publicId , systemId ) ; } else if ( entityType == DOCUMENT ) { resolved = c . resolveDocument ( ) ; } else if ( entityType == ENTITY ) { resolved = c . resolveEntity ( entityName , publicId , systemId ) ; } else if ( entityType == NOTATION ) { resolved = c . resolveNotation ( entityName , publicId , systemId ) ; } else if ( entityType == PUBLIC ) { resolved = c . resolvePublic ( publicId , systemId ) ; } else if ( entityType == SYSTEM ) { resolved = c . resolveSystem ( systemId ) ; } else if ( entityType == URI ) { resolved = c . resolveURI ( systemId ) ; } if ( resolved != null ) { return resolved ; } } return null ; }
Search the subordinate catalogs, in order, looking for a match.

<p>This method searches the Catalog and returns the system
identifier specified for the given entity type with the given
name, public, and system identifiers. In some contexts, these
may be null.</p>

@param entityType The CatalogEntry type for which this query is
being conducted. This is necessary in order to do the approprate
query on a subordinate catalog.
@param entityName The name of the entity being searched for, if
appropriate.
@param publicId The public identifier of the entity in question
(as provided in the source document).
@param systemId The nominal system identifier for the entity
in question (as provided in the source document). This parameter is
overloaded for the URI entry type.

@throws MalformedURLException The formal system identifier of a
delegated catalog cannot be turned into a valid URL.
@throws IOException Error reading delegated catalog file.

@return The system identifier to use.
Note that the nominal system identifier is not returned if a
match is not found in the catalog, instead null is returned
to indicate that no match was found.
Search the subordinate catalogs in order looking for a match .