private < S , T > S getFromProtege ( T obj , ProtegeCommand < S , T > getter ) throws KnowledgeSourceReadException { if ( protegeKnowledgeBase != null && getter != null ) { int tries = TRIES ; Exception lastException = null ; do { try { return getter . getHelper ( obj ) ; } catch ( Exception e ) { lastException = e ; Util . logger ( ) . log ( Level . WARNING , "Exception attempting to " + getter . getWhat ( ) + " " + obj , e ) ; tries -- ; } close ( ) ; try { init ( ) ; } catch ( KnowledgeSourceBackendInitializationException e ) { throw new KnowledgeSourceReadException ( "Exception attempting to " + getter . getWhat ( ) + " " + obj , e ) ; } } while ( tries > 0 ) ; throw new KnowledgeSourceReadException ( "Failed to " + getter . getWhat ( ) + " " + obj + " after " + TRIES + " tries" , lastException ) ; } return null ; }
Executes a command upon the Protege knowledge base retrying if needed .