protected String generateScript ( String name , Object [ ] input ) { //get template String template = VBSFaxClientSpi . VBS_SCRIPTS . get ( name ) ; if ( ( template == null ) || ( template . length ( ) == 0 ) ) { this . throwUnsupportedException ( ) ; } //get common script String commonScript = VBSFaxClientSpi . VBS_SCRIPTS . get ( VBSFaxClientSpi . VBS_SCRIPT ) ; //format input Object [ ] formattedInput = null ; if ( input != null ) { //get size int size = input . length ; //create array formattedInput = new Object [ size ] ; Object object = null ; for ( int index = 0 ; index < size ; index ++ ) { //get next element object = input [ index ] ; //format object object = this . formatObject ( object ) ; //push to array formattedInput [ index ] = object ; } } //push input to template String updatedScript = MessageFormat . format ( template , formattedInput ) ; //merge scripts StringBuilder buffer = new StringBuilder ( commonScript . length ( ) + updatedScript . length ( ) ) ; buffer . append ( commonScript ) ; buffer . append ( updatedScript ) ; String script = buffer . toString ( ) ; return script ; }
This function generates the script and returns it .