void start ( String monitoredDirectory , Long pollingTime ) { this . monitoredDirectory = monitoredDirectory ; String deployerKlassName ; if ( klass . equals ( ImportDeclaration . class ) ) { deployerKlassName = ImporterDeployer . class . getName ( ) ; } else if ( klass . equals ( ExportDeclaration . class ) ) { deployerKlassName = ExporterDeployer . class . getName ( ) ; } else { throw new IllegalStateException ( "" ) ; } this . dm = new DirectoryMonitor ( monitoredDirectory , pollingTime , deployerKlassName ) ; try { dm . start ( getBundleContext ( ) ) ; } catch ( DirectoryMonitoringException e ) { LOG . error ( "Failed to start " + DirectoryMonitor . class . getName ( ) + " for the directory " + monitoredDirectory + " and polling time " + pollingTime . toString ( ) , e ) ; } }
This method must be called on the start of the component . Initialize and start the directory monitor .