public static void initEndpointDirectories ( MuleContext muleContext , String [ ] serviceNames , String [ ] endpointNames ) throws Exception { // Stop all named services (either Flows or services List < Lifecycle > services = new ArrayList < Lifecycle > ( ) ; for ( String serviceName : serviceNames ) { try { Lifecycle service = muleContext . getRegistry ( ) . lookupObject ( serviceName ) ; // logServiceStatus(service); // service.stop(); // logServiceStatus(service); services . add ( service ) ; } catch ( Exception e ) { logger . error ( "Error '" + e . getMessage ( ) + "' occured while stopping the service " + serviceName + ". Perhaps the service did not exist in the config?" ) ; throw e ; } } // Now init the directory for each named endpoint, one by one for ( String endpointName : endpointNames ) { initEndpointDirectory ( muleContext , endpointName ) ; } // We are done, startup the services again so that the test can begin... for ( @ SuppressWarnings ( "unused" ) Lifecycle service : services ) { // logServiceStatus(service); // service.start(); // logServiceStatus(service); } }
Initiates a list of sftp - endpoint - directories . Ensures that affected services are stopped during the initiation .