Class Utility


  • public class Utility
    extends Object
    Binding compiler support class. Supplies common methods for use in compiling binding definitions.
    Author:
    Dennis M. Sosnoski
    • Method Detail

      • getClassPaths

        public static String[] getClassPaths()
        Method builds a string array of items in the class path.
        Returns:
        array of classpath components
      • fileName

        public static String fileName​(String path)
        Extract base file name from a full path.
        Parameters:
        path - full file path
        Returns:
        file name component from path
      • bindingFromFileName

        public static String bindingFromFileName​(String fname)
        Get the default binding name from a supplied file name.
        Parameters:
        fname - simple file name (without leading path information)
        Returns:
        default binding name
      • validateBinding

        public static BindingElement validateBinding​(String name,
                                                     URL url,
                                                     InputStream is)
        Validate binding definition. If issues are found in the binding the issues are printed directly to the console.
        Parameters:
        name - identifier for binding definition
        url - URL for binding definition (null if not available)
        is - input stream for reading binding definition
        Returns:
        root element of binding model if binding is valid, null if one or more errors in binding
      • loadBinding

        public static BindingDefinition loadBinding​(String fname,
                                                    String sname,
                                                    InputStream istrm,
                                                    URL url,
                                                    boolean test)
                                             throws org.jibx.runtime.JiBXException,
                                                    IOException
        Load validated binding definition. This first reads the input stream into a memory buffer, then parses the data once for validation and a second time for the actual binding definition construction. If any errors are found in the binding definition validation the construction is skipped and an exception is thrown.
        Parameters:
        fname - binding definition full name
        sname - short form of name to use as the default name of the binding
        istrm - input stream for binding definition document
        url - URL for binding definition (null if not available)
        test - validate binding flag
        Returns:
        constructed binding definition
        Throws:
        FileNotFoundException - if path cannot be accessed
        org.jibx.runtime.JiBXException - if error in processing the binding definition
        IOException - if error reading the binding
      • loadFileBinding

        public static BindingDefinition loadFileBinding​(String path,
                                                        boolean valid)
                                                 throws org.jibx.runtime.JiBXException,
                                                        IOException
        Load binding definition from file.
        Parameters:
        path - file path for binding definition
        valid - validate binding flag
        Returns:
        constructed binding definition
        Throws:
        IOException - if error accessing file
        org.jibx.runtime.JiBXException - if error in processing the binding definition