public void init ( ) { // before running init check to see if attributes has been injected/set if ( wurflDirPath == null ) throw new IllegalStateException ( "wurflDirPath not properly set" ) ; // look for wurfl file and patches File wurflDir = new File ( wurflDirPath ) ; // if file does not exists, it might be relative to the servlet if ( ! wurflDir . exists ( ) && servletContext != null ) wurflDir = new File ( servletContext . getRealPath ( wurflDirPath ) ) ; // check again if ( ! wurflDir . exists ( ) ) throw new IllegalArgumentException ( "wurflDirPath " + wurflDir . getAbsolutePath ( ) + " does not exists" ) ; if ( ! wurflDir . isDirectory ( ) ) throw new IllegalArgumentException ( "wurflDirPath " + wurflDir . getAbsolutePath ( ) + " is not a directory" ) ; ArrayList < File > patchFiles = new ArrayList < File > ( ) ; logger . info ( "search for wurfl file and patches on: " + wurflDir . getAbsolutePath ( ) ) ; for ( String filePath : wurflDir . list ( ) ) { File file = new File ( wurflDir . getAbsoluteFile ( ) + "/" + filePath ) ; if ( WURFL_FILENAME . equals ( file . getName ( ) ) ) { wurflFile = file ; logger . debug ( "wurfl file: " + wurflFile . getAbsolutePath ( ) ) ; } else if ( file . getName ( ) . endsWith ( ".xml" ) ) { patchFiles . add ( file ) ; logger . debug ( "wurfl patch file: " + file . getAbsolutePath ( ) ) ; } } this . wurflPatchFiles = patchFiles . toArray ( new File [ ] { } ) ; // initialize wurfl holder this . wurflHolder = new CustomWURFLHolder ( this . wurflFile , this . wurflPatchFiles ) ; startWatchingFiles ( ) ; this . statusInfo = getNewStatusInfo ( "" ) ; }
init will properly initialize this service . this would look for wurfl files and instantiate a wurfl holder