Unnamed: 0
int64
0
10k
source
stringlengths
27
7.27k
target
stringlengths
54
7.29k
0
public int enable ( GL gl , int refID ) { synchronized ( LOCK ) { if ( referencedRenderFragments . contains ( refID ) ) { } referencedRenderFragments . add ( refID ) ; loadToGPU ( gl ) ; } return textureID == null ? - 1 : textureID [ 0 ] ; }
public int enable ( GL gl , int refID ) { synchronized ( LOCK ) { if ( referencedRenderFragments . contains ( refID ) ) { LOG . debug ( "Given reference was already registered: {}" , refID ) ; } referencedRenderFragments . add ( refID ) ; loadToGPU ( gl ) ; } return textureID == null ? - 1 : textureID [ 0 ] ; }
1
public static void grepZkLog ( File zkLog , long start , long end , String ... patterns ) { FileInputStream fis = null ; BufferedReader br = null ; try { fis = new FileInputStream ( zkLog ) ; br = new BufferedReader ( new InputStreamReader ( fis ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { try { long timestamp = getTimestamp ( line ) ; if ( timestamp > end ) { break ; } if ( timestamp < start ) { continue ; } boolean match = true ; for ( String pattern : patterns ) { if ( line . indexOf ( pattern ) == - 1 ) { match = false ; break ; } } if ( match ) { System . out . println ( line ) ; } } catch ( NumberFormatException e ) { } } } catch ( Exception e ) { } finally { try { if ( br != null ) { br . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } } catch ( Exception e ) { LOG . error ( "exception in closing zk-log: " + zkLog , e ) ; } } }
public static void grepZkLog ( File zkLog , long start , long end , String ... patterns ) { FileInputStream fis = null ; BufferedReader br = null ; try { fis = new FileInputStream ( zkLog ) ; br = new BufferedReader ( new InputStreamReader ( fis ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { try { long timestamp = getTimestamp ( line ) ; if ( timestamp > end ) { break ; } if ( timestamp < start ) { continue ; } boolean match = true ; for ( String pattern : patterns ) { if ( line . indexOf ( pattern ) == - 1 ) { match = false ; break ; } } if ( match ) { System . out . println ( line ) ; } } catch ( NumberFormatException e ) { } } } catch ( Exception e ) { LOG . error ( "exception in grep zk-log: " + zkLog , e ) ; } finally { try { if ( br != null ) { br . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } } catch ( Exception e ) { LOG . error ( "exception in closing zk-log: " + zkLog , e ) ; } } }
2
public static void grepZkLog ( File zkLog , long start , long end , String ... patterns ) { FileInputStream fis = null ; BufferedReader br = null ; try { fis = new FileInputStream ( zkLog ) ; br = new BufferedReader ( new InputStreamReader ( fis ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { try { long timestamp = getTimestamp ( line ) ; if ( timestamp > end ) { break ; } if ( timestamp < start ) { continue ; } boolean match = true ; for ( String pattern : patterns ) { if ( line . indexOf ( pattern ) == - 1 ) { match = false ; break ; } } if ( match ) { System . out . println ( line ) ; } } catch ( NumberFormatException e ) { } } } catch ( Exception e ) { LOG . error ( "exception in grep zk-log: " + zkLog , e ) ; } finally { try { if ( br != null ) { br . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } } catch ( Exception e ) { } } }
public static void grepZkLog ( File zkLog , long start , long end , String ... patterns ) { FileInputStream fis = null ; BufferedReader br = null ; try { fis = new FileInputStream ( zkLog ) ; br = new BufferedReader ( new InputStreamReader ( fis ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { try { long timestamp = getTimestamp ( line ) ; if ( timestamp > end ) { break ; } if ( timestamp < start ) { continue ; } boolean match = true ; for ( String pattern : patterns ) { if ( line . indexOf ( pattern ) == - 1 ) { match = false ; break ; } } if ( match ) { System . out . println ( line ) ; } } catch ( NumberFormatException e ) { } } } catch ( Exception e ) { LOG . error ( "exception in grep zk-log: " + zkLog , e ) ; } finally { try { if ( br != null ) { br . close ( ) ; } if ( fis != null ) { fis . close ( ) ; } } catch ( Exception e ) { LOG . error ( "exception in closing zk-log: " + zkLog , e ) ; } } }
3
public CsvDestination setPath ( final String path ) { if ( csvFile != null ) { throw new UnsupportedOperationException ( "Changing the value of path after opening the destination is not allowed." ) ; } if ( outputChannel != null ) { try { outputChannel . close ( ) ; outputChannel = null ; } catch ( final IOException e ) { } } this . path = path ; return this ; }
public CsvDestination setPath ( final String path ) { if ( csvFile != null ) { throw new UnsupportedOperationException ( "Changing the value of path after opening the destination is not allowed." ) ; } if ( outputChannel != null ) { try { outputChannel . close ( ) ; outputChannel = null ; } catch ( final IOException e ) { log . error ( String . format ( "Could not close file channel with CSV results for file %s." , csvFile ) , e ) ; } } this . path = path ; return this ; }
4
public void handleV2Response ( long ledgerId , long entryId , StatusCode status , BookieProtocol . Response response ) { }
public void handleV2Response ( long ledgerId , long entryId , StatusCode status , BookieProtocol . Response response ) { LOG . warn ( "Unhandled V2 response {}" , response ) ; }
5
private String request ( String uri ) throws ShellyApiException { ShellyApiResult apiResult = new ShellyApiResult ( ) ; int retries = 3 ; boolean timeout = false ; while ( retries > 0 ) { try { apiResult = innerRequest ( HttpMethod . GET , uri ) ; if ( timeout ) { timeoutsRecovered ++ ; } return apiResult . response ; } catch ( ShellyApiException e ) { if ( ( ! e . isTimeout ( ) && ! apiResult . isHttpServerError ( ) ) || profile . hasBattery || ( retries == 0 ) ) { throw e ; } timeout = true ; retries -- ; timeoutErrors ++ ; logger . debug ( "{}: API Timeout, retry #{} ({})" , thingName , timeoutErrors , e . toString ( ) ) ; } } throw new ShellyApiException ( "API Timeout or inconsistent result" ) ; }
private String request ( String uri ) throws ShellyApiException { ShellyApiResult apiResult = new ShellyApiResult ( ) ; int retries = 3 ; boolean timeout = false ; while ( retries > 0 ) { try { apiResult = innerRequest ( HttpMethod . GET , uri ) ; if ( timeout ) { logger . debug ( "{}: API timeout #{}/{} recovered ({})" , thingName , timeoutErrors , timeoutsRecovered , apiResult . getUrl ( ) ) ; timeoutsRecovered ++ ; } return apiResult . response ; } catch ( ShellyApiException e ) { if ( ( ! e . isTimeout ( ) && ! apiResult . isHttpServerError ( ) ) || profile . hasBattery || ( retries == 0 ) ) { throw e ; } timeout = true ; retries -- ; timeoutErrors ++ ; logger . debug ( "{}: API Timeout, retry #{} ({})" , thingName , timeoutErrors , e . toString ( ) ) ; } } throw new ShellyApiException ( "API Timeout or inconsistent result" ) ; }
6
private String request ( String uri ) throws ShellyApiException { ShellyApiResult apiResult = new ShellyApiResult ( ) ; int retries = 3 ; boolean timeout = false ; while ( retries > 0 ) { try { apiResult = innerRequest ( HttpMethod . GET , uri ) ; if ( timeout ) { logger . debug ( "{}: API timeout #{}/{} recovered ({})" , thingName , timeoutErrors , timeoutsRecovered , apiResult . getUrl ( ) ) ; timeoutsRecovered ++ ; } return apiResult . response ; } catch ( ShellyApiException e ) { if ( ( ! e . isTimeout ( ) && ! apiResult . isHttpServerError ( ) ) || profile . hasBattery || ( retries == 0 ) ) { throw e ; } timeout = true ; retries -- ; timeoutErrors ++ ; } } throw new ShellyApiException ( "API Timeout or inconsistent result" ) ; }
private String request ( String uri ) throws ShellyApiException { ShellyApiResult apiResult = new ShellyApiResult ( ) ; int retries = 3 ; boolean timeout = false ; while ( retries > 0 ) { try { apiResult = innerRequest ( HttpMethod . GET , uri ) ; if ( timeout ) { logger . debug ( "{}: API timeout #{}/{} recovered ({})" , thingName , timeoutErrors , timeoutsRecovered , apiResult . getUrl ( ) ) ; timeoutsRecovered ++ ; } return apiResult . response ; } catch ( ShellyApiException e ) { if ( ( ! e . isTimeout ( ) && ! apiResult . isHttpServerError ( ) ) || profile . hasBattery || ( retries == 0 ) ) { throw e ; } timeout = true ; retries -- ; timeoutErrors ++ ; logger . debug ( "{}: API Timeout, retry #{} ({})" , thingName , timeoutErrors , e . toString ( ) ) ; } } throw new ShellyApiException ( "API Timeout or inconsistent result" ) ; }
7
public boolean wikiPageExists ( final String page ) { if ( m_engine . getManager ( CommandResolver . class ) . getSpecialPageReference ( page ) != null ) { return true ; } Attachment att = null ; try { if ( m_engine . getFinalPageName ( page ) != null ) { return true ; } att = m_engine . getManager ( AttachmentManager . class ) . getAttachmentInfo ( null , page ) ; } catch ( final ProviderException e ) { } return att != null ; }
public boolean wikiPageExists ( final String page ) { if ( m_engine . getManager ( CommandResolver . class ) . getSpecialPageReference ( page ) != null ) { return true ; } Attachment att = null ; try { if ( m_engine . getFinalPageName ( page ) != null ) { return true ; } att = m_engine . getManager ( AttachmentManager . class ) . getAttachmentInfo ( null , page ) ; } catch ( final ProviderException e ) { LOG . debug ( "pageExists() failed to find attachments" , e ) ; } return att != null ; }
8
public static ExprNode getValidatedSubtree ( ExprNodeOrigin origin , ExprNode exprNode , ExprValidationContext validationContext ) throws ExprValidationException { if ( exprNode instanceof ExprLambdaGoesNode ) { return exprNode ; } try { return getValidatedSubtreeInternal ( exprNode , validationContext , true ) ; } catch ( ExprValidationException ex ) { try { String text ; if ( exprNode instanceof ExprSubselectNode ) { ExprSubselectNode subselect = ( ExprSubselectNode ) exprNode ; text = ExprNodeUtilityMake . getSubqueryInfoText ( subselect ) ; } else { text = ExprNodeUtilityPrint . toExpressionStringMinPrecedenceSafe ( exprNode ) ; if ( text . length ( ) > 40 ) { String shortened = text . substring ( 0 , 35 ) ; text = shortened + "...(" + text . length ( ) + " chars)" ; } text = "'" + text + "'" ; } throw makeValidationExWExpression ( origin , text , ex ) ; } catch ( RuntimeException rtex ) { throw ex ; } } }
public static ExprNode getValidatedSubtree ( ExprNodeOrigin origin , ExprNode exprNode , ExprValidationContext validationContext ) throws ExprValidationException { if ( exprNode instanceof ExprLambdaGoesNode ) { return exprNode ; } try { return getValidatedSubtreeInternal ( exprNode , validationContext , true ) ; } catch ( ExprValidationException ex ) { try { String text ; if ( exprNode instanceof ExprSubselectNode ) { ExprSubselectNode subselect = ( ExprSubselectNode ) exprNode ; text = ExprNodeUtilityMake . getSubqueryInfoText ( subselect ) ; } else { text = ExprNodeUtilityPrint . toExpressionStringMinPrecedenceSafe ( exprNode ) ; if ( text . length ( ) > 40 ) { String shortened = text . substring ( 0 , 35 ) ; text = shortened + "...(" + text . length ( ) + " chars)" ; } text = "'" + text + "'" ; } throw makeValidationExWExpression ( origin , text , ex ) ; } catch ( RuntimeException rtex ) { log . debug ( "Failed to render nice validation message text: " + rtex . getMessage ( ) , rtex ) ; throw ex ; } } }
9
public void handleLine ( String line ) { if ( getLogger ( ) . isDebugEnabled ( ) ) { } if ( line . startsWith ( "VALUE " ) ) { String [ ] stuff = line . split ( " " ) ; assert stuff . length == 3 ; assert "VALUE" . equals ( stuff [ 0 ] ) ; flags = Integer . parseInt ( stuff [ 1 ] ) ; count = Integer . parseInt ( stuff [ 2 ] ) ; if ( count > 0 ) { pos = get . isReversed ( ) ? get . getPosTo ( ) + count - 1 : get . getPosFrom ( ) ; posDiff = get . isReversed ( ) ? - 1 : 1 ; setReadType ( OperationReadType . DATA ) ; } } else { OperationStatus status = matchStatus ( line , END , NOT_FOUND , UNREADABLE , TYPE_MISMATCH , NOT_FOUND_ELEMENT ) ; if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( status ) ; } getCallback ( ) . receivedStatus ( status ) ; transitionState ( OperationState . COMPLETE ) ; return ; } }
public void handleLine ( String line ) { if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( "Got line %s" , line ) ; } if ( line . startsWith ( "VALUE " ) ) { String [ ] stuff = line . split ( " " ) ; assert stuff . length == 3 ; assert "VALUE" . equals ( stuff [ 0 ] ) ; flags = Integer . parseInt ( stuff [ 1 ] ) ; count = Integer . parseInt ( stuff [ 2 ] ) ; if ( count > 0 ) { pos = get . isReversed ( ) ? get . getPosTo ( ) + count - 1 : get . getPosFrom ( ) ; posDiff = get . isReversed ( ) ? - 1 : 1 ; setReadType ( OperationReadType . DATA ) ; } } else { OperationStatus status = matchStatus ( line , END , NOT_FOUND , UNREADABLE , TYPE_MISMATCH , NOT_FOUND_ELEMENT ) ; if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( status ) ; } getCallback ( ) . receivedStatus ( status ) ; transitionState ( OperationState . COMPLETE ) ; return ; } }
10
public void handleLine ( String line ) { if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( "Got line %s" , line ) ; } if ( line . startsWith ( "VALUE " ) ) { String [ ] stuff = line . split ( " " ) ; assert stuff . length == 3 ; assert "VALUE" . equals ( stuff [ 0 ] ) ; flags = Integer . parseInt ( stuff [ 1 ] ) ; count = Integer . parseInt ( stuff [ 2 ] ) ; if ( count > 0 ) { pos = get . isReversed ( ) ? get . getPosTo ( ) + count - 1 : get . getPosFrom ( ) ; posDiff = get . isReversed ( ) ? - 1 : 1 ; setReadType ( OperationReadType . DATA ) ; } } else { OperationStatus status = matchStatus ( line , END , NOT_FOUND , UNREADABLE , TYPE_MISMATCH , NOT_FOUND_ELEMENT ) ; if ( getLogger ( ) . isDebugEnabled ( ) ) { } getCallback ( ) . receivedStatus ( status ) ; transitionState ( OperationState . COMPLETE ) ; return ; } }
public void handleLine ( String line ) { if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( "Got line %s" , line ) ; } if ( line . startsWith ( "VALUE " ) ) { String [ ] stuff = line . split ( " " ) ; assert stuff . length == 3 ; assert "VALUE" . equals ( stuff [ 0 ] ) ; flags = Integer . parseInt ( stuff [ 1 ] ) ; count = Integer . parseInt ( stuff [ 2 ] ) ; if ( count > 0 ) { pos = get . isReversed ( ) ? get . getPosTo ( ) + count - 1 : get . getPosFrom ( ) ; posDiff = get . isReversed ( ) ? - 1 : 1 ; setReadType ( OperationReadType . DATA ) ; } } else { OperationStatus status = matchStatus ( line , END , NOT_FOUND , UNREADABLE , TYPE_MISMATCH , NOT_FOUND_ELEMENT ) ; if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( status ) ; } getCallback ( ) . receivedStatus ( status ) ; transitionState ( OperationState . COMPLETE ) ; return ; } }
11
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { s_logger . error ( e . toString ( ) ) ; if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { s_logger . debug ( "Failed to define clvm storage pool with: " + l . toString ( ) ) ; } } return null ; } }
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { s_logger . debug ( spd . toString ( ) ) ; sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { s_logger . error ( e . toString ( ) ) ; if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { s_logger . debug ( "Failed to define clvm storage pool with: " + l . toString ( ) ) ; } } return null ; } }
12
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { s_logger . debug ( spd . toString ( ) ) ; sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { s_logger . debug ( "Failed to define clvm storage pool with: " + l . toString ( ) ) ; } } return null ; } }
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { s_logger . debug ( spd . toString ( ) ) ; sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { s_logger . error ( e . toString ( ) ) ; if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { s_logger . debug ( "Failed to define clvm storage pool with: " + l . toString ( ) ) ; } } return null ; } }
13
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { s_logger . debug ( spd . toString ( ) ) ; sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { s_logger . error ( e . toString ( ) ) ; if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { } } return null ; } }
private StoragePool createCLVMStoragePool ( Connect conn , String uuid , String host , String path ) { String volgroupPath = "/dev/" + path ; String volgroupName = path ; volgroupName = volgroupName . replaceFirst ( "/" , "" ) ; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef ( PoolType . LOGICAL , volgroupName , uuid , host , volgroupPath , volgroupPath ) ; StoragePool sp = null ; try { s_logger . debug ( spd . toString ( ) ) ; sp = conn . storagePoolCreateXML ( spd . toString ( ) , 0 ) ; return sp ; } catch ( LibvirtException e ) { s_logger . error ( e . toString ( ) ) ; if ( sp != null ) { try { if ( sp . isPersistent ( ) == 1 ) { sp . destroy ( ) ; sp . undefine ( ) ; } else { sp . destroy ( ) ; } sp . free ( ) ; } catch ( LibvirtException l ) { s_logger . debug ( "Failed to define clvm storage pool with: " + l . toString ( ) ) ; } } return null ; } }
14
@ BeforeMethod ( alwaysRun = true ) public void setUp ( Method method ) throws Exception { logger . info ( "Creating a new Session for " + method . getName ( ) ) ; sessionHandleString = sHelper . openSession ( lens . getCurrentDB ( ) ) ; }
@ BeforeMethod ( alwaysRun = true ) public void setUp ( Method method ) throws Exception { logger . info ( "Test Name: " + method . getName ( ) ) ; logger . info ( "Creating a new Session for " + method . getName ( ) ) ; sessionHandleString = sHelper . openSession ( lens . getCurrentDB ( ) ) ; }
15
private void logWarnings ( JsonObject body ) { if ( body . has ( "Warnings" ) ) { JsonElement warningsObj = body . get ( "Warnings" ) ; if ( ! warningsObj . isJsonNull ( ) ) { JsonArray warnings = ( JsonArray ) warningsObj ; for ( int i = 0 ; i < warnings . size ( ) ; i ++ ) { } } } }
private void logWarnings ( JsonObject body ) { if ( body . has ( "Warnings" ) ) { JsonElement warningsObj = body . get ( "Warnings" ) ; if ( ! warningsObj . isJsonNull ( ) ) { JsonArray warnings = ( JsonArray ) warningsObj ; for ( int i = 0 ; i < warnings . size ( ) ; i ++ ) { log . warn ( warnings . get ( i ) . getAsString ( ) ) ; } } } }
16
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
17
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
18
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
19
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
public GenPolynomial < GenPolynomial < C > > call ( ) { try { GenPolynomial < GenPolynomial < C > > g = e1 . recursiveUnivariateGcd ( P , S ) ; if ( debug ) { logger . info ( "GCDProxy done e1 " + e1 . getClass ( ) . getName ( ) ) ; } return g ; } catch ( PreemptingException e ) { throw new RuntimeException ( "GCDProxy e1 pre " + e ) ; } catch ( Exception e ) { logger . info ( "GCDProxy e1 " + e ) ; logger . info ( "GCDProxy P = " + P ) ; logger . info ( "GCDProxy S = " + S ) ; throw new RuntimeException ( "GCDProxy e1 " + e ) ; } }
20
protected void doStop ( ) throws Exception { for ( Map . Entry < String , PropertyUserStore > entry : _propertyUserStores . entrySet ( ) ) { try { entry . getValue ( ) . stop ( ) ; } catch ( Exception e ) { } } _propertyUserStores = null ; super . doStop ( ) ; }
protected void doStop ( ) throws Exception { for ( Map . Entry < String , PropertyUserStore > entry : _propertyUserStores . entrySet ( ) ) { try { entry . getValue ( ) . stop ( ) ; } catch ( Exception e ) { LOG . warn ( "Error stopping PropertyUserStore at {}" , entry . getKey ( ) , e ) ; } } _propertyUserStores = null ; super . doStop ( ) ; }
21
public RepeatStatus executeStep ( ChunkContext chunkContext , JobExecutionStatusHolder jobExecutionStatusHolder ) throws Exception { String clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . CLUSTER_NAME_JOB_PARAM ) ; if ( clusterName == null ) { clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . TARGET_NAME_JOB_PARAM ) . split ( "-" ) [ 0 ] ; } String nodeName = getJobParameters ( chunkContext ) . getString ( JobConstants . SUB_JOB_NODE_NAME ) ; String vmPowerOnStr = getJobParameters ( chunkContext ) . getString ( JobConstants . IS_VM_POWER_ON ) ; boolean vmPowerOn = Boolean . parseBoolean ( vmPowerOnStr ) ; if ( ! checkVMStatus || ( checkVMStatus && ! vmPowerOn ) ) { logger . debug ( "check vm status: " + checkVMStatus + ", vm original status is poweron? " + vmPowerOn ) ; StatusUpdater statusUpdator = new DefaultStatusUpdater ( jobExecutionStatusHolder , getJobExecutionId ( chunkContext ) ) ; boolean success = clusteringService . stopSingleVM ( clusterName , nodeName , statusUpdator , vmPoweroff ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . NODE_OPERATION_SUCCESS , success ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . EXPECTED_NODE_STATUS , NodeStatus . POWERED_OFF ) ; if ( ! success ) { throw VcProviderException . STOP_VM_ERROR ( nodeName ) ; } } return RepeatStatus . FINISHED ; }
public RepeatStatus executeStep ( ChunkContext chunkContext , JobExecutionStatusHolder jobExecutionStatusHolder ) throws Exception { String clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . CLUSTER_NAME_JOB_PARAM ) ; if ( clusterName == null ) { clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . TARGET_NAME_JOB_PARAM ) . split ( "-" ) [ 0 ] ; } String nodeName = getJobParameters ( chunkContext ) . getString ( JobConstants . SUB_JOB_NODE_NAME ) ; String vmPowerOnStr = getJobParameters ( chunkContext ) . getString ( JobConstants . IS_VM_POWER_ON ) ; logger . debug ( "nodename: " + nodeName + "vm original status is power on? " + vmPowerOnStr ) ; boolean vmPowerOn = Boolean . parseBoolean ( vmPowerOnStr ) ; if ( ! checkVMStatus || ( checkVMStatus && ! vmPowerOn ) ) { logger . debug ( "check vm status: " + checkVMStatus + ", vm original status is poweron? " + vmPowerOn ) ; StatusUpdater statusUpdator = new DefaultStatusUpdater ( jobExecutionStatusHolder , getJobExecutionId ( chunkContext ) ) ; boolean success = clusteringService . stopSingleVM ( clusterName , nodeName , statusUpdator , vmPoweroff ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . NODE_OPERATION_SUCCESS , success ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . EXPECTED_NODE_STATUS , NodeStatus . POWERED_OFF ) ; if ( ! success ) { throw VcProviderException . STOP_VM_ERROR ( nodeName ) ; } } return RepeatStatus . FINISHED ; }
22
public RepeatStatus executeStep ( ChunkContext chunkContext , JobExecutionStatusHolder jobExecutionStatusHolder ) throws Exception { String clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . CLUSTER_NAME_JOB_PARAM ) ; if ( clusterName == null ) { clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . TARGET_NAME_JOB_PARAM ) . split ( "-" ) [ 0 ] ; } String nodeName = getJobParameters ( chunkContext ) . getString ( JobConstants . SUB_JOB_NODE_NAME ) ; String vmPowerOnStr = getJobParameters ( chunkContext ) . getString ( JobConstants . IS_VM_POWER_ON ) ; logger . debug ( "nodename: " + nodeName + "vm original status is power on? " + vmPowerOnStr ) ; boolean vmPowerOn = Boolean . parseBoolean ( vmPowerOnStr ) ; if ( ! checkVMStatus || ( checkVMStatus && ! vmPowerOn ) ) { StatusUpdater statusUpdator = new DefaultStatusUpdater ( jobExecutionStatusHolder , getJobExecutionId ( chunkContext ) ) ; boolean success = clusteringService . stopSingleVM ( clusterName , nodeName , statusUpdator , vmPoweroff ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . NODE_OPERATION_SUCCESS , success ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . EXPECTED_NODE_STATUS , NodeStatus . POWERED_OFF ) ; if ( ! success ) { throw VcProviderException . STOP_VM_ERROR ( nodeName ) ; } } return RepeatStatus . FINISHED ; }
public RepeatStatus executeStep ( ChunkContext chunkContext , JobExecutionStatusHolder jobExecutionStatusHolder ) throws Exception { String clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . CLUSTER_NAME_JOB_PARAM ) ; if ( clusterName == null ) { clusterName = getJobParameters ( chunkContext ) . getString ( JobConstants . TARGET_NAME_JOB_PARAM ) . split ( "-" ) [ 0 ] ; } String nodeName = getJobParameters ( chunkContext ) . getString ( JobConstants . SUB_JOB_NODE_NAME ) ; String vmPowerOnStr = getJobParameters ( chunkContext ) . getString ( JobConstants . IS_VM_POWER_ON ) ; logger . debug ( "nodename: " + nodeName + "vm original status is power on? " + vmPowerOnStr ) ; boolean vmPowerOn = Boolean . parseBoolean ( vmPowerOnStr ) ; if ( ! checkVMStatus || ( checkVMStatus && ! vmPowerOn ) ) { logger . debug ( "check vm status: " + checkVMStatus + ", vm original status is poweron? " + vmPowerOn ) ; StatusUpdater statusUpdator = new DefaultStatusUpdater ( jobExecutionStatusHolder , getJobExecutionId ( chunkContext ) ) ; boolean success = clusteringService . stopSingleVM ( clusterName , nodeName , statusUpdator , vmPoweroff ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . NODE_OPERATION_SUCCESS , success ) ; putIntoJobExecutionContext ( chunkContext , JobConstants . EXPECTED_NODE_STATUS , NodeStatus . POWERED_OFF ) ; if ( ! success ) { throw VcProviderException . STOP_VM_ERROR ( nodeName ) ; } } return RepeatStatus . FINISHED ; }
23
public void generate ( Model model , MolgenisOptions options ) throws Exception { Template template = createTemplate ( "/" + getClass ( ) . getSimpleName ( ) + ".java.ftl" ) ; Map < String , Object > templateArgs = createTemplateArguments ( options ) ; File target = new File ( this . getDocumentationPath ( options ) + "/objectmodel.html" ) ; target . getParentFile ( ) . mkdirs ( ) ; List < Entity > entityList = model . getEntities ( ) ; List < Module > moduleList = model . getModules ( ) ; entityList = MolgenisModel . sortEntitiesByDependency ( entityList , model ) ; templateArgs . put ( "model" , model ) ; templateArgs . put ( "entities" , entityList ) ; templateArgs . put ( "modules" , moduleList ) ; OutputStream targetOut = new FileOutputStream ( target ) ; template . process ( templateArgs , new OutputStreamWriter ( targetOut , Charset . forName ( "UTF-8" ) ) ) ; targetOut . close ( ) ; }
public void generate ( Model model , MolgenisOptions options ) throws Exception { Template template = createTemplate ( "/" + getClass ( ) . getSimpleName ( ) + ".java.ftl" ) ; Map < String , Object > templateArgs = createTemplateArguments ( options ) ; File target = new File ( this . getDocumentationPath ( options ) + "/objectmodel.html" ) ; target . getParentFile ( ) . mkdirs ( ) ; List < Entity > entityList = model . getEntities ( ) ; List < Module > moduleList = model . getModules ( ) ; entityList = MolgenisModel . sortEntitiesByDependency ( entityList , model ) ; templateArgs . put ( "model" , model ) ; templateArgs . put ( "entities" , entityList ) ; templateArgs . put ( "modules" , moduleList ) ; OutputStream targetOut = new FileOutputStream ( target ) ; template . process ( templateArgs , new OutputStreamWriter ( targetOut , Charset . forName ( "UTF-8" ) ) ) ; targetOut . close ( ) ; logger . info ( "generated " + target ) ; }
24
public final Response getSequence ( final String seqId , boolean next ) { String path ; if ( next ) { path = String . format ( SEQUENCE_PATH , seqId ) + "/next" ; } else { path = String . format ( SEQUENCE_PATH , seqId ) + "/curr" ; } return getObjectToSystemMng ( path ) ; }
public final Response getSequence ( final String seqId , boolean next ) { String path ; if ( next ) { path = String . format ( SEQUENCE_PATH , seqId ) + "/next" ; } else { path = String . format ( SEQUENCE_PATH , seqId ) + "/curr" ; } log . debug ( "seqId='{}'" , seqId ) ; return getObjectToSystemMng ( path ) ; }
25
public void initializeDatabaseContent ( ) { super . initializeDatabaseContent ( ) ; if ( projectInitEnabled ) { } }
public void initializeDatabaseContent ( ) { super . initializeDatabaseContent ( ) ; if ( projectInitEnabled ) { LOG . info ( "Initializing project specific stuff..." ) ; } }
26
public static S3AUnderFileSystem createInstance ( AlluxioURI uri , UnderFileSystemConfiguration conf ) { AWSCredentialsProvider credentials = createAwsCredentialsProvider ( conf ) ; String bucketName = UnderFileSystemUtils . getBucketName ( uri ) ; ClientConfiguration clientConf = new ClientConfiguration ( ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_MAX_ERROR_RETRY ) ) { clientConf . setMaxErrorRetry ( conf . getInt ( PropertyKey . UNDERFS_S3_MAX_ERROR_RETRY ) ) ; } clientConf . setConnectionTTL ( conf . getMs ( PropertyKey . UNDERFS_S3_CONNECT_TTL ) ) ; clientConf . setSocketTimeout ( ( int ) conf . getMs ( PropertyKey . UNDERFS_S3_SOCKET_TIMEOUT ) ) ; if ( Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_SECURE_HTTP_ENABLED ) ) || Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_SERVER_SIDE_ENCRYPTION_ENABLED ) ) ) { clientConf . setProtocol ( Protocol . HTTPS ) ; } else { clientConf . setProtocol ( Protocol . HTTP ) ; } if ( conf . isSet ( PropertyKey . UNDERFS_S3_PROXY_HOST ) ) { clientConf . setProxyHost ( conf . get ( PropertyKey . UNDERFS_S3_PROXY_HOST ) ) ; } if ( conf . isSet ( PropertyKey . UNDERFS_S3_PROXY_PORT ) ) { clientConf . setProxyPort ( Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_PROXY_PORT ) ) ) ; } int numAdminThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_ADMIN_THREADS_MAX ) ) ; int numTransferThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_UPLOAD_THREADS_MAX ) ) ; int numThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_THREADS_MAX ) ) ; if ( numThreads < numAdminThreads + numTransferThreads ) { numThreads = numAdminThreads + numTransferThreads ; } clientConf . setMaxConnections ( numThreads ) ; clientConf . setRequestTimeout ( ( int ) conf . getMs ( PropertyKey . UNDERFS_S3_REQUEST_TIMEOUT ) ) ; boolean streamingUploadEnabled = conf . getBoolean ( PropertyKey . UNDERFS_S3_STREAMING_UPLOAD_ENABLED ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_SIGNER_ALGORITHM ) ) { clientConf . setSignerOverride ( conf . get ( PropertyKey . UNDERFS_S3_SIGNER_ALGORITHM ) ) ; } AmazonS3Client amazonS3Client = new AmazonS3Client ( credentials , clientConf ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_ENDPOINT ) ) { amazonS3Client . setEndpoint ( conf . get ( PropertyKey . UNDERFS_S3_ENDPOINT ) ) ; } if ( Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_DISABLE_DNS_BUCKETS ) ) ) { S3ClientOptions clientOptions = S3ClientOptions . builder ( ) . setPathStyleAccess ( true ) . build ( ) ; amazonS3Client . setS3ClientOptions ( clientOptions ) ; } ExecutorService service = ExecutorServiceFactories . fixedThreadPool ( "alluxio-s3-transfer-manager-worker" , numTransferThreads ) . create ( ) ; TransferManager transferManager = TransferManagerBuilder . standard ( ) . withS3Client ( amazonS3Client ) . withExecutorFactory ( ( ) -> service ) . withMultipartCopyThreshold ( MULTIPART_COPY_THRESHOLD ) . build ( ) ; return new S3AUnderFileSystem ( uri , amazonS3Client , bucketName , service , transferManager , conf , streamingUploadEnabled ) ; }
public static S3AUnderFileSystem createInstance ( AlluxioURI uri , UnderFileSystemConfiguration conf ) { AWSCredentialsProvider credentials = createAwsCredentialsProvider ( conf ) ; String bucketName = UnderFileSystemUtils . getBucketName ( uri ) ; ClientConfiguration clientConf = new ClientConfiguration ( ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_MAX_ERROR_RETRY ) ) { clientConf . setMaxErrorRetry ( conf . getInt ( PropertyKey . UNDERFS_S3_MAX_ERROR_RETRY ) ) ; } clientConf . setConnectionTTL ( conf . getMs ( PropertyKey . UNDERFS_S3_CONNECT_TTL ) ) ; clientConf . setSocketTimeout ( ( int ) conf . getMs ( PropertyKey . UNDERFS_S3_SOCKET_TIMEOUT ) ) ; if ( Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_SECURE_HTTP_ENABLED ) ) || Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_SERVER_SIDE_ENCRYPTION_ENABLED ) ) ) { clientConf . setProtocol ( Protocol . HTTPS ) ; } else { clientConf . setProtocol ( Protocol . HTTP ) ; } if ( conf . isSet ( PropertyKey . UNDERFS_S3_PROXY_HOST ) ) { clientConf . setProxyHost ( conf . get ( PropertyKey . UNDERFS_S3_PROXY_HOST ) ) ; } if ( conf . isSet ( PropertyKey . UNDERFS_S3_PROXY_PORT ) ) { clientConf . setProxyPort ( Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_PROXY_PORT ) ) ) ; } int numAdminThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_ADMIN_THREADS_MAX ) ) ; int numTransferThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_UPLOAD_THREADS_MAX ) ) ; int numThreads = Integer . parseInt ( conf . get ( PropertyKey . UNDERFS_S3_THREADS_MAX ) ) ; if ( numThreads < numAdminThreads + numTransferThreads ) { LOG . warn ( "Configured s3 max threads ({}) is less than # admin threads ({}) plus transfer " + "threads ({}). Using admin threads + transfer threads as max threads instead." , numThreads , numAdminThreads , numTransferThreads ) ; numThreads = numAdminThreads + numTransferThreads ; } clientConf . setMaxConnections ( numThreads ) ; clientConf . setRequestTimeout ( ( int ) conf . getMs ( PropertyKey . UNDERFS_S3_REQUEST_TIMEOUT ) ) ; boolean streamingUploadEnabled = conf . getBoolean ( PropertyKey . UNDERFS_S3_STREAMING_UPLOAD_ENABLED ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_SIGNER_ALGORITHM ) ) { clientConf . setSignerOverride ( conf . get ( PropertyKey . UNDERFS_S3_SIGNER_ALGORITHM ) ) ; } AmazonS3Client amazonS3Client = new AmazonS3Client ( credentials , clientConf ) ; if ( conf . isSet ( PropertyKey . UNDERFS_S3_ENDPOINT ) ) { amazonS3Client . setEndpoint ( conf . get ( PropertyKey . UNDERFS_S3_ENDPOINT ) ) ; } if ( Boolean . parseBoolean ( conf . get ( PropertyKey . UNDERFS_S3_DISABLE_DNS_BUCKETS ) ) ) { S3ClientOptions clientOptions = S3ClientOptions . builder ( ) . setPathStyleAccess ( true ) . build ( ) ; amazonS3Client . setS3ClientOptions ( clientOptions ) ; } ExecutorService service = ExecutorServiceFactories . fixedThreadPool ( "alluxio-s3-transfer-manager-worker" , numTransferThreads ) . create ( ) ; TransferManager transferManager = TransferManagerBuilder . standard ( ) . withS3Client ( amazonS3Client ) . withExecutorFactory ( ( ) -> service ) . withMultipartCopyThreshold ( MULTIPART_COPY_THRESHOLD ) . build ( ) ; return new S3AUnderFileSystem ( uri , amazonS3Client , bucketName , service , transferManager , conf , streamingUploadEnabled ) ; }
27
@ Given ( "the IEC60870 device is not connected" ) public void givenIec60870DeviceIsNotConnected ( ) throws ConnectionFailureException { final DeviceConnection deviceConnection = new DeviceConnection ( mock ( Connection . class ) , this . connectionParameters ) ; when ( this . clientMock . connect ( eq ( this . connectionParameters ) , any ( ClientConnectionEventListener . class ) ) ) . thenReturn ( deviceConnection ) ; }
@ Given ( "the IEC60870 device is not connected" ) public void givenIec60870DeviceIsNotConnected ( ) throws ConnectionFailureException { LOGGER . debug ( "Given IEC60870 device is not connected" ) ; final DeviceConnection deviceConnection = new DeviceConnection ( mock ( Connection . class ) , this . connectionParameters ) ; when ( this . clientMock . connect ( eq ( this . connectionParameters ) , any ( ClientConnectionEventListener . class ) ) ) . thenReturn ( deviceConnection ) ; }
28
public void initialize ( Class < K > keyClass , Class < T > persistentClass , Properties properties ) throws GoraException { super . initialize ( keyClass , persistentClass , properties ) ; try { rethinkDBStoreParameters = RethinkDBStoreParameters . load ( properties ) ; connection = r . connection ( ) . hostname ( rethinkDBStoreParameters . getServerHost ( ) ) . port ( Integer . valueOf ( rethinkDBStoreParameters . getServerPort ( ) ) ) . user ( rethinkDBStoreParameters . getUserName ( ) , rethinkDBStoreParameters . getUserPassword ( ) ) . connect ( ) ; String databaseIdentifier = rethinkDBStoreParameters . getDatabaseName ( ) ; if ( ! r . dbList ( ) . run ( connection , ArrayList . class ) . first ( ) . stream ( ) . anyMatch ( db -> db . equals ( databaseIdentifier ) ) ) { r . dbCreate ( rethinkDBStoreParameters . getDatabaseName ( ) ) . run ( connection ) ; } RethinkDBMappingBuilder < K , T > builder = new RethinkDBMappingBuilder < > ( this ) ; rethinkDBMapping = builder . fromFile ( rethinkDBStoreParameters . getMappingFile ( ) ) . build ( ) ; if ( ! schemaExists ( ) ) { createSchema ( ) ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
public void initialize ( Class < K > keyClass , Class < T > persistentClass , Properties properties ) throws GoraException { super . initialize ( keyClass , persistentClass , properties ) ; try { rethinkDBStoreParameters = RethinkDBStoreParameters . load ( properties ) ; connection = r . connection ( ) . hostname ( rethinkDBStoreParameters . getServerHost ( ) ) . port ( Integer . valueOf ( rethinkDBStoreParameters . getServerPort ( ) ) ) . user ( rethinkDBStoreParameters . getUserName ( ) , rethinkDBStoreParameters . getUserPassword ( ) ) . connect ( ) ; String databaseIdentifier = rethinkDBStoreParameters . getDatabaseName ( ) ; if ( ! r . dbList ( ) . run ( connection , ArrayList . class ) . first ( ) . stream ( ) . anyMatch ( db -> db . equals ( databaseIdentifier ) ) ) { r . dbCreate ( rethinkDBStoreParameters . getDatabaseName ( ) ) . run ( connection ) ; } RethinkDBMappingBuilder < K , T > builder = new RethinkDBMappingBuilder < > ( this ) ; rethinkDBMapping = builder . fromFile ( rethinkDBStoreParameters . getMappingFile ( ) ) . build ( ) ; if ( ! schemaExists ( ) ) { createSchema ( ) ; } } catch ( Exception e ) { LOG . error ( "Error while initializing RethinkDB dataStore: {}" , new Object [ ] { e . getMessage ( ) } ) ; throw new RuntimeException ( e ) ; } }
29
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { logger . info ( "createProvider exception" , e ) ; return buildResponse ( e ) ; } logger . debug ( "EndOf createProvider" ) ; return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { logger . debug ( "StartOf createProvider - REQUEST Insert /providers" ) ; ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { logger . info ( "createProvider exception" , e ) ; return buildResponse ( e ) ; } logger . debug ( "EndOf createProvider" ) ; return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
30
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { logger . debug ( "StartOf createProvider - REQUEST Insert /providers" ) ; ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { return buildResponse ( e ) ; } logger . debug ( "EndOf createProvider" ) ; return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { logger . debug ( "StartOf createProvider - REQUEST Insert /providers" ) ; ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { logger . info ( "createProvider exception" , e ) ; return buildResponse ( e ) ; } logger . debug ( "EndOf createProvider" ) ; return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
31
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { logger . debug ( "StartOf createProvider - REQUEST Insert /providers" ) ; ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { logger . info ( "createProvider exception" , e ) ; return buildResponse ( e ) ; } return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
@ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public Response createProvider ( @ Context HttpHeaders hh , @ Context UriInfo uriInfo , String payload ) throws IOException , JAXBException { logger . debug ( "StartOf createProvider - REQUEST Insert /providers" ) ; ProviderHelper providerRestService = getProviderHelper ( ) ; String location ; try { location = providerRestService . createProvider ( hh , uriInfo . getAbsolutePath ( ) . toString ( ) , payload ) ; } catch ( HelperException e ) { logger . info ( "createProvider exception" , e ) ; return buildResponse ( e ) ; } logger . debug ( "EndOf createProvider" ) ; return buildResponsePOST ( HttpStatus . CREATED , printMessage ( HttpStatus . CREATED , "The createProvider has been stored successfully in the SLA Repository Database" ) , location ) ; }
32
public static SignatureAndHashAlgorithm forCertificateKeyPair ( CertificateKeyPair keyPair , Chooser chooser ) { Sets . SetView < SignatureAndHashAlgorithm > intersection = Sets . intersection ( Sets . newHashSet ( chooser . getClientSupportedSignatureAndHashAlgorithms ( ) ) , Sets . newHashSet ( chooser . getServerSupportedSignatureAndHashAlgorithms ( ) ) ) ; List < SignatureAndHashAlgorithm > algorithms = new ArrayList < > ( intersection ) ; List < SignatureAndHashAlgorithm > clientPreferredHash = new ArrayList < > ( algorithms ) ; clientPreferredHash . removeIf ( i -> i . getHashAlgorithm ( ) != chooser . getConfig ( ) . getPreferredHashAlgorithm ( ) ) ; algorithms . addAll ( 0 , clientPreferredHash ) ; if ( chooser . getSelectedProtocolVersion ( ) . isTLS13 ( ) ) { algorithms . removeIf ( i -> i . toString ( ) . contains ( "RSA_SHA" ) ) ; } SignatureAndHashAlgorithm sigHashAlgo = null ; CertificateKeyType certPublicKeyType = keyPair . getCertPublicKeyType ( ) ; boolean found = false ; for ( SignatureAndHashAlgorithm i : algorithms ) { SignatureAlgorithm sig = i . getSignatureAlgorithm ( ) ; switch ( certPublicKeyType ) { case ECDH : case ECDSA : if ( sig == SignatureAlgorithm . ECDSA ) { found = true ; sigHashAlgo = i ; } break ; case RSA : if ( sig . toString ( ) . contains ( "RSA" ) ) { found = true ; sigHashAlgo = i ; } break ; case DSS : if ( sig == SignatureAlgorithm . DSA ) { found = true ; sigHashAlgo = i ; } break ; case GOST01 : if ( sig == SignatureAlgorithm . GOSTR34102001 ) { found = true ; sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102001_GOSTR3411 ; } break ; case GOST12 : if ( sig == SignatureAlgorithm . GOSTR34102012_256 || sig == SignatureAlgorithm . GOSTR34102012_512 ) { found = true ; if ( keyPair . getGostCurve ( ) . is512bit2012 ( ) ) { sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102012_512_GOSTR34112012_512 ; } else { sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102012_256_GOSTR34112012_256 ; } } break ; } if ( found ) { break ; } } if ( sigHashAlgo == null ) { sigHashAlgo = SignatureAndHashAlgorithm . RSA_SHA256 ; } return sigHashAlgo ; }
public static SignatureAndHashAlgorithm forCertificateKeyPair ( CertificateKeyPair keyPair , Chooser chooser ) { Sets . SetView < SignatureAndHashAlgorithm > intersection = Sets . intersection ( Sets . newHashSet ( chooser . getClientSupportedSignatureAndHashAlgorithms ( ) ) , Sets . newHashSet ( chooser . getServerSupportedSignatureAndHashAlgorithms ( ) ) ) ; List < SignatureAndHashAlgorithm > algorithms = new ArrayList < > ( intersection ) ; List < SignatureAndHashAlgorithm > clientPreferredHash = new ArrayList < > ( algorithms ) ; clientPreferredHash . removeIf ( i -> i . getHashAlgorithm ( ) != chooser . getConfig ( ) . getPreferredHashAlgorithm ( ) ) ; algorithms . addAll ( 0 , clientPreferredHash ) ; if ( chooser . getSelectedProtocolVersion ( ) . isTLS13 ( ) ) { algorithms . removeIf ( i -> i . toString ( ) . contains ( "RSA_SHA" ) ) ; } SignatureAndHashAlgorithm sigHashAlgo = null ; CertificateKeyType certPublicKeyType = keyPair . getCertPublicKeyType ( ) ; boolean found = false ; for ( SignatureAndHashAlgorithm i : algorithms ) { SignatureAlgorithm sig = i . getSignatureAlgorithm ( ) ; switch ( certPublicKeyType ) { case ECDH : case ECDSA : if ( sig == SignatureAlgorithm . ECDSA ) { found = true ; sigHashAlgo = i ; } break ; case RSA : if ( sig . toString ( ) . contains ( "RSA" ) ) { found = true ; sigHashAlgo = i ; } break ; case DSS : if ( sig == SignatureAlgorithm . DSA ) { found = true ; sigHashAlgo = i ; } break ; case GOST01 : if ( sig == SignatureAlgorithm . GOSTR34102001 ) { found = true ; sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102001_GOSTR3411 ; } break ; case GOST12 : if ( sig == SignatureAlgorithm . GOSTR34102012_256 || sig == SignatureAlgorithm . GOSTR34102012_512 ) { found = true ; if ( keyPair . getGostCurve ( ) . is512bit2012 ( ) ) { sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102012_512_GOSTR34112012_512 ; } else { sigHashAlgo = SignatureAndHashAlgorithm . GOSTR34102012_256_GOSTR34112012_256 ; } } break ; } if ( found ) { break ; } } if ( sigHashAlgo == null ) { LOGGER . warn ( "Could not auto select SignatureAndHashAlgorithm, setting default value" ) ; sigHashAlgo = SignatureAndHashAlgorithm . RSA_SHA256 ; } return sigHashAlgo ; }
33
private void entering ( final String taskName ) { }
private void entering ( final String taskName ) { LOGGER . info ( ">>> {}" , taskName ) ; }
34
private void stopUAV ( UAVHttpMessage data ) { final String pid = data . getRequest ( "pid" ) ; final String profile = data . getRequest ( "profile" ) ; if ( pid == null || profile == null ) { data . putResponse ( "rs" , "ERR" ) ; return ; } Thread t = new Thread ( new Runnable ( ) { private void stopOnWin ( ) { OSProcessHelper . killProcess ( pid ) ; } private void stopOnLinux ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "process_flag=" + profile + "\n" ) ; sb . append ( "count=`crontab -l 2>/dev/null | grep \"$process_flag\" | wc -l`" + "\n" ) . append ( "if [ $count -ne 0 ]; then" + "\n" ) . append ( "cronfile=/tmp/$process_flag\".tmp\"" + "\n" ) . append ( "crontab -l | grep -v \"$process_flag\" > $cronfile" + "\n" ) . append ( "crontab $cronfile" + "\n" ) . append ( "rm -rf $cronfile" + "\n" ) . append ( "fi" + "\n" ) ; sb . append ( "runing_watcher=$(ps -ef | grep \"uav_proc_watcher.sh\" | grep \"$process_flag\" | awk '{printf \"%s \",$2}')" + "\n" ) . append ( "for pid in $runing_watcher; do" + "\n" ) . append ( "kill -9 \"$pid\"" + "\n" ) . append ( "done" + "\n" ) ; sb . append ( "kill -9 " + pid ) ; try { RuntimeHelper . exeShell ( sb . toString ( ) , getConfigManager ( ) . getContext ( IConfigurationManager . METADATAPATH ) ) ; } catch ( Exception e ) { log . err ( this , "shop uav shell failed." , e ) ; } } @ Override public void run ( ) { ThreadHelper . suspend ( 1000L ) ; if ( JVMToolHelper . isWindows ( ) ) { stopOnWin ( ) ; } else { stopOnLinux ( ) ; } } } ) ; t . start ( ) ; data . putResponse ( "rs" , "OK" ) ; }
private void stopUAV ( UAVHttpMessage data ) { final String pid = data . getRequest ( "pid" ) ; final String profile = data . getRequest ( "profile" ) ; log . warn ( this , "STOP UAV node: pid=" + pid + ", profile=" + profile ) ; if ( pid == null || profile == null ) { data . putResponse ( "rs" , "ERR" ) ; return ; } Thread t = new Thread ( new Runnable ( ) { private void stopOnWin ( ) { OSProcessHelper . killProcess ( pid ) ; } private void stopOnLinux ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "process_flag=" + profile + "\n" ) ; sb . append ( "count=`crontab -l 2>/dev/null | grep \"$process_flag\" | wc -l`" + "\n" ) . append ( "if [ $count -ne 0 ]; then" + "\n" ) . append ( "cronfile=/tmp/$process_flag\".tmp\"" + "\n" ) . append ( "crontab -l | grep -v \"$process_flag\" > $cronfile" + "\n" ) . append ( "crontab $cronfile" + "\n" ) . append ( "rm -rf $cronfile" + "\n" ) . append ( "fi" + "\n" ) ; sb . append ( "runing_watcher=$(ps -ef | grep \"uav_proc_watcher.sh\" | grep \"$process_flag\" | awk '{printf \"%s \",$2}')" + "\n" ) . append ( "for pid in $runing_watcher; do" + "\n" ) . append ( "kill -9 \"$pid\"" + "\n" ) . append ( "done" + "\n" ) ; sb . append ( "kill -9 " + pid ) ; try { RuntimeHelper . exeShell ( sb . toString ( ) , getConfigManager ( ) . getContext ( IConfigurationManager . METADATAPATH ) ) ; } catch ( Exception e ) { log . err ( this , "shop uav shell failed." , e ) ; } } @ Override public void run ( ) { ThreadHelper . suspend ( 1000L ) ; if ( JVMToolHelper . isWindows ( ) ) { stopOnWin ( ) ; } else { stopOnLinux ( ) ; } } } ) ; t . start ( ) ; data . putResponse ( "rs" , "OK" ) ; }
35
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
36
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
37
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
38
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
39
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
40
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
41
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
42
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
43
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
44
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
private < T extends HttpRequestBase > JSONObject doRequest ( Class < T > requestType , String requestUrl , String adminUser , String adminPassword , JSONObject requestParams ) throws InstantiationException , IllegalAccessException { AlfrescoHttpClient client = alfrescoHttpClientFactory . getObject ( ) ; T request = requestType . newInstance ( ) ; JSONObject responseBody = null ; JSONObject returnValues = null ; try { request . setURI ( new URI ( requestUrl ) ) ; if ( requestParams != null && request instanceof HttpEntityEnclosingRequestBase ) { ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( new StringEntity ( requestParams . toString ( ) ) ) ; } LOGGER . info ( "Sending {} request to {}" , requestType . getSimpleName ( ) , requestUrl ) ; LOGGER . info ( "Request body: {}" , requestParams ) ; HttpResponse response = client . execute ( adminUser , adminPassword , request ) ; LOGGER . info ( "Response: {}" , response . getStatusLine ( ) ) ; try { responseBody = new JSONObject ( EntityUtils . toString ( response . getEntity ( ) ) ) ; } catch ( JSONException error ) { LOGGER . error ( "Converting message body to JSON failed. Body: {}" , responseBody , error ) ; } catch ( ParseException | IOException error ) { LOGGER . error ( "Parsing message body failed." , error ) ; } switch ( response . getStatusLine ( ) . getStatusCode ( ) ) { case HttpStatus . SC_OK : case HttpStatus . SC_CREATED : if ( responseBody != null ) { returnValues = responseBody ; } break ; case HttpStatus . SC_INTERNAL_SERVER_ERROR : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed with error message: {}" , responseBody . getString ( MESSAGE_KEY ) ) ; returnValues = responseBody ; } break ; case HttpStatus . SC_BAD_REQUEST : case HttpStatus . SC_UNPROCESSABLE_ENTITY : if ( responseBody != null && responseBody . has ( EXCEPTION_KEY ) ) { LOGGER . error ( "Request failed: {}" , responseBody . getString ( EXCEPTION_KEY ) ) ; returnValues = responseBody ; } break ; default : LOGGER . error ( "Request returned unexpected HTTP status {}" , response . getStatusLine ( ) . getStatusCode ( ) ) ; break ; } } catch ( JSONException error ) { LOGGER . error ( "Unable to extract response parameter" , error ) ; } catch ( UnsupportedEncodingException | URISyntaxException error1 ) { LOGGER . error ( "Unable to construct request" , error1 ) ; } finally { if ( request != null ) { request . releaseConnection ( ) ; } client . close ( ) ; } return returnValues ; }
45
protected void messagesFailure ( Throwable cause , List < ? extends Message > messages ) { for ( Message message : messages ) { if ( logger . isDebugEnabled ( ) ) { } Message . Mutable failed = newReply ( message ) ; failed . setSuccessful ( false ) ; Map < String , Object > failure = new HashMap < > ( ) ; failed . put ( "failure" , failure ) ; failure . put ( "message" , message ) ; if ( cause != null ) { failure . put ( "exception" , cause ) ; } if ( cause instanceof TransportException ) { Map < String , Object > fields = ( ( TransportException ) cause ) . getFields ( ) ; if ( fields != null ) { failure . putAll ( fields ) ; } } ClientTransport transport = getTransport ( ) ; if ( transport != null ) { failure . put ( Message . CONNECTION_TYPE_FIELD , transport . getName ( ) ) ; } String channel = message . getChannel ( ) ; if ( Channel . META_HANDSHAKE . equals ( channel ) ) { handshakeFailure ( failed , cause ) ; } else if ( Channel . META_CONNECT . equals ( channel ) ) { connectFailure ( failed , cause ) ; } else if ( Channel . META_DISCONNECT . equals ( channel ) ) { disconnectFailure ( failed , cause ) ; } else { messageFailure ( failed , cause ) ; } } }
protected void messagesFailure ( Throwable cause , List < ? extends Message > messages ) { for ( Message message : messages ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Failing {}" , message ) ; } Message . Mutable failed = newReply ( message ) ; failed . setSuccessful ( false ) ; Map < String , Object > failure = new HashMap < > ( ) ; failed . put ( "failure" , failure ) ; failure . put ( "message" , message ) ; if ( cause != null ) { failure . put ( "exception" , cause ) ; } if ( cause instanceof TransportException ) { Map < String , Object > fields = ( ( TransportException ) cause ) . getFields ( ) ; if ( fields != null ) { failure . putAll ( fields ) ; } } ClientTransport transport = getTransport ( ) ; if ( transport != null ) { failure . put ( Message . CONNECTION_TYPE_FIELD , transport . getName ( ) ) ; } String channel = message . getChannel ( ) ; if ( Channel . META_HANDSHAKE . equals ( channel ) ) { handshakeFailure ( failed , cause ) ; } else if ( Channel . META_CONNECT . equals ( channel ) ) { connectFailure ( failed , cause ) ; } else if ( Channel . META_DISCONNECT . equals ( channel ) ) { disconnectFailure ( failed , cause ) ; } else { messageFailure ( failed , cause ) ; } } }
46
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
47
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
48
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
49
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
50
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; } return retryDelayProp ; }
private int getRetryDelayFromConfig ( ) { int retryDelayProp = 0 ; try { String sValue = propertyAccessor . getProperty ( NhincConstants . GATEWAY_PROPERTY_FILE , CONFIG_KEY_RETRYDELAY ) ; LOG . debug ( "Retrieved from config file (" + CONFIG_FILE + ".properties) " + CONFIG_KEY_RETRYDELAY + "='" + sValue + "')" ) ; if ( NullChecker . isNotNullish ( sValue ) ) { retryDelayProp = Integer . parseInt ( sValue ) ; } } catch ( PropertyAccessException ex ) { LOG . warn ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred reading property {} value from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , ex . getLocalizedMessage ( ) , ex ) ; } catch ( NumberFormatException nfe ) { LOG . warn ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) ) ; LOG . trace ( "Error occurred converting property {} value to integer from config file ({}.properties): {}" , CONFIG_KEY_RETRYDELAY , CONFIG_FILE , nfe . getLocalizedMessage ( ) , nfe ) ; } return retryDelayProp ; }
51
protected synchronized void protocolsAdded ( final Set < String > protocols ) { try { testStart ( ) ; } catch ( final Exception e ) { logger . warn ( "Failed to start" , e ) ; } }
protected synchronized void protocolsAdded ( final Set < String > protocols ) { logger . info ( "Protocols added - {}" , protocols ) ; try { testStart ( ) ; } catch ( final Exception e ) { logger . warn ( "Failed to start" , e ) ; } }
52
protected synchronized void protocolsAdded ( final Set < String > protocols ) { logger . info ( "Protocols added - {}" , protocols ) ; try { testStart ( ) ; } catch ( final Exception e ) { } }
protected synchronized void protocolsAdded ( final Set < String > protocols ) { logger . info ( "Protocols added - {}" , protocols ) ; try { testStart ( ) ; } catch ( final Exception e ) { logger . warn ( "Failed to start" , e ) ; } }
53
public void push ( final Message msg ) { if ( this . thread . isInterrupted ( ) ) { throw new IllegalStateException ( String . format ( "Thread %s was interrupted, state=%s" , this . thread . getName ( ) , this . thread . getState ( ) ) ) ; } this . msgs . removeIf ( next -> Objects . equals ( next . getMessageId ( ) , msg . getMessageId ( ) ) ) ; try { new QueueStats . Ext ( this . pid ) . value ( ) . add ( msg ) ; this . msgs . put ( msg ) ; } catch ( final InterruptedException err ) { Thread . currentThread ( ) . interrupt ( ) ; Logger . warn ( this , "push for %s interrupted: %[exception]s" , this . pid , err ) ; } }
public void push ( final Message msg ) { if ( this . thread . isInterrupted ( ) ) { throw new IllegalStateException ( String . format ( "Thread %s was interrupted, state=%s" , this . thread . getName ( ) , this . thread . getState ( ) ) ) ; } this . msgs . removeIf ( next -> Objects . equals ( next . getMessageId ( ) , msg . getMessageId ( ) ) ) ; try { new QueueStats . Ext ( this . pid ) . value ( ) . add ( msg ) ; this . msgs . put ( msg ) ; Logger . info ( this , "Pushed message (queue_size=%d, pri=%s): %s" , this . msgs . size ( ) , MsgPriority . from ( msg ) , msg . getMessageId ( ) ) ; } catch ( final InterruptedException err ) { Thread . currentThread ( ) . interrupt ( ) ; Logger . warn ( this , "push for %s interrupted: %[exception]s" , this . pid , err ) ; } }
54
public void push ( final Message msg ) { if ( this . thread . isInterrupted ( ) ) { throw new IllegalStateException ( String . format ( "Thread %s was interrupted, state=%s" , this . thread . getName ( ) , this . thread . getState ( ) ) ) ; } this . msgs . removeIf ( next -> Objects . equals ( next . getMessageId ( ) , msg . getMessageId ( ) ) ) ; try { new QueueStats . Ext ( this . pid ) . value ( ) . add ( msg ) ; this . msgs . put ( msg ) ; Logger . info ( this , "Pushed message (queue_size=%d, pri=%s): %s" , this . msgs . size ( ) , MsgPriority . from ( msg ) , msg . getMessageId ( ) ) ; } catch ( final InterruptedException err ) { Thread . currentThread ( ) . interrupt ( ) ; } }
public void push ( final Message msg ) { if ( this . thread . isInterrupted ( ) ) { throw new IllegalStateException ( String . format ( "Thread %s was interrupted, state=%s" , this . thread . getName ( ) , this . thread . getState ( ) ) ) ; } this . msgs . removeIf ( next -> Objects . equals ( next . getMessageId ( ) , msg . getMessageId ( ) ) ) ; try { new QueueStats . Ext ( this . pid ) . value ( ) . add ( msg ) ; this . msgs . put ( msg ) ; Logger . info ( this , "Pushed message (queue_size=%d, pri=%s): %s" , this . msgs . size ( ) , MsgPriority . from ( msg ) , msg . getMessageId ( ) ) ; } catch ( final InterruptedException err ) { Thread . currentThread ( ) . interrupt ( ) ; Logger . warn ( this , "push for %s interrupted: %[exception]s" , this . pid , err ) ; } }
55
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
56
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
57
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
58
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
59
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; } }
private void initJobParameters ( Properties props ) { String jobBatchSizeProperty = props . getProperty ( TASKANA_JOB_HISTORY_BATCH_SIZE ) ; if ( jobBatchSizeProperty != null && ! jobBatchSizeProperty . isEmpty ( ) ) { try { batchSize = Integer . parseInt ( jobBatchSizeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} " , jobBatchSizeProperty , e . getMessage ( ) ) ; } } String historyEventCleanupJobMinimumAgeProperty = props . getProperty ( TASKANA_JOB_HISTORY_CLEANUP_MINIMUM_AGE ) ; if ( historyEventCleanupJobMinimumAgeProperty != null && ! historyEventCleanupJobMinimumAgeProperty . isEmpty ( ) ) { try { minimumAge = Duration . parse ( historyEventCleanupJobMinimumAgeProperty ) ; } catch ( Exception e ) { LOGGER . warn ( "Could not parse historyEventCleanupJobMinimumAgeProperty ({}). Using default." + " Exception: {} " , historyEventCleanupJobMinimumAgeProperty , e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Configured number of history events per transaction: {}" , batchSize ) ; LOGGER . debug ( "HistoryCleanupJob configuration: runs every {}" , runEvery ) ; LOGGER . debug ( "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}" , minimumAge ) ; } }
60
public void stop ( ) { ESClient client = ( ESClient ) this . getConfigManager ( ) . getComponent ( this . feature , "ESClient" ) ; if ( client != null ) { client . close ( ) ; } if ( jtaQueryServerWorker != null ) { jtaQueryServerWorker . stop ( ) ; if ( log . isTraceEnable ( ) ) { } } super . stop ( ) ; }
public void stop ( ) { ESClient client = ( ESClient ) this . getConfigManager ( ) . getComponent ( this . feature , "ESClient" ) ; if ( client != null ) { client . close ( ) ; } if ( jtaQueryServerWorker != null ) { jtaQueryServerWorker . stop ( ) ; if ( log . isTraceEnable ( ) ) { log . info ( this , "ThreadAnalysisQueryServerWorker stop" ) ; } } super . stop ( ) ; }
61
private StringBuilder fetchEntities ( final QanaryQuestion < String > qanaryQuestion , final QanaryUtils qanaryUtils ) throws SparqlQueryFailed { final String sparql = "" + "PREFIX qa: <http://www.wdaqua.eu/qa#> " + "PREFIX oa: <http://www.w3.org/ns/openannotation/core/> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "SELECT ?start ?end ?uri " + "FROM <" + qanaryQuestion . getInGraph ( ) + "> " + "WHERE { " + " ?a a qa:AnnotationOfInstance . " + " ?a oa:hasTarget [ " + " a oa:SpecificResource; " + " oa:hasSource ?q; " + " oa:hasSelector [ " + " a oa:TextPositionSelector ; " + " oa:start ?start ; " + " oa:end ?end " + " ] " + " ] . " + " ?a oa:hasBody ?uri ; " + "} " ; final ResultSet entitiesResultSet = qanaryUtils . selectFromTripleStore ( sparql ) ; final StringBuilder argument = new StringBuilder ( ) ; while ( entitiesResultSet . hasNext ( ) ) { QuerySolution s = entitiesResultSet . next ( ) ; final Entity entity = new Entity ( s . getResource ( "uri" ) . getURI ( ) , s . getLiteral ( "start" ) . getInt ( ) , s . getLiteral ( "end" ) . getInt ( ) ) ; argument . append ( entity . uri + ", " ) ; logger . info ( "uri:{} start:{} end:{}" , entity . uri , entity . begin , entity . end ) ; } return argument ; }
private StringBuilder fetchEntities ( final QanaryQuestion < String > qanaryQuestion , final QanaryUtils qanaryUtils ) throws SparqlQueryFailed { final String sparql = "" + "PREFIX qa: <http://www.wdaqua.eu/qa#> " + "PREFIX oa: <http://www.w3.org/ns/openannotation/core/> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "SELECT ?start ?end ?uri " + "FROM <" + qanaryQuestion . getInGraph ( ) + "> " + "WHERE { " + " ?a a qa:AnnotationOfInstance . " + " ?a oa:hasTarget [ " + " a oa:SpecificResource; " + " oa:hasSource ?q; " + " oa:hasSelector [ " + " a oa:TextPositionSelector ; " + " oa:start ?start ; " + " oa:end ?end " + " ] " + " ] . " + " ?a oa:hasBody ?uri ; " + "} " ; logger . info ( "fetchEntities for given question with query {}" , sparql ) ; final ResultSet entitiesResultSet = qanaryUtils . selectFromTripleStore ( sparql ) ; final StringBuilder argument = new StringBuilder ( ) ; while ( entitiesResultSet . hasNext ( ) ) { QuerySolution s = entitiesResultSet . next ( ) ; final Entity entity = new Entity ( s . getResource ( "uri" ) . getURI ( ) , s . getLiteral ( "start" ) . getInt ( ) , s . getLiteral ( "end" ) . getInt ( ) ) ; argument . append ( entity . uri + ", " ) ; logger . info ( "uri:{} start:{} end:{}" , entity . uri , entity . begin , entity . end ) ; } return argument ; }
62
private StringBuilder fetchEntities ( final QanaryQuestion < String > qanaryQuestion , final QanaryUtils qanaryUtils ) throws SparqlQueryFailed { final String sparql = "" + "PREFIX qa: <http://www.wdaqua.eu/qa#> " + "PREFIX oa: <http://www.w3.org/ns/openannotation/core/> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "SELECT ?start ?end ?uri " + "FROM <" + qanaryQuestion . getInGraph ( ) + "> " + "WHERE { " + " ?a a qa:AnnotationOfInstance . " + " ?a oa:hasTarget [ " + " a oa:SpecificResource; " + " oa:hasSource ?q; " + " oa:hasSelector [ " + " a oa:TextPositionSelector ; " + " oa:start ?start ; " + " oa:end ?end " + " ] " + " ] . " + " ?a oa:hasBody ?uri ; " + "} " ; logger . info ( "fetchEntities for given question with query {}" , sparql ) ; final ResultSet entitiesResultSet = qanaryUtils . selectFromTripleStore ( sparql ) ; final StringBuilder argument = new StringBuilder ( ) ; while ( entitiesResultSet . hasNext ( ) ) { QuerySolution s = entitiesResultSet . next ( ) ; final Entity entity = new Entity ( s . getResource ( "uri" ) . getURI ( ) , s . getLiteral ( "start" ) . getInt ( ) , s . getLiteral ( "end" ) . getInt ( ) ) ; argument . append ( entity . uri + ", " ) ; } return argument ; }
private StringBuilder fetchEntities ( final QanaryQuestion < String > qanaryQuestion , final QanaryUtils qanaryUtils ) throws SparqlQueryFailed { final String sparql = "" + "PREFIX qa: <http://www.wdaqua.eu/qa#> " + "PREFIX oa: <http://www.w3.org/ns/openannotation/core/> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "SELECT ?start ?end ?uri " + "FROM <" + qanaryQuestion . getInGraph ( ) + "> " + "WHERE { " + " ?a a qa:AnnotationOfInstance . " + " ?a oa:hasTarget [ " + " a oa:SpecificResource; " + " oa:hasSource ?q; " + " oa:hasSelector [ " + " a oa:TextPositionSelector ; " + " oa:start ?start ; " + " oa:end ?end " + " ] " + " ] . " + " ?a oa:hasBody ?uri ; " + "} " ; logger . info ( "fetchEntities for given question with query {}" , sparql ) ; final ResultSet entitiesResultSet = qanaryUtils . selectFromTripleStore ( sparql ) ; final StringBuilder argument = new StringBuilder ( ) ; while ( entitiesResultSet . hasNext ( ) ) { QuerySolution s = entitiesResultSet . next ( ) ; final Entity entity = new Entity ( s . getResource ( "uri" ) . getURI ( ) , s . getLiteral ( "start" ) . getInt ( ) , s . getLiteral ( "end" ) . getInt ( ) ) ; argument . append ( entity . uri + ", " ) ; logger . info ( "uri:{} start:{} end:{}" , entity . uri , entity . begin , entity . end ) ; } return argument ; }
63
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
64
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
65
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
66
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
protected synchronized Status doProcess ( ) throws EventDeliveryException { boolean error = true ; try { if ( consumer == null ) { consumer = createConsumer ( ) ; } List < Event > events = consumer . take ( ) ; int size = events . size ( ) ; if ( size == 0 ) { error = false ; return Status . BACKOFF ; } sourceCounter . incrementAppendBatchReceivedCount ( ) ; sourceCounter . addToEventReceivedCount ( size ) ; getChannelProcessor ( ) . processEventBatch ( events ) ; error = false ; sourceCounter . addToEventAcceptedCount ( size ) ; sourceCounter . incrementAppendBatchAcceptedCount ( ) ; return Status . READY ; } catch ( ChannelException channelException ) { logger . warn ( "Error appending event to channel. " + "Channel might be full. Consider increasing the channel " + "capacity or make sure the sinks perform faster." , channelException ) ; sourceCounter . incrementChannelWriteFail ( ) ; } catch ( JMSException jmsException ) { logger . warn ( "JMSException consuming events" , jmsException ) ; if ( ++ jmsExceptionCounter > errorThreshold ) { if ( consumer != null ) { logger . warn ( "Exceeded JMSException threshold, closing consumer" ) ; sourceCounter . incrementEventReadFail ( ) ; consumer . rollback ( ) ; consumer . close ( ) ; consumer = null ; } } } catch ( Throwable throwable ) { logger . error ( "Unexpected error processing events" , throwable ) ; sourceCounter . incrementEventReadFail ( ) ; if ( throwable instanceof Error ) { throw ( Error ) throwable ; } } finally { if ( error ) { if ( consumer != null ) { consumer . rollback ( ) ; } } else { if ( consumer != null ) { consumer . commit ( ) ; jmsExceptionCounter = 0 ; } } } return Status . BACKOFF ; }
67
public Integer getProducerMaxRate ( ) { if ( logger . isTraceEnabled ( ) ) { } return raProperties . getProducerMaxRate ( ) ; }
public Integer getProducerMaxRate ( ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "getProducerMaxRate()" ) ; } return raProperties . getProducerMaxRate ( ) ; }
68
public boolean createDirectory ( String keyName ) throws IOException { incrementCounter ( Statistic . OBJECTS_CREATED , 1 ) ; try { bucket . createDirectory ( keyName ) ; } catch ( OMException e ) { if ( e . getResult ( ) == OMException . ResultCodes . FILE_ALREADY_EXISTS ) { throw new FileAlreadyExistsException ( e . getMessage ( ) ) ; } throw e ; } return true ; }
public boolean createDirectory ( String keyName ) throws IOException { LOG . trace ( "creating dir for key:{}" , keyName ) ; incrementCounter ( Statistic . OBJECTS_CREATED , 1 ) ; try { bucket . createDirectory ( keyName ) ; } catch ( OMException e ) { if ( e . getResult ( ) == OMException . ResultCodes . FILE_ALREADY_EXISTS ) { throw new FileAlreadyExistsException ( e . getMessage ( ) ) ; } throw e ; } return true ; }
69
private Object convertAvroBeanToRethinkDBDoc ( final Schema fieldSchema , final MapObject < String , Object > doc ) throws GoraException { Object result ; Class < ? > clazz = null ; try { clazz = ClassLoadingUtils . loadClass ( fieldSchema . getFullName ( ) ) ; } catch ( Exception e ) { throw new GoraException ( e ) ; } PersistentBase record = ( PersistentBase ) new BeanFactoryImpl ( keyClass , clazz ) . newPersistent ( ) ; for ( Schema . Field recField : fieldSchema . getFields ( ) ) { Schema innerSchema = recField . schema ( ) ; RethinkDBMapping . DocumentFieldType innerStoreType = rethinkDBMapping . getDocumentFieldType ( recField . name ( ) ) ; String innerDocField = rethinkDBMapping . getDocumentField ( recField . name ( ) ) != null ? rethinkDBMapping . getDocumentField ( recField . name ( ) ) : recField . name ( ) ; record . put ( recField . pos ( ) , convertDocFieldToAvroField ( innerSchema , innerStoreType , recField , innerDocField , doc ) ) ; } result = record ; return result ; }
private Object convertAvroBeanToRethinkDBDoc ( final Schema fieldSchema , final MapObject < String , Object > doc ) throws GoraException { Object result ; Class < ? > clazz = null ; try { clazz = ClassLoadingUtils . loadClass ( fieldSchema . getFullName ( ) ) ; } catch ( Exception e ) { throw new GoraException ( e ) ; } PersistentBase record = ( PersistentBase ) new BeanFactoryImpl ( keyClass , clazz ) . newPersistent ( ) ; for ( Schema . Field recField : fieldSchema . getFields ( ) ) { Schema innerSchema = recField . schema ( ) ; RethinkDBMapping . DocumentFieldType innerStoreType = rethinkDBMapping . getDocumentFieldType ( recField . name ( ) ) ; String innerDocField = rethinkDBMapping . getDocumentField ( recField . name ( ) ) != null ? rethinkDBMapping . getDocumentField ( recField . name ( ) ) : recField . name ( ) ; LOG . debug ( "Load from ODocument (RECORD), field:{}, schemaType:{}, docField:{}, storeType:{}" , new Object [ ] { recField . name ( ) , innerSchema . getType ( ) , innerDocField , innerStoreType } ) ; record . put ( recField . pos ( ) , convertDocFieldToAvroField ( innerSchema , innerStoreType , recField , innerDocField , doc ) ) ; } result = record ; return result ; }
70
public Local find ( ) { final Local folder = LocalFactory . get ( LocalFactory . get ( preferences . getProperty ( "local.user.home" ) ) , ".duck" ) ; if ( log . isDebugEnabled ( ) ) { } return folder ; }
public Local find ( ) { final Local folder = LocalFactory . get ( LocalFactory . get ( preferences . getProperty ( "local.user.home" ) ) , ".duck" ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Use folder %s for application support directory" , folder ) ) ; } return folder ; }
71
public static Collection < Ignite > reconnectServersRestart ( final IgniteLogger log , Ignite client , Collection < Ignite > srvs , Callable < Collection < Ignite > > srvStartC ) throws Exception { final CountDownLatch disconnectLatch = new CountDownLatch ( 1 ) ; final CountDownLatch reconnectLatch = new CountDownLatch ( 1 ) ; client . events ( ) . localListen ( new IgnitePredicate < Event > ( ) { @ Override public boolean apply ( Event evt ) { if ( evt . type ( ) == EVT_CLIENT_NODE_DISCONNECTED ) { disconnectLatch . countDown ( ) ; } else if ( evt . type ( ) == EVT_CLIENT_NODE_RECONNECTED ) { log . info ( "Reconnected: " + evt ) ; reconnectLatch . countDown ( ) ; } return true ; } } , EVT_CLIENT_NODE_DISCONNECTED , EVT_CLIENT_NODE_RECONNECTED ) ; for ( Ignite srv : srvs ) srv . close ( ) ; assertTrue ( disconnectLatch . await ( 30_000 , MILLISECONDS ) ) ; Collection < Ignite > startedSrvs = srvStartC . call ( ) ; assertTrue ( reconnectLatch . await ( 10_000 , MILLISECONDS ) ) ; return startedSrvs ; }
public static Collection < Ignite > reconnectServersRestart ( final IgniteLogger log , Ignite client , Collection < Ignite > srvs , Callable < Collection < Ignite > > srvStartC ) throws Exception { final CountDownLatch disconnectLatch = new CountDownLatch ( 1 ) ; final CountDownLatch reconnectLatch = new CountDownLatch ( 1 ) ; client . events ( ) . localListen ( new IgnitePredicate < Event > ( ) { @ Override public boolean apply ( Event evt ) { if ( evt . type ( ) == EVT_CLIENT_NODE_DISCONNECTED ) { log . info ( "Disconnected: " + evt ) ; disconnectLatch . countDown ( ) ; } else if ( evt . type ( ) == EVT_CLIENT_NODE_RECONNECTED ) { log . info ( "Reconnected: " + evt ) ; reconnectLatch . countDown ( ) ; } return true ; } } , EVT_CLIENT_NODE_DISCONNECTED , EVT_CLIENT_NODE_RECONNECTED ) ; for ( Ignite srv : srvs ) srv . close ( ) ; assertTrue ( disconnectLatch . await ( 30_000 , MILLISECONDS ) ) ; Collection < Ignite > startedSrvs = srvStartC . call ( ) ; assertTrue ( reconnectLatch . await ( 10_000 , MILLISECONDS ) ) ; return startedSrvs ; }
72
public static Collection < Ignite > reconnectServersRestart ( final IgniteLogger log , Ignite client , Collection < Ignite > srvs , Callable < Collection < Ignite > > srvStartC ) throws Exception { final CountDownLatch disconnectLatch = new CountDownLatch ( 1 ) ; final CountDownLatch reconnectLatch = new CountDownLatch ( 1 ) ; client . events ( ) . localListen ( new IgnitePredicate < Event > ( ) { @ Override public boolean apply ( Event evt ) { if ( evt . type ( ) == EVT_CLIENT_NODE_DISCONNECTED ) { log . info ( "Disconnected: " + evt ) ; disconnectLatch . countDown ( ) ; } else if ( evt . type ( ) == EVT_CLIENT_NODE_RECONNECTED ) { reconnectLatch . countDown ( ) ; } return true ; } } , EVT_CLIENT_NODE_DISCONNECTED , EVT_CLIENT_NODE_RECONNECTED ) ; for ( Ignite srv : srvs ) srv . close ( ) ; assertTrue ( disconnectLatch . await ( 30_000 , MILLISECONDS ) ) ; Collection < Ignite > startedSrvs = srvStartC . call ( ) ; assertTrue ( reconnectLatch . await ( 10_000 , MILLISECONDS ) ) ; return startedSrvs ; }
public static Collection < Ignite > reconnectServersRestart ( final IgniteLogger log , Ignite client , Collection < Ignite > srvs , Callable < Collection < Ignite > > srvStartC ) throws Exception { final CountDownLatch disconnectLatch = new CountDownLatch ( 1 ) ; final CountDownLatch reconnectLatch = new CountDownLatch ( 1 ) ; client . events ( ) . localListen ( new IgnitePredicate < Event > ( ) { @ Override public boolean apply ( Event evt ) { if ( evt . type ( ) == EVT_CLIENT_NODE_DISCONNECTED ) { log . info ( "Disconnected: " + evt ) ; disconnectLatch . countDown ( ) ; } else if ( evt . type ( ) == EVT_CLIENT_NODE_RECONNECTED ) { log . info ( "Reconnected: " + evt ) ; reconnectLatch . countDown ( ) ; } return true ; } } , EVT_CLIENT_NODE_DISCONNECTED , EVT_CLIENT_NODE_RECONNECTED ) ; for ( Ignite srv : srvs ) srv . close ( ) ; assertTrue ( disconnectLatch . await ( 30_000 , MILLISECONDS ) ) ; Collection < Ignite > startedSrvs = srvStartC . call ( ) ; assertTrue ( reconnectLatch . await ( 10_000 , MILLISECONDS ) ) ; return startedSrvs ; }
73
private static void activate ( ClassLoader classLoader , Set < String > extensions ) { final ClassLoader originalClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; if ( logger . isDebugEnabled ( ) ) for ( String extensionName : extensions ) { activate ( classLoader , extensionName ) ; } } finally { Thread . currentThread ( ) . setContextClassLoader ( originalClassLoader ) ; } }
private static void activate ( ClassLoader classLoader , Set < String > extensions ) { final ClassLoader originalClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Activating " + extensions . size ( ) + " extensions..." ) ; for ( String extensionName : extensions ) { activate ( classLoader , extensionName ) ; } } finally { Thread . currentThread ( ) . setContextClassLoader ( originalClassLoader ) ; } }
74
protected @ Nullable ModuleHandler internalCreate ( Module module , String ruleUID ) { String moduleTypeUID = module . getTypeUID ( ) ; if ( HueRuleConditionHandler . MODULE_TYPE_ID . equals ( moduleTypeUID ) && module instanceof Condition ) { return new HueRuleConditionHandler ( ( Condition ) module , configStore . ds ) ; } else { logger . error ( "The module handler type '{}' is not supported." , moduleTypeUID ) ; } return null ; }
protected @ Nullable ModuleHandler internalCreate ( Module module , String ruleUID ) { logger . trace ( "create {} -> {}" , module . getId ( ) , module . getTypeUID ( ) ) ; String moduleTypeUID = module . getTypeUID ( ) ; if ( HueRuleConditionHandler . MODULE_TYPE_ID . equals ( moduleTypeUID ) && module instanceof Condition ) { return new HueRuleConditionHandler ( ( Condition ) module , configStore . ds ) ; } else { logger . error ( "The module handler type '{}' is not supported." , moduleTypeUID ) ; } return null ; }
75
protected @ Nullable ModuleHandler internalCreate ( Module module , String ruleUID ) { logger . trace ( "create {} -> {}" , module . getId ( ) , module . getTypeUID ( ) ) ; String moduleTypeUID = module . getTypeUID ( ) ; if ( HueRuleConditionHandler . MODULE_TYPE_ID . equals ( moduleTypeUID ) && module instanceof Condition ) { return new HueRuleConditionHandler ( ( Condition ) module , configStore . ds ) ; } else { } return null ; }
protected @ Nullable ModuleHandler internalCreate ( Module module , String ruleUID ) { logger . trace ( "create {} -> {}" , module . getId ( ) , module . getTypeUID ( ) ) ; String moduleTypeUID = module . getTypeUID ( ) ; if ( HueRuleConditionHandler . MODULE_TYPE_ID . equals ( moduleTypeUID ) && module instanceof Condition ) { return new HueRuleConditionHandler ( ( Condition ) module , configStore . ds ) ; } else { logger . error ( "The module handler type '{}' is not supported." , moduleTypeUID ) ; } return null ; }
76
@ Test public void TestDeleteGenericVnfFailure_5000 ( ) { String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL ; new MockAAIGenericVnfSearch ( wireMockServer ) ; new MockAAIDeleteGenericVnf ( wireMockServer ) ; new MockAAIDeleteVfModule ( wireMockServer ) ; Map < String , Object > variables = new HashMap < > ( ) ; variables . put ( "isDebugLogEnabled" , "true" ) ; variables . put ( "mso-request-id" , UUID . randomUUID ( ) . toString ( ) ) ; variables . put ( "DeleteAAIVfModuleRequest" , request ) ; String processId = invokeSubProcess ( "DeleteAAIVfModule" , variables ) ; WorkflowException exception = BPMNUtil . getRawVariable ( processEngine , "DeleteAAIVfModule" , "WorkflowException" , processId ) ; Assert . assertEquals ( 5000 , exception . getErrorCode ( ) ) ; Assert . assertEquals ( true , exception . getErrorMessage ( ) . contains ( "<messageId>SVC3002</messageId>" ) ) ; }
@ Test public void TestDeleteGenericVnfFailure_5000 ( ) { String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL ; new MockAAIGenericVnfSearch ( wireMockServer ) ; new MockAAIDeleteGenericVnf ( wireMockServer ) ; new MockAAIDeleteVfModule ( wireMockServer ) ; Map < String , Object > variables = new HashMap < > ( ) ; variables . put ( "isDebugLogEnabled" , "true" ) ; variables . put ( "mso-request-id" , UUID . randomUUID ( ) . toString ( ) ) ; variables . put ( "DeleteAAIVfModuleRequest" , request ) ; String processId = invokeSubProcess ( "DeleteAAIVfModule" , variables ) ; WorkflowException exception = BPMNUtil . getRawVariable ( processEngine , "DeleteAAIVfModule" , "WorkflowException" , processId ) ; Assert . assertEquals ( 5000 , exception . getErrorCode ( ) ) ; Assert . assertEquals ( true , exception . getErrorMessage ( ) . contains ( "<messageId>SVC3002</messageId>" ) ) ; logger . debug ( exception . getErrorMessage ( ) ) ; }
77
private void obtainTokenFileReference ( ) { if ( tokenFile == null ) { tokenFile = dataDir . resolve ( TOKEN_FILE ) ; } }
private void obtainTokenFileReference ( ) { if ( tokenFile == null ) { tokenFile = dataDir . resolve ( TOKEN_FILE ) ; LOG . info ( "Token file: {}" , tokenFile . toAbsolutePath ( ) . toAbsolutePath ( ) ) ; } }
78
public String upload ( ) { if ( valid ) { logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
79
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
80
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
81
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
82
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
83
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
84
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
85
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
86
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
87
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }
public String upload ( ) { if ( valid ) { logger . info ( "ResourceFileChunksUploadAction Save {}" , fileName ) ; logger . debug ( "start {}" , start ) ; logger . debug ( "end {}" , end ) ; logger . debug ( "fileUpload {}" , fileUpload ) ; logger . debug ( "contentType {}" , fileUploadContentType ) ; logger . debug ( "filename {}" , fileName ) ; logger . debug ( "uploadId {}" , uploadId ) ; logger . debug ( "fileSize {}" , fileSize ) ; logger . debug ( "resourceTypeCode {}" , resourceTypeCode ) ; try { processChunk ( fileUpload , uploadId + ".tmp" , start , end ) ; } catch ( IOException ex ) { resultMessage = RESULT_FAILED ; inputStream = new ByteArrayInputStream ( RESULT_FAILED . getBytes ( ) ) ; logger . error ( "Error processing the file chunk {}" , ex ) ; } resultMessage = RESULT_SUCCESS ; } else { resultMessage = RESULT_VALIDATION_ERROR ; } inputStream = new ByteArrayInputStream ( resultMessage . getBytes ( ) ) ; logger . debug ( "result {}" , resultMessage ) ; return SUCCESS ; }

No dataset card yet

New: Create and edit this dataset card directly on the website!

Contribute a Dataset Card
Downloads last month
0
Add dataset card