@ Override public CompletableFuture < CreateScopeStatus > createScope ( final String scopeName ) { return getScope ( scopeName ) . createScope ( ) . handle ( ( result , ex ) -> { if ( ex == null ) { return CreateScopeStatus . newBuilder ( ) . setStatus ( CreateScopeStatus . Status . SUCCESS ) . build ( ) ; } if ( ex instanceof StoreException . DataExistsException || ex . getCause ( ) instanceof StoreException . DataExistsException ) { return CreateScopeStatus . newBuilder ( ) . setStatus ( CreateScopeStatus . Status . SCOPE_EXISTS ) . build ( ) ; } else { log . debug ( "Create scope failed due to " , ex ) ; return CreateScopeStatus . newBuilder ( ) . setStatus ( CreateScopeStatus . Status . FAILURE ) . build ( ) ; } } ) ; }
Create a scope with given name .