protected boolean handleCmdLineSessionArgsSynchronously ( Control control ) { if ( getArgs ( ) . isEnabled ( CommandLine . SESSION ) && getArgs ( ) . isEnabled ( CommandLine . NEW_SESSION ) ) { System . err . println ( "Error: Invalid command line options: option '" + CommandLine . SESSION + "' not allowed with option '" + CommandLine . NEW_SESSION + "'" ) ; return false ; } if ( getArgs ( ) . isEnabled ( CommandLine . SESSION ) ) { Path sessionPath = SessionUtils . getSessionPath ( getArgs ( ) . getArgument ( CommandLine . SESSION ) ) ; String absolutePath = sessionPath . toAbsolutePath ( ) . toString ( ) ; try { control . runCommandLineOpenSession ( absolutePath ) ; } catch ( Exception e ) { getLogger ( ) . error ( e . getMessage ( ) , e ) ; System . err . println ( "Failed to open session: " + absolutePath ) ; e . printStackTrace ( System . err ) ; return false ; } } else if ( getArgs ( ) . isEnabled ( CommandLine . NEW_SESSION ) ) { Path sessionPath = SessionUtils . getSessionPath ( getArgs ( ) . getArgument ( CommandLine . NEW_SESSION ) ) ; String absolutePath = sessionPath . toAbsolutePath ( ) . toString ( ) ; if ( Files . exists ( sessionPath ) ) { System . err . println ( "Failed to create a new session, file already exists: " + absolutePath ) ; return false ; } try { control . runCommandLineNewSession ( absolutePath ) ; } catch ( Exception e ) { getLogger ( ) . error ( e . getMessage ( ) , e ) ; System . err . println ( "Failed to create a new session: " + absolutePath ) ; e . printStackTrace ( System . err ) ; return false ; } } return true ; }
Handles command line session related arguments synchronously .