src/main/java/org/jboss/loom/utils/XmlUtils.java
public static <T> T readXmlConfigFile( boolean must, File file, String xpath, Class<T> cls, String confAreaDesc ) throws MigrationException{
        if( ! file.exists() ){
            if( must )  throw new MigrationException("File to unmarshall not found: " + file);
            else        return null;
        }
            
        try {
            return XmlUtils.unmarshallBean( must, file, xpath, cls );
        } catch( Exception ex ) {
            throw new MigrationException("Failed loading "+confAreaDesc+" config from "+file.getPath()+":\n    " + ex.getMessage(), ex);
        }
    }
/**
     *  Reads given XML file, finds the first node matching given XPath, and reads it using given JAXB class.
     *  @param confAreaDesc  Used for exception message.
     *  @throws MigrationException wrapping any Exception.
     */
Reads given XML file, finds the first node matching given XPath, and reads it using given JAXB class.
@param confAreaDesc  Used for exception message.
@throws MigrationException wrapping any Exception.
Reads given XML file finds the first node matching given XPath and reads it using given JAXB class . @param confAreaDesc Used for exception message . @throws MigrationException wrapping any Exception .
public static <T> T readXmlConfigFile( boolean must, File file, String xpath, Class<T> cls, String confAreaDesc ) throws MigrationException{
        if( ! file.exists() ){
            if( must )  throw new MigrationException("File to unmarshall not found: " + file);
            else        return null;
        }
        try {
            return XmlUtils.unmarshallBean( must, file, xpath, cls );
        } catch( Exception ex ) {
            throw new MigrationException("Failed loading "+confAreaDesc+" config from "+file.getPath()+":\n    " + ex.getMessage(), ex);
        }
    }
public static < T > T readXmlConfigFile ( boolean must , File file , String xpath , Class < T > cls , String confAreaDesc ) throws MigrationException { if ( ! file . exists ( ) ) { if ( must ) throw new MigrationException ( "File to unmarshall not found: " + file ) ; else return null ; } try { return XmlUtils . unmarshallBean ( must , file , xpath , cls ) ; } catch ( Exception ex ) { throw new MigrationException ( "Failed loading " + confAreaDesc + " config from " + file . getPath ( ) + ":\n    " + ex . getMessage ( ) , ex ) ; } }
Reads given XML file, finds the first node matching given XPath, and reads it using given JAXB class.
Reads given XML file finds the first node matching given XPath and reads it using given JAXB class .