src/main/java/org/jboss/util/xml/catalog/Catalog.java
protected String resolveLocalSystem(String systemId)
    throws MalformedURLException, IOException {

    String osname = System.getProperty("os.name");
    boolean windows = (osname.indexOf("Windows") >= 0);
    Enumeration enumt = catalogEntries.elements();
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();
      if (e.getEntryType() == SYSTEM
	  && (e.getEntryArg(0).equals(systemId)
	      || (windows
		  && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
	return e.getEntryArg(1);
      }
    }

    // If there's a REWRITE_SYSTEM entry in this catalog, use it
    enumt = catalogEntries.elements();
    String startString = null;
    String prefix = null;
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();

      if (e.getEntryType() == REWRITE_SYSTEM) {
	String p = e.getEntryArg(0);
	if (p.length() <= systemId.length()
	    && p.equals(systemId.substring(0, p.length()))) {
	  // Is this the longest prefix?
	  if (startString == null
	      || p.length() > startString.length()) {
	    startString = p;
	    prefix = e.getEntryArg(1);
	  }
	}
      }

      if (prefix != null) {
	// return the systemId with the new prefix
	return prefix + systemId.substring(startString.length());
      }
    }

    // If there's a DELEGATE_SYSTEM entry in this catalog, use it
    enumt = catalogEntries.elements();
    Vector delCats = new Vector();
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();

      if (e.getEntryType() == DELEGATE_SYSTEM) {
	String p = e.getEntryArg(0);
	if (p.length() <= systemId.length()
	    && p.equals(systemId.substring(0, p.length()))) {
	  // delegate this match to the other catalog

	  delCats.addElement(e.getEntryArg(1));
	}
      }
    }

    if (delCats.size() > 0) {
      Enumeration enumCats = delCats.elements();

      if (catalogManager.debug.getDebug() > 1) {
	catalogManager.debug.message(2, "Switching to delegated catalog(s):");
	while (enumCats.hasMoreElements()) {
	  String delegatedCatalog = (String) enumCats.nextElement();
	  catalogManager.debug.message(2, "\t" + delegatedCatalog);
	}
      }

      Catalog dcat = newCatalog();

      enumCats = delCats.elements();
      while (enumCats.hasMoreElements()) {
	String delegatedCatalog = (String) enumCats.nextElement();
	dcat.parseCatalog(delegatedCatalog);
      }

      return dcat.resolveSystem(systemId);
    }

    return null;
  }
protected String resolveLocalSystem(String systemId)
    throws MalformedURLException, IOException {

    String osname = System.getProperty("os.name");
    boolean windows = (osname.indexOf("Windows") >= 0);
    Enumeration enumt = catalogEntries.elements();
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();
      if (e.getEntryType() == SYSTEM
	  && (e.getEntryArg(0).equals(systemId)
	      || (windows
		  && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
	return e.getEntryArg(1);
      }
    }

    // If there's a REWRITE_SYSTEM entry in this catalog, use it
    enumt = catalogEntries.elements();
    String startString = null;
    String prefix = null;
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();

      if (e.getEntryType() == REWRITE_SYSTEM) {
	String p = e.getEntryArg(0);
	if (p.length() <= systemId.length()
	    && p.equals(systemId.substring(0, p.length()))) {
	  // Is this the longest prefix?
	  if (startString == null
	      || p.length() > startString.length()) {
	    startString = p;
	    prefix = e.getEntryArg(1);
	  }
	}
      }

      if (prefix != null) {
	// return the systemId with the new prefix
	return prefix + systemId.substring(startString.length());
      }
    }

    // If there's a DELEGATE_SYSTEM entry in this catalog, use it
    enumt = catalogEntries.elements();
    Vector delCats = new Vector();
    while (enumt.hasMoreElements()) {
      CatalogEntry e = (CatalogEntry) enumt.nextElement();

      if (e.getEntryType() == DELEGATE_SYSTEM) {
	String p = e.getEntryArg(0);
	if (p.length() <= systemId.length()
	    && p.equals(systemId.substring(0, p.length()))) {
	  // delegate this match to the other catalog

	  delCats.addElement(e.getEntryArg(1));
	}
      }
    }

    if (delCats.size() > 0) {
      Enumeration enumCats = delCats.elements();

      if (catalogManager.debug.getDebug() > 1) {
	catalogManager.debug.message(2, "Switching to delegated catalog(s):");
	while (enumCats.hasMoreElements()) {
	  String delegatedCatalog = (String) enumCats.nextElement();
	  catalogManager.debug.message(2, "\t" + delegatedCatalog);
	}
      }

      Catalog dcat = newCatalog();

      enumCats = delCats.elements();
      while (enumCats.hasMoreElements()) {
	String delegatedCatalog = (String) enumCats.nextElement();
	dcat.parseCatalog(delegatedCatalog);
      }

      return dcat.resolveSystem(systemId);
    }

    return null;
  }
protected String resolveLocalSystem ( String systemId ) throws MalformedURLException , IOException { String osname = System . getProperty ( "os.name" ) ; boolean windows = ( osname . indexOf ( "Windows" ) >= 0 ) ; Enumeration enumt = catalogEntries . elements ( ) ; while ( enumt . hasMoreElements ( ) ) { CatalogEntry e = ( CatalogEntry ) enumt . nextElement ( ) ; if ( e . getEntryType ( ) == SYSTEM && ( e . getEntryArg ( 0 ) . equals ( systemId ) || ( windows && e . getEntryArg ( 0 ) . equalsIgnoreCase ( systemId ) ) ) ) { return e . getEntryArg ( 1 ) ; } } // If there's a REWRITE_SYSTEM entry in this catalog, use it enumt = catalogEntries . elements ( ) ; String startString = null ; String prefix = null ; while ( enumt . hasMoreElements ( ) ) { CatalogEntry e = ( CatalogEntry ) enumt . nextElement ( ) ; if ( e . getEntryType ( ) == REWRITE_SYSTEM ) { String p = e . getEntryArg ( 0 ) ; if ( p . length ( ) <= systemId . length ( ) && p . equals ( systemId . substring ( 0 , p . length ( ) ) ) ) { // Is this the longest prefix? if ( startString == null || p . length ( ) > startString . length ( ) ) { startString = p ; prefix = e . getEntryArg ( 1 ) ; } } } if ( prefix != null ) { // return the systemId with the new prefix return prefix + systemId . substring ( startString . length ( ) ) ; } } // If there's a DELEGATE_SYSTEM entry in this catalog, use it enumt = catalogEntries . elements ( ) ; Vector delCats = new Vector ( ) ; while ( enumt . hasMoreElements ( ) ) { CatalogEntry e = ( CatalogEntry ) enumt . nextElement ( ) ; if ( e . getEntryType ( ) == DELEGATE_SYSTEM ) { String p = e . getEntryArg ( 0 ) ; if ( p . length ( ) <= systemId . length ( ) && p . equals ( systemId . substring ( 0 , p . length ( ) ) ) ) { // delegate this match to the other catalog delCats . addElement ( e . getEntryArg ( 1 ) ) ; } } } if ( delCats . size ( ) > 0 ) { Enumeration enumCats = delCats . elements ( ) ; if ( catalogManager . debug . getDebug ( ) > 1 ) { catalogManager . debug . message ( 2 , "Switching to delegated catalog(s):" ) ; while ( enumCats . hasMoreElements ( ) ) { String delegatedCatalog = ( String ) enumCats . nextElement ( ) ; catalogManager . debug . message ( 2 , "\t" + delegatedCatalog ) ; } } Catalog dcat = newCatalog ( ) ; enumCats = delCats . elements ( ) ; while ( enumCats . hasMoreElements ( ) ) { String delegatedCatalog = ( String ) enumCats . nextElement ( ) ; dcat . parseCatalog ( delegatedCatalog ) ; } return dcat . resolveSystem ( systemId ) ; } return null ; }
Return the applicable SYSTEM system identifier in this
catalog.

<p>If a SYSTEM entry exists in the catalog file
for the system ID specified, return the mapped value.</p>

@param systemId The system ID to locate in the catalog

@return The mapped system identifier or null
@throws MalformedURLException
@throws IOException
Return the applicable SYSTEM system identifier in this catalog .