public void deleteService ( String id , boolean force ) { try { if ( id == null || id . isEmpty ( ) ) { id = selectRunningService ( ) ; } final String idFinal = id ; int input = ' ' ; if ( ! force ) { OutputStreamFormater . printValue ( String . format ( "Do you really want to delete the connector: %s (Y/n): " , id ) ) ; input = keyboard . read ( ) ; } if ( ' ' != ( char ) input && ' ' != ( char ) input ) { SecurityContext . executeWithSystemPermissions ( new Callable < Object > ( ) { @ Override public Object call ( ) throws Exception { serviceManager . delete ( idFinal ) ; return null ; } } ) ; OutputStreamFormater . printValue ( String . format ( "Service: %s successfully deleted" , id ) ) ; } } catch ( ExecutionException e ) { e . printStackTrace ( ) ; System . err . println ( "Could not delete service" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; System . err . println ( "Unexpected Error" ) ; } }
delete a service identified by its id if force is true the user does not have to confirm