Unnamed: 0
int64
0
10k
source
stringlengths
27
7.27k
target
stringlengths
54
7.29k
800
public boolean invoke ( DeviceMethod method ) { if ( mWriter != null ) { try { mWriter . write ( method . getParamsStr ( ) . getBytes ( ) ) ; mWriter . flush ( ) ; logger . debug ( "{}: Write Success!" , TAG ) ; } catch ( Exception e ) { logger . debug ( "Exception" , e ) ; mDevice . setConnectionState ( ConnectState . DISCONNECTED ) ; return false ; } return true ; } return false ; }
public boolean invoke ( DeviceMethod method ) { if ( mWriter != null ) { try { mWriter . write ( method . getParamsStr ( ) . getBytes ( ) ) ; mWriter . flush ( ) ; logger . debug ( "{}: Write Success!" , TAG ) ; } catch ( Exception e ) { logger . debug ( "{}: write exception, set device to disconnected!" , TAG ) ; logger . debug ( "Exception" , e ) ; mDevice . setConnectionState ( ConnectState . DISCONNECTED ) ; return false ; } return true ; } return false ; }
801
public boolean invoke ( DeviceMethod method ) { if ( mWriter != null ) { try { mWriter . write ( method . getParamsStr ( ) . getBytes ( ) ) ; mWriter . flush ( ) ; logger . debug ( "{}: Write Success!" , TAG ) ; } catch ( Exception e ) { logger . debug ( "{}: write exception, set device to disconnected!" , TAG ) ; mDevice . setConnectionState ( ConnectState . DISCONNECTED ) ; return false ; } return true ; } return false ; }
public boolean invoke ( DeviceMethod method ) { if ( mWriter != null ) { try { mWriter . write ( method . getParamsStr ( ) . getBytes ( ) ) ; mWriter . flush ( ) ; logger . debug ( "{}: Write Success!" , TAG ) ; } catch ( Exception e ) { logger . debug ( "{}: write exception, set device to disconnected!" , TAG ) ; logger . debug ( "Exception" , e ) ; mDevice . setConnectionState ( ConnectState . DISCONNECTED ) ; return false ; } return true ; } return false ; }
802
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to near nodes [nodes=" + U . nodeIds ( nearNodes ) + ", entry=" + entry + ']' ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Entry has no near readers: " + entry ) ; if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to DHT nodes [nodes=" + U . nodeIds ( dhtNodes ) + ", entry=" + entry + ']' ) ; Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to near nodes [nodes=" + U . nodeIds ( nearNodes ) + ", entry=" + entry + ']' ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Entry has no near readers: " + entry ) ; if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
803
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to DHT nodes [nodes=" + U . nodeIds ( dhtNodes ) + ", entry=" + entry + ']' ) ; Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) } else if ( log . isDebugEnabled ( ) ) log . debug ( "Entry has no near readers: " + entry ) ; if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to DHT nodes [nodes=" + U . nodeIds ( dhtNodes ) + ", entry=" + entry + ']' ) ; Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to near nodes [nodes=" + U . nodeIds ( nearNodes ) + ", entry=" + entry + ']' ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Entry has no near readers: " + entry ) ; if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
804
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to DHT nodes [nodes=" + U . nodeIds ( dhtNodes ) + ", entry=" + entry + ']' ) ; Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to near nodes [nodes=" + U . nodeIds ( nearNodes ) + ", entry=" + entry + ']' ) ; } else if ( log . isDebugEnabled ( ) ) if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
public void dhtMap ( UUID nearNodeId , AffinityTopologyVersion topVer , GridDhtCacheEntry entry , GridCacheVersion explicitLockVer , IgniteLogger log , Map < ClusterNode , List < GridDhtCacheEntry > > dhtMap , @ Nullable Map < ClusterNode , List < GridDhtCacheEntry > > nearMap ) throws GridCacheEntryRemovedException { assert ! AffinityTopologyVersion . NONE . equals ( topVer ) ; Collection < ClusterNode > dhtNodes = dht ( ) . topology ( ) . nodes ( entry . partition ( ) , topVer ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to DHT nodes [nodes=" + U . nodeIds ( dhtNodes ) + ", entry=" + entry + ']' ) ; Collection < ClusterNode > dhtRemoteNodes = F . view ( dhtNodes , F . remoteNodes ( nodeId ( ) ) ) ; map ( entry , dhtRemoteNodes , dhtMap ) ; Collection < ClusterNode > nearRemoteNodes = null ; if ( nearMap != null ) { Collection < UUID > readers = entry . readers ( ) ; Collection < ClusterNode > nearNodes = null ; if ( ! F . isEmpty ( readers ) ) { nearNodes = discovery ( ) . nodes ( readers , F0 . notEqualTo ( nearNodeId ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Mapping entry to near nodes [nodes=" + U . nodeIds ( nearNodes ) + ", entry=" + entry + ']' ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Entry has no near readers: " + entry ) ; if ( nearNodes != null && ! nearNodes . isEmpty ( ) ) { nearRemoteNodes = F . view ( nearNodes , F . notIn ( dhtNodes ) ) ; map ( entry , nearRemoteNodes , nearMap ) ; } } if ( explicitLockVer != null ) { Collection < ClusterNode > dhtNodeIds = new ArrayList < > ( dhtRemoteNodes ) ; Collection < ClusterNode > nearNodeIds = F . isEmpty ( nearRemoteNodes ) ? null : new ArrayList < > ( nearRemoteNodes ) ; entry . mappings ( explicitLockVer , dhtNodeIds , nearNodeIds ) ; } }
805
public void run ( ) { try { Socket processClientConnection = loggerSocket . accept ( ) ; clientSocketAcceptedLatch . release ( ) ; BufferedReader processClientLogEntriesInputStream = new BufferedReader ( new InputStreamReader ( processClientConnection . getInputStream ( ) ) ) ; while ( ! Thread . interrupted ( ) ) { String logLine = processClientLogEntriesInputStream . readLine ( ) ; if ( logLine == null ) { try { Thread . sleep ( 200 ) ; } catch ( InterruptedException e ) { return ; } } else { } } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { closeQuietly ( loggerSocket ) ; } }
public void run ( ) { try { Socket processClientConnection = loggerSocket . accept ( ) ; clientSocketAcceptedLatch . release ( ) ; BufferedReader processClientLogEntriesInputStream = new BufferedReader ( new InputStreamReader ( processClientConnection . getInputStream ( ) ) ) ; while ( ! Thread . interrupted ( ) ) { String logLine = processClientLogEntriesInputStream . readLine ( ) ; if ( logLine == null ) { try { Thread . sleep ( 200 ) ; } catch ( InterruptedException e ) { return ; } } else { logger . info ( logLine ) ; } } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { closeQuietly ( loggerSocket ) ; } }
806
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
807
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
808
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
809
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
private boolean setPassword ( String cmd , InputStream in ) throws Exception { boolean setPasswordSucceed = false ; int jschExceptionCount = 0 ; for ( int i = 0 ; i < Constants . SET_PASSWORD_MAX_RETRY_TIMES ; i ++ ) { try { SSHUtil sshUtil = new SSHUtil ( ) ; setPasswordSucceed = sshUtil . execCmd ( sshUser , privateKeyFile , nodeIP , sshPort , cmd , in , null ) ; } catch ( JSchException e ) { if ( ++ jschExceptionCount == Constants . SET_PASSWORD_MAX_RETRY_TIMES ) { throw SetPasswordException . GOT_JSCH_EXCEPTION_WHEN_SET_PASSWORD ( e , nodeIP ) ; } } if ( setPasswordSucceed ) { handleTty ( ) ; break ; } else { logger . info ( "Set password for " + nodeIP + " failed for " + ( i + 1 ) + " times. Retrying after 2 seconds...." ) ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { logger . info ( "Sleep interrupted, retrying immediately" ) ; } } } if ( setPasswordSucceed ) { logger . info ( "Set password for " + nodeIP + " succeed" ) ; return true ; } else { logger . error ( "set password for " + nodeIP + " failed" ) ; throw SetPasswordException . FAIL_TO_SET_PASSWORD ( nodeIP , null ) ; } }
810
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
811
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
812
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
813
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
814
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; } return "data" ; }
public String getMimeType ( InputStream theFileInputStream ) throws BusinessException { try { Metadata metadata = new Metadata ( ) ; AutoDetectParser parser = new AutoDetectParser ( ) ; MediaType detect = parser . getDetector ( ) . detect ( theFileInputStream , metadata ) ; logger . debug ( "Mime type : {}" , detect . toString ( ) ) ; return detect . toString ( ) ; } catch ( java . lang . NoSuchMethodError e ) { logger . debug ( "some exceptions could be raised in this case : {}" , e . getMessage ( ) ) ; if ( e . getCause ( ) != null ) logger . debug ( e . getCause ( ) . toString ( ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) ) ; logger . debug ( e . getMessage ( ) , e ) ; } return "data" ; }
815
public Layer clone ( ) { Layer layer = null ; try { Constructor c = getClass ( ) . getConstructor ( NeuralNetConfiguration . class ) ; layer = ( Layer ) c . newInstance ( conf ) ; Map < String , INDArray > linkedTable = new LinkedHashMap < > ( ) ; for ( Map . Entry < String , INDArray > entry : params . entrySet ( ) ) { linkedTable . put ( entry . getKey ( ) , entry . getValue ( ) . dup ( ) ) ; } layer . setParamTable ( linkedTable ) ; } catch ( Exception e ) { } return layer ; }
public Layer clone ( ) { Layer layer = null ; try { Constructor c = getClass ( ) . getConstructor ( NeuralNetConfiguration . class ) ; layer = ( Layer ) c . newInstance ( conf ) ; Map < String , INDArray > linkedTable = new LinkedHashMap < > ( ) ; for ( Map . Entry < String , INDArray > entry : params . entrySet ( ) ) { linkedTable . put ( entry . getKey ( ) , entry . getValue ( ) . dup ( ) ) ; } layer . setParamTable ( linkedTable ) ; } catch ( Exception e ) { log . error ( "" , e ) ; } return layer ; }
816
public boolean cancel ( @ Nonnull ExternalSystemTaskNotificationListener ... listeners ) { ExternalSystemTaskState currentTaskState = getState ( ) ; if ( currentTaskState . isStopped ( ) ) return true ; ExternalSystemProgressNotificationManager progressManager = ServiceManager . getService ( ExternalSystemProgressNotificationManager . class ) ; for ( ExternalSystemTaskNotificationListener listener : listeners ) { progressManager . addNotificationListener ( getId ( ) , listener ) ; } if ( ! compareAndSetState ( currentTaskState , ExternalSystemTaskState . CANCELING ) ) return false ; boolean result = false ; try { result = doCancel ( ) ; setState ( result ? ExternalSystemTaskState . CANCELED : ExternalSystemTaskState . CANCELLATION_FAILED ) ; return result ; } catch ( Throwable e ) { setState ( ExternalSystemTaskState . CANCELLATION_FAILED ) ; myError . set ( e ) ; } finally { for ( ExternalSystemTaskNotificationListener listener : listeners ) { progressManager . removeNotificationListener ( listener ) ; } } return result ; }
public boolean cancel ( @ Nonnull ExternalSystemTaskNotificationListener ... listeners ) { ExternalSystemTaskState currentTaskState = getState ( ) ; if ( currentTaskState . isStopped ( ) ) return true ; ExternalSystemProgressNotificationManager progressManager = ServiceManager . getService ( ExternalSystemProgressNotificationManager . class ) ; for ( ExternalSystemTaskNotificationListener listener : listeners ) { progressManager . addNotificationListener ( getId ( ) , listener ) ; } if ( ! compareAndSetState ( currentTaskState , ExternalSystemTaskState . CANCELING ) ) return false ; boolean result = false ; try { result = doCancel ( ) ; setState ( result ? ExternalSystemTaskState . CANCELED : ExternalSystemTaskState . CANCELLATION_FAILED ) ; return result ; } catch ( Throwable e ) { setState ( ExternalSystemTaskState . CANCELLATION_FAILED ) ; myError . set ( e ) ; LOG . warn ( e ) ; } finally { for ( ExternalSystemTaskNotificationListener listener : listeners ) { progressManager . removeNotificationListener ( listener ) ; } } return result ; }
817
@ AfterClass public static void tearDown ( ) { try { if ( ! StringUtils . isBlank ( shiroPath ) ) { File shiroFile = new File ( shiroPath ) ; if ( StringUtils . isBlank ( originalShiro ) ) { FileUtils . deleteQuietly ( shiroFile ) ; } else { FileUtils . write ( shiroFile , originalShiro , "UTF-8" ) ; } } if ( ! StringUtils . isBlank ( interpreterOptionPath ) ) { File interpreterOptionFile = new File ( interpreterOptionPath ) ; if ( StringUtils . isBlank ( originalInterpreterOption ) ) { FileUtils . deleteQuietly ( interpreterOptionFile ) ; } else { FileUtils . write ( interpreterOptionFile , originalInterpreterOption , "UTF-8" ) ; } } } catch ( IOException e ) { } ZeppelinITUtils . restartZeppelin ( ) ; driver . quit ( ) ; }
@ AfterClass public static void tearDown ( ) { try { if ( ! StringUtils . isBlank ( shiroPath ) ) { File shiroFile = new File ( shiroPath ) ; if ( StringUtils . isBlank ( originalShiro ) ) { FileUtils . deleteQuietly ( shiroFile ) ; } else { FileUtils . write ( shiroFile , originalShiro , "UTF-8" ) ; } } if ( ! StringUtils . isBlank ( interpreterOptionPath ) ) { File interpreterOptionFile = new File ( interpreterOptionPath ) ; if ( StringUtils . isBlank ( originalInterpreterOption ) ) { FileUtils . deleteQuietly ( interpreterOptionFile ) ; } else { FileUtils . write ( interpreterOptionFile , originalInterpreterOption , "UTF-8" ) ; } } } catch ( IOException e ) { LOG . error ( "Error in InterpreterModeActionsIT tearDown::" , e ) ; } ZeppelinITUtils . restartZeppelin ( ) ; driver . quit ( ) ; }
818
public static final void setCreatedOnPersistentObject ( PersistentObject persistentObject , ReadableDateTime created ) throws NoSuchFieldException , IllegalAccessException { Field createdField = PersistentObject . class . getDeclaredField ( "created" ) ; }
public static final void setCreatedOnPersistentObject ( PersistentObject persistentObject , ReadableDateTime created ) throws NoSuchFieldException , IllegalAccessException { Field createdField = PersistentObject . class . getDeclaredField ( "created" ) ; AccessController . doPrivileged ( ( PrivilegedAction < PersistentObject > ) ( ) -> { createdField . setAccessible ( true ) ; try { createdField . set ( persistentObject , created ) ; } catch ( IllegalAccessException e ) { logger . error ( "Could not set CREATED field for persistent object" , e ) ; } createdField . setAccessible ( false ) ; return null ; } ) ; }
819
public static final void setCreatedOnPersistentObject ( PersistentObject persistentObject , ReadableDateTime created ) throws NoSuchFieldException , IllegalAccessException { Field createdField = PersistentObject . class . getDeclaredField ( "created" ) ; AccessController . doPrivileged ( ( PrivilegedAction < PersistentObject > ) ( ) -> { createdField . setAccessible ( true ) ; try { createdField . set ( persistentObject , created ) ; } catch ( IllegalAccessException e ) { } createdField . setAccessible ( false ) ; return null ; } ) ; }
public static final void setCreatedOnPersistentObject ( PersistentObject persistentObject , ReadableDateTime created ) throws NoSuchFieldException , IllegalAccessException { Field createdField = PersistentObject . class . getDeclaredField ( "created" ) ; AccessController . doPrivileged ( ( PrivilegedAction < PersistentObject > ) ( ) -> { createdField . setAccessible ( true ) ; try { createdField . set ( persistentObject , created ) ; } catch ( IllegalAccessException e ) { logger . error ( "Could not set CREATED field for persistent object" , e ) ; } createdField . setAccessible ( false ) ; return null ; } ) ; }
820
public void closed ( ) { if ( LOG . isDebugEnabled ( ) ) }
public void closed ( ) { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "NullCallback closed" ) ; }
821
protected < C > RowReader < C > getReader ( final DataStoreOperations datastoreOperations , final DataStoreOptions options , final PersistentAdapterStore adapterStore , final AdapterIndexMappingStore mappingStore , final InternalAdapterStore internalAdapterStore , final double [ ] maxResolutionSubsamplingPerDimension , final double [ ] targetResolutionPerDimensionForHierarchicalIndex , final Integer limit , final Integer queryMaxRangeDecomposition , final GeoWaveRowIteratorTransformer < C > rowTransformer , final boolean delete ) { boolean exists = false ; try { exists = datastoreOperations . indexExists ( index . getName ( ) ) ; } catch ( final IOException e ) { } if ( ! exists ) { LOGGER . warn ( "Table does not exist " + index . getName ( ) ) ; return null ; } return super . getReader ( datastoreOperations , options , adapterStore , mappingStore , internalAdapterStore , maxResolutionSubsamplingPerDimension , targetResolutionPerDimensionForHierarchicalIndex , limit , queryMaxRangeDecomposition , rowTransformer , delete ) ; }
protected < C > RowReader < C > getReader ( final DataStoreOperations datastoreOperations , final DataStoreOptions options , final PersistentAdapterStore adapterStore , final AdapterIndexMappingStore mappingStore , final InternalAdapterStore internalAdapterStore , final double [ ] maxResolutionSubsamplingPerDimension , final double [ ] targetResolutionPerDimensionForHierarchicalIndex , final Integer limit , final Integer queryMaxRangeDecomposition , final GeoWaveRowIteratorTransformer < C > rowTransformer , final boolean delete ) { boolean exists = false ; try { exists = datastoreOperations . indexExists ( index . getName ( ) ) ; } catch ( final IOException e ) { LOGGER . error ( "Table does not exist" , e ) ; } if ( ! exists ) { LOGGER . warn ( "Table does not exist " + index . getName ( ) ) ; return null ; } return super . getReader ( datastoreOperations , options , adapterStore , mappingStore , internalAdapterStore , maxResolutionSubsamplingPerDimension , targetResolutionPerDimensionForHierarchicalIndex , limit , queryMaxRangeDecomposition , rowTransformer , delete ) ; }
822
protected < C > RowReader < C > getReader ( final DataStoreOperations datastoreOperations , final DataStoreOptions options , final PersistentAdapterStore adapterStore , final AdapterIndexMappingStore mappingStore , final InternalAdapterStore internalAdapterStore , final double [ ] maxResolutionSubsamplingPerDimension , final double [ ] targetResolutionPerDimensionForHierarchicalIndex , final Integer limit , final Integer queryMaxRangeDecomposition , final GeoWaveRowIteratorTransformer < C > rowTransformer , final boolean delete ) { boolean exists = false ; try { exists = datastoreOperations . indexExists ( index . getName ( ) ) ; } catch ( final IOException e ) { LOGGER . error ( "Table does not exist" , e ) ; } if ( ! exists ) { return null ; } return super . getReader ( datastoreOperations , options , adapterStore , mappingStore , internalAdapterStore , maxResolutionSubsamplingPerDimension , targetResolutionPerDimensionForHierarchicalIndex , limit , queryMaxRangeDecomposition , rowTransformer , delete ) ; }
protected < C > RowReader < C > getReader ( final DataStoreOperations datastoreOperations , final DataStoreOptions options , final PersistentAdapterStore adapterStore , final AdapterIndexMappingStore mappingStore , final InternalAdapterStore internalAdapterStore , final double [ ] maxResolutionSubsamplingPerDimension , final double [ ] targetResolutionPerDimensionForHierarchicalIndex , final Integer limit , final Integer queryMaxRangeDecomposition , final GeoWaveRowIteratorTransformer < C > rowTransformer , final boolean delete ) { boolean exists = false ; try { exists = datastoreOperations . indexExists ( index . getName ( ) ) ; } catch ( final IOException e ) { LOGGER . error ( "Table does not exist" , e ) ; } if ( ! exists ) { LOGGER . warn ( "Table does not exist " + index . getName ( ) ) ; return null ; } return super . getReader ( datastoreOperations , options , adapterStore , mappingStore , internalAdapterStore , maxResolutionSubsamplingPerDimension , targetResolutionPerDimensionForHierarchicalIndex , limit , queryMaxRangeDecomposition , rowTransformer , delete ) ; }
823
private long _loginUser ( HttpServletRequest httpServletRequest , HttpServletResponse httpServletResponse , long companyId , long userId , String remoteUser ) throws PortalException { if ( ( userId > 0 ) || ( remoteUser == null ) ) { return userId ; } if ( PropsValues . PORTAL_JAAS_ENABLE ) { try { userId = JAASHelper . getJaasUserId ( companyId , remoteUser ) ; } catch ( Exception exception ) { if ( _log . isWarnEnabled ( ) ) { } } } else { userId = GetterUtil . getLong ( remoteUser ) ; } User user = UserLocalServiceUtil . getUserById ( userId ) ; if ( ! user . isDefaultUser ( ) ) { EventsProcessorUtil . process ( PropsKeys . LOGIN_EVENTS_PRE , PropsValues . LOGIN_EVENTS_PRE , httpServletRequest , httpServletResponse ) ; if ( PropsValues . USERS_UPDATE_LAST_LOGIN || ( user . getLastLoginDate ( ) == null ) ) { user = UserLocalServiceUtil . updateLastLogin ( userId , httpServletRequest . getRemoteAddr ( ) ) ; } } if ( httpServletRequest . getAttribute ( WebKeys . USER ) != null ) { httpServletRequest . setAttribute ( WebKeys . USER , user ) ; httpServletRequest . setAttribute ( WebKeys . USER_ID , Long . valueOf ( userId ) ) ; } HttpSession session = httpServletRequest . getSession ( ) ; session . setAttribute ( WebKeys . LOCALE , user . getLocale ( ) ) ; session . setAttribute ( WebKeys . USER , user ) ; session . setAttribute ( WebKeys . USER_ID , Long . valueOf ( userId ) ) ; session . removeAttribute ( "j_remoteuser" ) ; if ( ! user . isDefaultUser ( ) ) { EventsProcessorUtil . process ( PropsKeys . LOGIN_EVENTS_POST , PropsValues . LOGIN_EVENTS_POST , httpServletRequest , httpServletResponse ) ; } return userId ; }
private long _loginUser ( HttpServletRequest httpServletRequest , HttpServletResponse httpServletResponse , long companyId , long userId , String remoteUser ) throws PortalException { if ( ( userId > 0 ) || ( remoteUser == null ) ) { return userId ; } if ( PropsValues . PORTAL_JAAS_ENABLE ) { try { userId = JAASHelper . getJaasUserId ( companyId , remoteUser ) ; } catch ( Exception exception ) { if ( _log . isWarnEnabled ( ) ) { _log . warn ( StringBundler . concat ( "Unable to sign in " , remoteUser , " in company " , companyId , " using JAAS: " , exception . getMessage ( ) ) , exception ) ; } } } else { userId = GetterUtil . getLong ( remoteUser ) ; } User user = UserLocalServiceUtil . getUserById ( userId ) ; if ( ! user . isDefaultUser ( ) ) { EventsProcessorUtil . process ( PropsKeys . LOGIN_EVENTS_PRE , PropsValues . LOGIN_EVENTS_PRE , httpServletRequest , httpServletResponse ) ; if ( PropsValues . USERS_UPDATE_LAST_LOGIN || ( user . getLastLoginDate ( ) == null ) ) { user = UserLocalServiceUtil . updateLastLogin ( userId , httpServletRequest . getRemoteAddr ( ) ) ; } } if ( httpServletRequest . getAttribute ( WebKeys . USER ) != null ) { httpServletRequest . setAttribute ( WebKeys . USER , user ) ; httpServletRequest . setAttribute ( WebKeys . USER_ID , Long . valueOf ( userId ) ) ; } HttpSession session = httpServletRequest . getSession ( ) ; session . setAttribute ( WebKeys . LOCALE , user . getLocale ( ) ) ; session . setAttribute ( WebKeys . USER , user ) ; session . setAttribute ( WebKeys . USER_ID , Long . valueOf ( userId ) ) ; session . removeAttribute ( "j_remoteuser" ) ; if ( ! user . isDefaultUser ( ) ) { EventsProcessorUtil . process ( PropsKeys . LOGIN_EVENTS_POST , PropsValues . LOGIN_EVENTS_POST , httpServletRequest , httpServletResponse ) ; } return userId ; }
824
@ SuppressWarnings ( "unchecked" ) private < T > Map < String , T > getRegisteredComponents ( ApplicationContext context , Class < T > type ) { Map < String , T > components = new HashMap < > ( ) ; Map registeredComponents = context . getBeansOfType ( type ) ; if ( log . isTraceEnabled ( ) ) { } if ( registeredComponents != null ) { components . putAll ( registeredComponents ) ; } if ( context . getParent ( ) != null ) { components . putAll ( getRegisteredComponents ( context . getParent ( ) , type ) ) ; } return components ; }
@ SuppressWarnings ( "unchecked" ) private < T > Map < String , T > getRegisteredComponents ( ApplicationContext context , Class < T > type ) { Map < String , T > components = new HashMap < > ( ) ; Map registeredComponents = context . getBeansOfType ( type ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "getRegisteredComponents(" + context + ", " + type + ") = " + registeredComponents ) ; } if ( registeredComponents != null ) { components . putAll ( registeredComponents ) ; } if ( context . getParent ( ) != null ) { components . putAll ( getRegisteredComponents ( context . getParent ( ) , type ) ) ; } return components ; }
825
private void deleteLockAndFolders ( Path lock ) { try { if ( lock != null ) { Files . delete ( lock ) ; } deleteEmptyParentFolders ( ) ; } catch ( Exception ex ) { } }
private void deleteLockAndFolders ( Path lock ) { try { if ( lock != null ) { Files . delete ( lock ) ; } deleteEmptyParentFolders ( ) ; } catch ( Exception ex ) { LOG . error ( ex . getMessage ( ) , ex ) ; } }
826
public void waitForBundleUninstall ( String ... bundleSymbolicNames ) { Set < String > symbolicNamesSet = Sets . newHashSet ( bundleSymbolicNames ) ; List < Long > bundleIds = Arrays . stream ( bundleContext . getBundles ( ) ) . filter ( b -> symbolicNamesSet . contains ( b . getSymbolicName ( ) ) ) . map ( Bundle :: getBundleId ) . collect ( Collectors . toList ( ) ) ; await ( String . format ( "Bundles %s uninstalled" , symbolicNamesSet ) ) . atMost ( FEATURES_AND_BUNDLES_TIMEOUT , TimeUnit . MILLISECONDS ) . until ( ( ) -> bundleIds . stream ( ) . noneMatch ( id -> bundleContext . getBundle ( id ) != null ) ) ; LOGGER . info ( "Bundles {} uninstalled" , symbolicNamesSet ) ; }
public void waitForBundleUninstall ( String ... bundleSymbolicNames ) { Set < String > symbolicNamesSet = Sets . newHashSet ( bundleSymbolicNames ) ; LOGGER . info ( "Waiting for bundles {} to be uninstalled..." , symbolicNamesSet ) ; List < Long > bundleIds = Arrays . stream ( bundleContext . getBundles ( ) ) . filter ( b -> symbolicNamesSet . contains ( b . getSymbolicName ( ) ) ) . map ( Bundle :: getBundleId ) . collect ( Collectors . toList ( ) ) ; await ( String . format ( "Bundles %s uninstalled" , symbolicNamesSet ) ) . atMost ( FEATURES_AND_BUNDLES_TIMEOUT , TimeUnit . MILLISECONDS ) . until ( ( ) -> bundleIds . stream ( ) . noneMatch ( id -> bundleContext . getBundle ( id ) != null ) ) ; LOGGER . info ( "Bundles {} uninstalled" , symbolicNamesSet ) ; }
827
public void waitForBundleUninstall ( String ... bundleSymbolicNames ) { Set < String > symbolicNamesSet = Sets . newHashSet ( bundleSymbolicNames ) ; LOGGER . info ( "Waiting for bundles {} to be uninstalled..." , symbolicNamesSet ) ; List < Long > bundleIds = Arrays . stream ( bundleContext . getBundles ( ) ) . filter ( b -> symbolicNamesSet . contains ( b . getSymbolicName ( ) ) ) . map ( Bundle :: getBundleId ) . collect ( Collectors . toList ( ) ) ; await ( String . format ( "Bundles %s uninstalled" , symbolicNamesSet ) ) . atMost ( FEATURES_AND_BUNDLES_TIMEOUT , TimeUnit . MILLISECONDS ) . until ( ( ) -> bundleIds . stream ( ) . noneMatch ( id -> bundleContext . getBundle ( id ) != null ) ) ; }
public void waitForBundleUninstall ( String ... bundleSymbolicNames ) { Set < String > symbolicNamesSet = Sets . newHashSet ( bundleSymbolicNames ) ; LOGGER . info ( "Waiting for bundles {} to be uninstalled..." , symbolicNamesSet ) ; List < Long > bundleIds = Arrays . stream ( bundleContext . getBundles ( ) ) . filter ( b -> symbolicNamesSet . contains ( b . getSymbolicName ( ) ) ) . map ( Bundle :: getBundleId ) . collect ( Collectors . toList ( ) ) ; await ( String . format ( "Bundles %s uninstalled" , symbolicNamesSet ) ) . atMost ( FEATURES_AND_BUNDLES_TIMEOUT , TimeUnit . MILLISECONDS ) . until ( ( ) -> bundleIds . stream ( ) . noneMatch ( id -> bundleContext . getBundle ( id ) != null ) ) ; LOGGER . info ( "Bundles {} uninstalled" , symbolicNamesSet ) ; }
828
public void writeElement ( SBMLObjectForXML xmlObject , Object sbmlElementToWrite ) { super . writeElement ( xmlObject , sbmlElementToWrite ) ; if ( sbmlElementToWrite instanceof SBase ) { SBase sbase = ( SBase ) sbmlElementToWrite ; if ( ! xmlObject . isSetName ( ) ) { xmlObject . setName ( sbase . getElementName ( ) ) ; } if ( xmlObject . getName ( ) . equals ( "listOfUncertaintys" ) ) { xmlObject . setName ( DistribConstants . listOfUncertainties ) ; } } if ( logger . isDebugEnabled ( ) ) { } }
public void writeElement ( SBMLObjectForXML xmlObject , Object sbmlElementToWrite ) { super . writeElement ( xmlObject , sbmlElementToWrite ) ; if ( sbmlElementToWrite instanceof SBase ) { SBase sbase = ( SBase ) sbmlElementToWrite ; if ( ! xmlObject . isSetName ( ) ) { xmlObject . setName ( sbase . getElementName ( ) ) ; } if ( xmlObject . getName ( ) . equals ( "listOfUncertaintys" ) ) { xmlObject . setName ( DistribConstants . listOfUncertainties ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "writeElement " + xmlObject . getName ( ) ) ; } }
829
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread interrupted" , e ) ; } LOG . info ( "{} Current pod is losing leadership now..." , logPrefix ( ) ) ; this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; LOG . info ( "{} Current pod owns the leadership, but it will be lost in {} seconds..." , logPrefix ( ) , new BigDecimal ( delay ) . divide ( BigDecimal . valueOf ( 1000 ) , 2 , BigDecimal . ROUND_HALF_UP ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread interrupted" , e ) ; } LOG . info ( "{} Current pod is losing leadership now..." , logPrefix ( ) ) ; this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
830
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; LOG . info ( "{} Current pod owns the leadership, but it will be lost in {} seconds..." , logPrefix ( ) , new BigDecimal ( delay ) . divide ( BigDecimal . valueOf ( 1000 ) , 2 , BigDecimal . ROUND_HALF_UP ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { } LOG . info ( "{} Current pod is losing leadership now..." , logPrefix ( ) ) ; this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; LOG . info ( "{} Current pod owns the leadership, but it will be lost in {} seconds..." , logPrefix ( ) , new BigDecimal ( delay ) . divide ( BigDecimal . valueOf ( 1000 ) , 2 , BigDecimal . ROUND_HALF_UP ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread interrupted" , e ) ; } LOG . info ( "{} Current pod is losing leadership now..." , logPrefix ( ) ) ; this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
831
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; LOG . info ( "{} Current pod owns the leadership, but it will be lost in {} seconds..." , logPrefix ( ) , new BigDecimal ( delay ) . divide ( BigDecimal . valueOf ( 1000 ) , 2 , BigDecimal . ROUND_HALF_UP ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread interrupted" , e ) ; } this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
private void refreshStatusLosingLeadership ( ) { long delay = this . lockConfiguration . getLeaseDurationMillis ( ) ; LOG . info ( "{} Current pod owns the leadership, but it will be lost in {} seconds..." , logPrefix ( ) , new BigDecimal ( delay ) . divide ( BigDecimal . valueOf ( 1000 ) , 2 , BigDecimal . ROUND_HALF_UP ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread interrupted" , e ) ; } LOG . info ( "{} Current pod is losing leadership now..." , logPrefix ( ) ) ; this . currentState = State . LEADERSHIP_LOST ; this . serializedExecutor . execute ( this :: refreshStatus ) ; }
832
private void rollbackForVoteOK ( ) { status = Status . STATUS_ROLLING_BACK ; for ( int i = 0 ; i < getXAResourceWrapperSize ( ) ; ++ i ) { XAResourceWrapper xarw = getXAResourceWrapper ( i ) ; if ( xarw . isVoteOk ( ) ) { try { xarw . rollback ( ) ; } catch ( Throwable t ) { status = Status . STATUS_UNKNOWN ; } } } if ( status == Status . STATUS_ROLLING_BACK ) { status = Status . STATUS_ROLLEDBACK ; } }
private void rollbackForVoteOK ( ) { status = Status . STATUS_ROLLING_BACK ; for ( int i = 0 ; i < getXAResourceWrapperSize ( ) ; ++ i ) { XAResourceWrapper xarw = getXAResourceWrapper ( i ) ; if ( xarw . isVoteOk ( ) ) { try { xarw . rollback ( ) ; } catch ( Throwable t ) { logger . log ( t ) ; status = Status . STATUS_UNKNOWN ; } } } if ( status == Status . STATUS_ROLLING_BACK ) { status = Status . STATUS_ROLLEDBACK ; } }
833
private List < ClientListEntry > convertFTPFiles ( String currentDir , FTPFile [ ] ftpFiles ) throws URISyntaxException { List < ClientListEntry > list = new ArrayList < ClientListEntry > ( ftpFiles . length ) ; if ( ftpFiles == null ) { return list ; } for ( FTPFile ftpFile : ftpFiles ) { if ( ftpFile != null ) { URI fileUri = this . getURI ( currentDir , ftpFile . getName ( ) ) ; ClientListEntry entry = convertFTPFileToClientListEntry ( ftpFile , fileUri , currentDir ) ; list . add ( entry ) ; } else { logger . warn ( "One of the ftp file listings could not be parsed." ) ; } } return list ; }
private List < ClientListEntry > convertFTPFiles ( String currentDir , FTPFile [ ] ftpFiles ) throws URISyntaxException { List < ClientListEntry > list = new ArrayList < ClientListEntry > ( ftpFiles . length ) ; if ( ftpFiles == null ) { logger . debug ( "Directory was empty." ) ; return list ; } for ( FTPFile ftpFile : ftpFiles ) { if ( ftpFile != null ) { URI fileUri = this . getURI ( currentDir , ftpFile . getName ( ) ) ; ClientListEntry entry = convertFTPFileToClientListEntry ( ftpFile , fileUri , currentDir ) ; list . add ( entry ) ; } else { logger . warn ( "One of the ftp file listings could not be parsed." ) ; } } return list ; }
834
private List < ClientListEntry > convertFTPFiles ( String currentDir , FTPFile [ ] ftpFiles ) throws URISyntaxException { List < ClientListEntry > list = new ArrayList < ClientListEntry > ( ftpFiles . length ) ; if ( ftpFiles == null ) { logger . debug ( "Directory was empty." ) ; return list ; } for ( FTPFile ftpFile : ftpFiles ) { if ( ftpFile != null ) { URI fileUri = this . getURI ( currentDir , ftpFile . getName ( ) ) ; ClientListEntry entry = convertFTPFileToClientListEntry ( ftpFile , fileUri , currentDir ) ; list . add ( entry ) ; } else { } } return list ; }
private List < ClientListEntry > convertFTPFiles ( String currentDir , FTPFile [ ] ftpFiles ) throws URISyntaxException { List < ClientListEntry > list = new ArrayList < ClientListEntry > ( ftpFiles . length ) ; if ( ftpFiles == null ) { logger . debug ( "Directory was empty." ) ; return list ; } for ( FTPFile ftpFile : ftpFiles ) { if ( ftpFile != null ) { URI fileUri = this . getURI ( currentDir , ftpFile . getName ( ) ) ; ClientListEntry entry = convertFTPFileToClientListEntry ( ftpFile , fileUri , currentDir ) ; list . add ( entry ) ; } else { logger . warn ( "One of the ftp file listings could not be parsed." ) ; } } return list ; }
835
public OutboundOrchestratable process ( OutboundOrchestratable message ) { if ( message instanceof OutboundDocQueryOrchestratable ) { return process ( ( OutboundDocQueryOrchestratable ) message ) ; } return null ; }
public OutboundOrchestratable process ( OutboundOrchestratable message ) { if ( message instanceof OutboundDocQueryOrchestratable ) { return process ( ( OutboundDocQueryOrchestratable ) message ) ; } LOG . error ( "NhinDocQueryDelegate message is not an instance of EntityDocQueryOrchestratable!" ) ; return null ; }
836
private PortletURL _getPortletURL ( ) { PortletURL currentURLObj = PortletURLUtil . getCurrent ( _renderRequest , _renderResponse ) ; try { return PortletURLUtil . clone ( currentURLObj , _renderResponse ) ; } catch ( PortletException portletException ) { if ( _log . isDebugEnabled ( ) ) { } return PortletURLBuilder . createRenderURL ( _renderResponse ) . setParameters ( currentURLObj . getParameterMap ( ) ) . build ( ) ; } }
private PortletURL _getPortletURL ( ) { PortletURL currentURLObj = PortletURLUtil . getCurrent ( _renderRequest , _renderResponse ) ; try { return PortletURLUtil . clone ( currentURLObj , _renderResponse ) ; } catch ( PortletException portletException ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( portletException , portletException ) ; } return PortletURLBuilder . createRenderURL ( _renderResponse ) . setParameters ( currentURLObj . getParameterMap ( ) ) . build ( ) ; } }
837
public double getCurrentProgress ( long jobExecutionId ) { Map < String , Object > data = statusHolder . get ( jobExecutionId ) ; if ( data == null ) { return 0.0 ; } Double progress = ( Double ) data . get ( JOB_PROGRESS ) ; if ( progress == null ) { logger . info ( "no progress found for job execution: " + jobExecutionId ) ; return 0.0 ; } return progress ; }
public double getCurrentProgress ( long jobExecutionId ) { Map < String , Object > data = statusHolder . get ( jobExecutionId ) ; if ( data == null ) { logger . info ( "no status found for job execution: " + jobExecutionId ) ; return 0.0 ; } Double progress = ( Double ) data . get ( JOB_PROGRESS ) ; if ( progress == null ) { logger . info ( "no progress found for job execution: " + jobExecutionId ) ; return 0.0 ; } return progress ; }
838
public double getCurrentProgress ( long jobExecutionId ) { Map < String , Object > data = statusHolder . get ( jobExecutionId ) ; if ( data == null ) { logger . info ( "no status found for job execution: " + jobExecutionId ) ; return 0.0 ; } Double progress = ( Double ) data . get ( JOB_PROGRESS ) ; if ( progress == null ) { return 0.0 ; } return progress ; }
public double getCurrentProgress ( long jobExecutionId ) { Map < String , Object > data = statusHolder . get ( jobExecutionId ) ; if ( data == null ) { logger . info ( "no status found for job execution: " + jobExecutionId ) ; return 0.0 ; } Double progress = ( Double ) data . get ( JOB_PROGRESS ) ; if ( progress == null ) { logger . info ( "no progress found for job execution: " + jobExecutionId ) ; return 0.0 ; } return progress ; }
839
public boolean deleteAllExpiredObjects ( ) { Connection conn = null ; try { conn = provider . getConnection ( ) ; conn . setAutoCommit ( false ) ; PreparedStatement query = conn . prepareStatement ( "delete from expired_objects where exp < CURRENT_TIMESTAMP()" ) ; query . executeUpdate ( ) ; query . close ( ) ; conn . commit ( ) ; return true ; } catch ( Exception e ) { LOG . error ( "Failed to remove expired_objects. " , e ) ; rollbackSilently ( conn ) ; return false ; } finally { IOUtils . closeSilently ( conn ) ; } }
public boolean deleteAllExpiredObjects ( ) { Connection conn = null ; try { conn = provider . getConnection ( ) ; conn . setAutoCommit ( false ) ; PreparedStatement query = conn . prepareStatement ( "delete from expired_objects where exp < CURRENT_TIMESTAMP()" ) ; query . executeUpdate ( ) ; query . close ( ) ; conn . commit ( ) ; LOG . debug ( "Removed expired_objects successfully. " ) ; return true ; } catch ( Exception e ) { LOG . error ( "Failed to remove expired_objects. " , e ) ; rollbackSilently ( conn ) ; return false ; } finally { IOUtils . closeSilently ( conn ) ; } }
840
public boolean deleteAllExpiredObjects ( ) { Connection conn = null ; try { conn = provider . getConnection ( ) ; conn . setAutoCommit ( false ) ; PreparedStatement query = conn . prepareStatement ( "delete from expired_objects where exp < CURRENT_TIMESTAMP()" ) ; query . executeUpdate ( ) ; query . close ( ) ; conn . commit ( ) ; LOG . debug ( "Removed expired_objects successfully. " ) ; return true ; } catch ( Exception e ) { rollbackSilently ( conn ) ; return false ; } finally { IOUtils . closeSilently ( conn ) ; } }
public boolean deleteAllExpiredObjects ( ) { Connection conn = null ; try { conn = provider . getConnection ( ) ; conn . setAutoCommit ( false ) ; PreparedStatement query = conn . prepareStatement ( "delete from expired_objects where exp < CURRENT_TIMESTAMP()" ) ; query . executeUpdate ( ) ; query . close ( ) ; conn . commit ( ) ; LOG . debug ( "Removed expired_objects successfully. " ) ; return true ; } catch ( Exception e ) { LOG . error ( "Failed to remove expired_objects. " , e ) ; rollbackSilently ( conn ) ; return false ; } finally { IOUtils . closeSilently ( conn ) ; } }
841
public BrooklynPropertiesImpl addFrom ( File f ) { if ( ! f . exists ( ) ) { return this ; } else { try { return addFrom ( new FileInputStream ( f ) ) ; } catch ( FileNotFoundException e ) { throw Throwables . propagate ( e ) ; } } }
public BrooklynPropertiesImpl addFrom ( File f ) { if ( ! f . exists ( ) ) { LOG . warn ( "Unable to find file '" + f . getAbsolutePath ( ) + "' when loading properties; ignoring" ) ; return this ; } else { try { return addFrom ( new FileInputStream ( f ) ) ; } catch ( FileNotFoundException e ) { throw Throwables . propagate ( e ) ; } } }
842
void handle ( Http . RequestMethod method , ServerRequest request , ServerResponse response ) { if ( ( method != Http . Method . GET ) && ( method != Http . Method . HEAD ) ) { request . next ( ) ; return ; } String requestPath = request . path ( ) . toString ( ) ; if ( requestPath . startsWith ( "/" ) ) { requestPath = requestPath . substring ( 1 ) ; } try { if ( ! doHandle ( method , requestPath , request , response ) ) { request . next ( ) ; } } catch ( HttpException httpException ) { if ( httpException . status ( ) . code ( ) == Http . Status . NOT_FOUND_404 . code ( ) ) { request . next ( ) ; } else { throw httpException ; } } catch ( Exception e ) { throw new HttpException ( "Cannot access static resource!" , Http . Status . INTERNAL_SERVER_ERROR_500 , e ) ; } }
void handle ( Http . RequestMethod method , ServerRequest request , ServerResponse response ) { if ( ( method != Http . Method . GET ) && ( method != Http . Method . HEAD ) ) { request . next ( ) ; return ; } String requestPath = request . path ( ) . toString ( ) ; if ( requestPath . startsWith ( "/" ) ) { requestPath = requestPath . substring ( 1 ) ; } try { if ( ! doHandle ( method , requestPath , request , response ) ) { request . next ( ) ; } } catch ( HttpException httpException ) { if ( httpException . status ( ) . code ( ) == Http . Status . NOT_FOUND_404 . code ( ) ) { request . next ( ) ; } else { throw httpException ; } } catch ( Exception e ) { LOGGER . log ( Level . FINE , "Failed to access static resource" , e ) ; throw new HttpException ( "Cannot access static resource!" , Http . Status . INTERNAL_SERVER_ERROR_500 , e ) ; } }
843
private AidrCollectionTotalDTO convertAidrCollectionToDTO ( Collection collection , List < UserAccount > managers ) { if ( collection == null ) { return null ; } AidrCollectionTotalDTO dto = new AidrCollectionTotalDTO ( ) ; dto . setId ( collection . getId ( ) ) ; dto . setCode ( collection . getCode ( ) ) ; dto . setName ( collection . getName ( ) ) ; dto . setGeoR ( collection . getGeoR ( ) ) ; UserAccount user = collection . getOwner ( ) ; dto . setUser ( user ) ; if ( collection . getCount ( ) != null ) { dto . setCount ( collection . getCount ( ) ) ; } else { dto . setCount ( 0 ) ; } dto . setStatus ( collection . getStatus ( ) ) ; dto . setTrack ( collection . getTrack ( ) ) ; try { if ( user != null ) { if ( collection . getProvider ( ) == CollectionType . Facebook ) { dto . setFollow ( collection . getFollow ( ) ) ; } else { dto . setFollow ( collectionService . getFollowTwitterScreenNames ( collection . getFollow ( ) , user . getUserName ( ) ) ) ; } } } catch ( RuntimeException e ) { } dto . setGeo ( collection . getGeo ( ) ) ; dto . setFetchInterval ( collection . getFetchInterval ( ) ) ; dto . setFetchFrom ( collection . getFetchFrom ( ) ) ; dto . setLangFilters ( collection . getLangFilters ( ) ) ; dto . setStartDate ( collection . getStartDate ( ) ) ; dto . setEndDate ( collection . getEndDate ( ) ) ; dto . setCreatedDate ( collection . getCreatedAt ( ) ) ; dto . setLastDocument ( collection . getLastDocument ( ) ) ; dto . setDurationHours ( collection . getDurationHours ( ) ) ; dto . setPubliclyListed ( collection . isPubliclyListed ( ) ) ; dto . setCrisisType ( collection . getCrisisType ( ) ) ; dto . setCollectionType ( collection . getProvider ( ) ) ; dto . setHasTaggerOutput ( collection . isClassifierEnabled ( ) ) ; dto . setManagers ( managers ) ; dto . setPurpose ( collection . getPurpose ( ) ) ; dto . setTotalImageCount ( 0 ) ; return dto ; }
private AidrCollectionTotalDTO convertAidrCollectionToDTO ( Collection collection , List < UserAccount > managers ) { if ( collection == null ) { return null ; } AidrCollectionTotalDTO dto = new AidrCollectionTotalDTO ( ) ; dto . setId ( collection . getId ( ) ) ; dto . setCode ( collection . getCode ( ) ) ; dto . setName ( collection . getName ( ) ) ; dto . setGeoR ( collection . getGeoR ( ) ) ; UserAccount user = collection . getOwner ( ) ; dto . setUser ( user ) ; if ( collection . getCount ( ) != null ) { dto . setCount ( collection . getCount ( ) ) ; } else { dto . setCount ( 0 ) ; } dto . setStatus ( collection . getStatus ( ) ) ; dto . setTrack ( collection . getTrack ( ) ) ; try { if ( user != null ) { if ( collection . getProvider ( ) == CollectionType . Facebook ) { dto . setFollow ( collection . getFollow ( ) ) ; } else { dto . setFollow ( collectionService . getFollowTwitterScreenNames ( collection . getFollow ( ) , user . getUserName ( ) ) ) ; } } } catch ( RuntimeException e ) { logger . error ( "Error" , e ) ; } dto . setGeo ( collection . getGeo ( ) ) ; dto . setFetchInterval ( collection . getFetchInterval ( ) ) ; dto . setFetchFrom ( collection . getFetchFrom ( ) ) ; dto . setLangFilters ( collection . getLangFilters ( ) ) ; dto . setStartDate ( collection . getStartDate ( ) ) ; dto . setEndDate ( collection . getEndDate ( ) ) ; dto . setCreatedDate ( collection . getCreatedAt ( ) ) ; dto . setLastDocument ( collection . getLastDocument ( ) ) ; dto . setDurationHours ( collection . getDurationHours ( ) ) ; dto . setPubliclyListed ( collection . isPubliclyListed ( ) ) ; dto . setCrisisType ( collection . getCrisisType ( ) ) ; dto . setCollectionType ( collection . getProvider ( ) ) ; dto . setHasTaggerOutput ( collection . isClassifierEnabled ( ) ) ; dto . setManagers ( managers ) ; dto . setPurpose ( collection . getPurpose ( ) ) ; dto . setTotalImageCount ( 0 ) ; return dto ; }
844
public boolean isReady ( KafkaSpoutMessageId msgId ) { boolean retry = false ; if ( isScheduled ( msgId ) ) { final long currentTimeNanos = Time . nanoTime ( ) ; for ( RetrySchedule retrySchedule : retrySchedules ) { if ( retrySchedule . retry ( currentTimeNanos ) ) { if ( retrySchedule . msgId . equals ( msgId ) ) { retry = true ; break ; } } else { LOG . debug ( "Entry to retry not found {}" , retrySchedule ) ; break ; } } } return retry ; }
public boolean isReady ( KafkaSpoutMessageId msgId ) { boolean retry = false ; if ( isScheduled ( msgId ) ) { final long currentTimeNanos = Time . nanoTime ( ) ; for ( RetrySchedule retrySchedule : retrySchedules ) { if ( retrySchedule . retry ( currentTimeNanos ) ) { if ( retrySchedule . msgId . equals ( msgId ) ) { retry = true ; LOG . debug ( "Found entry to retry {}" , retrySchedule ) ; break ; } } else { LOG . debug ( "Entry to retry not found {}" , retrySchedule ) ; break ; } } } return retry ; }
845
public boolean isReady ( KafkaSpoutMessageId msgId ) { boolean retry = false ; if ( isScheduled ( msgId ) ) { final long currentTimeNanos = Time . nanoTime ( ) ; for ( RetrySchedule retrySchedule : retrySchedules ) { if ( retrySchedule . retry ( currentTimeNanos ) ) { if ( retrySchedule . msgId . equals ( msgId ) ) { retry = true ; LOG . debug ( "Found entry to retry {}" , retrySchedule ) ; break ; } } else { break ; } } } return retry ; }
public boolean isReady ( KafkaSpoutMessageId msgId ) { boolean retry = false ; if ( isScheduled ( msgId ) ) { final long currentTimeNanos = Time . nanoTime ( ) ; for ( RetrySchedule retrySchedule : retrySchedules ) { if ( retrySchedule . retry ( currentTimeNanos ) ) { if ( retrySchedule . msgId . equals ( msgId ) ) { retry = true ; LOG . debug ( "Found entry to retry {}" , retrySchedule ) ; break ; } } else { LOG . debug ( "Entry to retry not found {}" , retrySchedule ) ; break ; } } } return retry ; }
846
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
847
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
848
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
849
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
850
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
851
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
852
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } } log . warn ( "No network interface found for IPv6" ) ; return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
853
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } return null ; }
private NetworkInterface findIPv6Interface ( Inet6Address address ) throws IOException { if ( blacklisted . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Ignore IP6 default network interface setup with empty blacklist" ) ; } return null ; } if ( address . getScopeId ( ) != 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore IP6 default network interface setup for address with scope identifier %d" , address . getScopeId ( ) ) ) ; } return null ; } List < Integer > indexes = new ArrayList < Integer > ( ) ; final Enumeration < NetworkInterface > enumeration = NetworkInterface . getNetworkInterfaces ( ) ; while ( enumeration . hasMoreElements ( ) ) { indexes . add ( enumeration . nextElement ( ) . getIndex ( ) ) ; } for ( Integer index : indexes ) { final NetworkInterface n = NetworkInterface . getByIndex ( index ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Evaluate interface with %s index %d" , n , index ) ) ; } if ( ! n . isUp ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Ignore interface %s not up" , n ) ) ; } continue ; } if ( blacklisted . contains ( n . getName ( ) ) ) { log . warn ( String . format ( "Ignore network interface %s disabled with blacklist" , n ) ) ; continue ; } for ( InterfaceAddress i : n . getInterfaceAddresses ( ) ) { if ( i . getAddress ( ) instanceof Inet6Address ) { if ( log . isInfoEnabled ( ) ) { log . info ( String . format ( "Selected network interface %s" , n ) ) ; } return n ; } } log . warn ( String . format ( "No IPv6 for interface %s" , n ) ) ; } log . warn ( "No network interface found for IPv6" ) ; return null ; }
854
public void log ( Object obj ) { }
public void log ( Object obj ) { logger . info ( ReflectionToStringBuilder . toString ( obj , ToStringStyle . MULTI_LINE_STYLE ) ) ; }
855
void storeFinalPosition ( ) throws SQLException , DuplicateProcessException { if ( position != null && ! position . equals ( storedPosition ) ) { store . set ( position ) ; } }
void storeFinalPosition ( ) throws SQLException , DuplicateProcessException { if ( position != null && ! position . equals ( storedPosition ) ) { LOGGER . info ( "Storing final position: " + position ) ; store . set ( position ) ; } }
856
private static List < Double > dropNegativeBucketBounds ( List < Double > bucketBoundaries ) { int negativeBucketBounds = 0 ; int zeroBucketBounds = 0 ; for ( Double value : bucketBoundaries ) { if ( value <= 0 ) { if ( value == 0 ) { zeroBucketBounds ++ ; } else { negativeBucketBounds ++ ; } } else { break ; } } if ( negativeBucketBounds > 0 ) { } return bucketBoundaries . subList ( negativeBucketBounds + zeroBucketBounds , bucketBoundaries . size ( ) ) ; }
private static List < Double > dropNegativeBucketBounds ( List < Double > bucketBoundaries ) { int negativeBucketBounds = 0 ; int zeroBucketBounds = 0 ; for ( Double value : bucketBoundaries ) { if ( value <= 0 ) { if ( value == 0 ) { zeroBucketBounds ++ ; } else { negativeBucketBounds ++ ; } } else { break ; } } if ( negativeBucketBounds > 0 ) { logger . log ( Level . WARNING , "Dropping " + negativeBucketBounds + " negative bucket boundaries, the values must be strictly > 0." ) ; } return bucketBoundaries . subList ( negativeBucketBounds + zeroBucketBounds , bucketBoundaries . size ( ) ) ; }
857
public void onBeforeRemove ( Company company ) { try { long companyId = company . getCompanyId ( ) ; _cpDefinitionLocalService . deleteCPDefinitions ( companyId ) ; _cpMeasurementUnitLocalService . deleteCPMeasurementUnits ( companyId ) ; _cpTaxCategoryLocalService . deleteCPTaxCategories ( companyId ) ; _commerceCatalogLocalService . deleteCommerceCatalogs ( companyId ) ; _commerceChannelLocalService . deleteCommerceChannels ( companyId ) ; } catch ( PortalException portalException ) { } }
public void onBeforeRemove ( Company company ) { try { long companyId = company . getCompanyId ( ) ; _cpDefinitionLocalService . deleteCPDefinitions ( companyId ) ; _cpMeasurementUnitLocalService . deleteCPMeasurementUnits ( companyId ) ; _cpTaxCategoryLocalService . deleteCPTaxCategories ( companyId ) ; _commerceCatalogLocalService . deleteCommerceCatalogs ( companyId ) ; _commerceChannelLocalService . deleteCommerceChannels ( companyId ) ; } catch ( PortalException portalException ) { _log . error ( portalException , portalException ) ; } }
858
@ Test public void filterByResId ( ) { FilterConstraintToQuery constraintToQuery = FilterConstraintToQuery . filterInSingleDocument ( FilterConstraints . builder ( ) . keepNone ( ) . includeStates ( allContentStates ) . resourceIdIs ( "res2" ) . build ( ) , documentId ) ; String hql = constraintToQuery . toEntityQuery ( ) ; List < HTextFlow > result = getResultList ( hql , constraintToQuery ) ; List < String > ids = transformToResIds ( result ) ; assertThat ( ids ) . contains ( "res2" ) ; verifyModalNavigationQuery ( constraintToQuery , result ) ; }
@ Test public void filterByResId ( ) { FilterConstraintToQuery constraintToQuery = FilterConstraintToQuery . filterInSingleDocument ( FilterConstraints . builder ( ) . keepNone ( ) . includeStates ( allContentStates ) . resourceIdIs ( "res2" ) . build ( ) , documentId ) ; String hql = constraintToQuery . toEntityQuery ( ) ; List < HTextFlow > result = getResultList ( hql , constraintToQuery ) ; List < String > ids = transformToResIds ( result ) ; log . debug ( "result: {}" , ids ) ; assertThat ( ids ) . contains ( "res2" ) ; verifyModalNavigationQuery ( constraintToQuery , result ) ; }
859
public int copyResource ( Map < Object , Object > sshFlags , String sourceUrl , String target , boolean createParentDir ) { if ( createParentDir ) { createDirectory ( getDirectory ( target ) , "Creating resource directory" ) ; } InputStream stream = null ; try { Tasks . setBlockingDetails ( "retrieving resource " + sourceUrl + " for copying across" ) ; stream = resource . getResourceFromUrl ( sourceUrl ) ; Tasks . setBlockingDetails ( "copying resource " + sourceUrl + " to server" ) ; return copyTo ( stream , target ) ; } catch ( Exception e ) { throw Exceptions . propagate ( e ) ; } finally { Tasks . setBlockingDetails ( null ) ; if ( stream != null ) Streams . closeQuietly ( stream ) ; } }
public int copyResource ( Map < Object , Object > sshFlags , String sourceUrl , String target , boolean createParentDir ) { if ( createParentDir ) { createDirectory ( getDirectory ( target ) , "Creating resource directory" ) ; } InputStream stream = null ; try { Tasks . setBlockingDetails ( "retrieving resource " + sourceUrl + " for copying across" ) ; stream = resource . getResourceFromUrl ( sourceUrl ) ; Tasks . setBlockingDetails ( "copying resource " + sourceUrl + " to server" ) ; LOG . debug ( "Copying " + sourceUrl + " to " + target + " on " + getLocation ( ) + " for " + getEntity ( ) ) ; return copyTo ( stream , target ) ; } catch ( Exception e ) { throw Exceptions . propagate ( e ) ; } finally { Tasks . setBlockingDetails ( null ) ; if ( stream != null ) Streams . closeQuietly ( stream ) ; } }
860
@ Test public void batchPointLookupMultiLevelTest ( ) throws Exception { if ( LOGGER . isInfoEnabled ( ) ) { } batchPointLookupTest ( 10000 , 20000 , - 1000 , 1000 ) ; }
@ Test public void batchPointLookupMultiLevelTest ( ) throws Exception { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "TESTING POINT LOOKUP CURSOR ON UNIQUE MULTI-LEVEL INDEX" ) ; } batchPointLookupTest ( 10000 , 20000 , - 1000 , 1000 ) ; }
861
public Object convert ( String value ) { if ( value == null || value . isEmpty ( ) ) { return value ; } final CSVParser parser = getCsvParser ( ) ; final Map < String , String > fields = Maps . newHashMap ( ) ; try { final String [ ] strings = parser . parseLine ( value ) ; if ( strings . length != fieldNames . length ) { return null ; } for ( int i = 0 ; i < strings . length ; i ++ ) { fields . put ( fieldNames [ i ] , strings [ i ] ) ; } } catch ( IOException e ) { LOG . error ( "Invalid CSV input, discarding input" , e ) ; return null ; } return fields ; }
public Object convert ( String value ) { if ( value == null || value . isEmpty ( ) ) { return value ; } final CSVParser parser = getCsvParser ( ) ; final Map < String , String > fields = Maps . newHashMap ( ) ; try { final String [ ] strings = parser . parseLine ( value ) ; if ( strings . length != fieldNames . length ) { LOG . error ( "Different number of columns in CSV data ({}) and configured field names ({}). Discarding input." , strings . length , fieldNames . length ) ; return null ; } for ( int i = 0 ; i < strings . length ; i ++ ) { fields . put ( fieldNames [ i ] , strings [ i ] ) ; } } catch ( IOException e ) { LOG . error ( "Invalid CSV input, discarding input" , e ) ; return null ; } return fields ; }
862
public Object convert ( String value ) { if ( value == null || value . isEmpty ( ) ) { return value ; } final CSVParser parser = getCsvParser ( ) ; final Map < String , String > fields = Maps . newHashMap ( ) ; try { final String [ ] strings = parser . parseLine ( value ) ; if ( strings . length != fieldNames . length ) { LOG . error ( "Different number of columns in CSV data ({}) and configured field names ({}). Discarding input." , strings . length , fieldNames . length ) ; return null ; } for ( int i = 0 ; i < strings . length ; i ++ ) { fields . put ( fieldNames [ i ] , strings [ i ] ) ; } } catch ( IOException e ) { return null ; } return fields ; }
public Object convert ( String value ) { if ( value == null || value . isEmpty ( ) ) { return value ; } final CSVParser parser = getCsvParser ( ) ; final Map < String , String > fields = Maps . newHashMap ( ) ; try { final String [ ] strings = parser . parseLine ( value ) ; if ( strings . length != fieldNames . length ) { LOG . error ( "Different number of columns in CSV data ({}) and configured field names ({}). Discarding input." , strings . length , fieldNames . length ) ; return null ; } for ( int i = 0 ; i < strings . length ; i ++ ) { fields . put ( fieldNames [ i ] , strings [ i ] ) ; } } catch ( IOException e ) { LOG . error ( "Invalid CSV input, discarding input" , e ) ; return null ; } return fields ; }
863
public boolean saveOrUpdateQuery ( String reportName , String frequency , String subscribers , String fileName , String queryType , String user ) { try { Map < String , Object > parameters = new HashMap < > ( ) ; parameters . put ( "reportName" , reportName ) ; List < QueryBuilderConfig > resultList = getResultList ( "FROM QueryBuilderConfig a WHERE a.reportName = :reportName" , QueryBuilderConfig . class , parameters ) ; QueryBuilderConfig queryBuilderConfig = null ; if ( ! resultList . isEmpty ( ) ) { queryBuilderConfig = resultList . get ( 0 ) ; } if ( queryBuilderConfig != null ) { queryBuilderConfig . setReportName ( reportName ) ; queryBuilderConfig . setFrequency ( frequency ) ; queryBuilderConfig . setSubscribers ( subscribers ) ; queryBuilderConfig . setQuerypath ( ConfigOptions . QUERY_DATA_PROCESSING_RESOLVED_PATH + File . separator + fileName ) ; queryBuilderConfig . setQuerytype ( queryType ) ; queryBuilderConfig . setLastModifiedDate ( Timestamp . valueOf ( LocalDateTime . now ( ) ) ) ; queryBuilderConfig . setLastUpdatedByUser ( user ) ; update ( queryBuilderConfig ) ; } else { queryBuilderConfig = new QueryBuilderConfig ( ) ; queryBuilderConfig . setReportName ( reportName ) ; queryBuilderConfig . setFrequency ( frequency ) ; queryBuilderConfig . setSubscribers ( subscribers ) ; queryBuilderConfig . setQuerypath ( ConfigOptions . QUERY_DATA_PROCESSING_RESOLVED_PATH + File . separator + fileName ) ; queryBuilderConfig . setQuerytype ( queryType ) ; queryBuilderConfig . setCreatedDate ( Timestamp . valueOf ( LocalDateTime . now ( ) ) ) ; queryBuilderConfig . setLastUpdatedByUser ( user ) ; save ( queryBuilderConfig ) ; } return true ; } catch ( Exception e ) { throw e ; } }
public boolean saveOrUpdateQuery ( String reportName , String frequency , String subscribers , String fileName , String queryType , String user ) { try { Map < String , Object > parameters = new HashMap < > ( ) ; parameters . put ( "reportName" , reportName ) ; List < QueryBuilderConfig > resultList = getResultList ( "FROM QueryBuilderConfig a WHERE a.reportName = :reportName" , QueryBuilderConfig . class , parameters ) ; QueryBuilderConfig queryBuilderConfig = null ; if ( ! resultList . isEmpty ( ) ) { queryBuilderConfig = resultList . get ( 0 ) ; } if ( queryBuilderConfig != null ) { queryBuilderConfig . setReportName ( reportName ) ; queryBuilderConfig . setFrequency ( frequency ) ; queryBuilderConfig . setSubscribers ( subscribers ) ; queryBuilderConfig . setQuerypath ( ConfigOptions . QUERY_DATA_PROCESSING_RESOLVED_PATH + File . separator + fileName ) ; queryBuilderConfig . setQuerytype ( queryType ) ; queryBuilderConfig . setLastModifiedDate ( Timestamp . valueOf ( LocalDateTime . now ( ) ) ) ; queryBuilderConfig . setLastUpdatedByUser ( user ) ; update ( queryBuilderConfig ) ; } else { queryBuilderConfig = new QueryBuilderConfig ( ) ; queryBuilderConfig . setReportName ( reportName ) ; queryBuilderConfig . setFrequency ( frequency ) ; queryBuilderConfig . setSubscribers ( subscribers ) ; queryBuilderConfig . setQuerypath ( ConfigOptions . QUERY_DATA_PROCESSING_RESOLVED_PATH + File . separator + fileName ) ; queryBuilderConfig . setQuerytype ( queryType ) ; queryBuilderConfig . setCreatedDate ( Timestamp . valueOf ( LocalDateTime . now ( ) ) ) ; queryBuilderConfig . setLastUpdatedByUser ( user ) ; save ( queryBuilderConfig ) ; } return true ; } catch ( Exception e ) { log . error ( e . getMessage ( ) ) ; throw e ; } }
864
public ClusterRead getClusterByName ( String clusterName , boolean realTime ) { ClusterEntity cluster = clusterEntityMgr . findByName ( clusterName ) ; if ( cluster == null ) { throw BddException . NOT_FOUND ( "Cluster" , clusterName ) ; } java . util . Date startTime = new java . util . Date ( ) ; if ( realTime && cluster . getStatus ( ) . isSyncServiceStatus ( ) ) { refreshClusterStatus ( clusterName ) ; } return realTime ? clusterEntityMgr . findClusterWithNodes ( clusterName , false ) : clusterEntityMgr . findClusterWithNodeGroups ( clusterName ) ; }
public ClusterRead getClusterByName ( String clusterName , boolean realTime ) { ClusterEntity cluster = clusterEntityMgr . findByName ( clusterName ) ; if ( cluster == null ) { throw BddException . NOT_FOUND ( "Cluster" , clusterName ) ; } java . util . Date startTime = new java . util . Date ( ) ; if ( realTime && cluster . getStatus ( ) . isSyncServiceStatus ( ) ) { refreshClusterStatus ( clusterName ) ; } logger . debug ( "refreshClusterStatus time: " + ( new java . util . Date ( ) . getTime ( ) - startTime . getTime ( ) ) ) ; return realTime ? clusterEntityMgr . findClusterWithNodes ( clusterName , false ) : clusterEntityMgr . findClusterWithNodeGroups ( clusterName ) ; }
865
public void rewriteFiles ( File srcDir ) throws Exception { String [ ] fileNames = FileUtil . listFiles ( srcDir + "/WEB-INF/" ) ; for ( String fileName : fileNames ) { String shortFileName = GetterUtil . getString ( FileUtil . getShortFileName ( fileName ) ) ; if ( StringUtil . equalsIgnoreCase ( shortFileName , "mule-config.xml" ) ) { continue ; } String ext = GetterUtil . getString ( FileUtil . getExtension ( fileName ) ) ; if ( ! StringUtil . equalsIgnoreCase ( ext , "xml" ) ) { continue ; } File file = new File ( srcDir + "/WEB-INF/" + fileName ) ; try { Document doc = UnsecureSAXReaderUtil . read ( file ) ; String content = doc . formattedString ( StringPool . TAB , true ) ; FileUtil . write ( file , content ) ; } catch ( Exception exception ) { if ( _log . isWarnEnabled ( ) ) { } } } }
public void rewriteFiles ( File srcDir ) throws Exception { String [ ] fileNames = FileUtil . listFiles ( srcDir + "/WEB-INF/" ) ; for ( String fileName : fileNames ) { String shortFileName = GetterUtil . getString ( FileUtil . getShortFileName ( fileName ) ) ; if ( StringUtil . equalsIgnoreCase ( shortFileName , "mule-config.xml" ) ) { continue ; } String ext = GetterUtil . getString ( FileUtil . getExtension ( fileName ) ) ; if ( ! StringUtil . equalsIgnoreCase ( ext , "xml" ) ) { continue ; } File file = new File ( srcDir + "/WEB-INF/" + fileName ) ; try { Document doc = UnsecureSAXReaderUtil . read ( file ) ; String content = doc . formattedString ( StringPool . TAB , true ) ; FileUtil . write ( file , content ) ; } catch ( Exception exception ) { if ( _log . isWarnEnabled ( ) ) { _log . warn ( StringBundler . concat ( "Unable to format " , file , ": " , exception . getMessage ( ) ) ) ; } } } }
866
@ Test ( dataProvider = "testName" , dependsOnMethods = { "create" , "update" } ) public void updateNonExistent ( String testName ) throws Exception { setupUpdateNonExistent ( ) ; CollectionSpaceClient client = this . getClientInstance ( ) ; REQUEST_TYPE multipart = createNonExistenceInstance ( client . getCommonPartName ( ) , NON_EXISTENT_ID ) ; Response res = client . update ( NON_EXISTENT_ID , multipart ) ; try { int statusCode = res . getStatus ( ) ; if ( logger . isDebugEnabled ( ) ) { } Assert . assertTrue ( testRequestType . isValidStatusCode ( statusCode ) , invalidStatusCodeMessage ( testRequestType , statusCode ) ) ; Assert . assertEquals ( statusCode , testExpectedStatusCode ) ; } finally { res . close ( ) ; } }
@ Test ( dataProvider = "testName" , dependsOnMethods = { "create" , "update" } ) public void updateNonExistent ( String testName ) throws Exception { setupUpdateNonExistent ( ) ; CollectionSpaceClient client = this . getClientInstance ( ) ; REQUEST_TYPE multipart = createNonExistenceInstance ( client . getCommonPartName ( ) , NON_EXISTENT_ID ) ; Response res = client . update ( NON_EXISTENT_ID , multipart ) ; try { int statusCode = res . getStatus ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( testName + ": status = " + statusCode ) ; } Assert . assertTrue ( testRequestType . isValidStatusCode ( statusCode ) , invalidStatusCodeMessage ( testRequestType , statusCode ) ) ; Assert . assertEquals ( statusCode , testExpectedStatusCode ) ; } finally { res . close ( ) ; } }
867
private Evaluator createEvaluator ( Conditional conditional , String value ) { Evaluator evaluator ; if ( conditional != null ) { switch ( conditional ) { case EQ : evaluator = new EqualsEvaluator ( value ) ; break ; case BETWEEN : evaluator = new BetweenEvaluator ( value ) ; break ; case GT : evaluator = new GreaterThanEvaluator ( value , false ) ; break ; case GTE : evaluator = new GreaterThanEvaluator ( value , true ) ; break ; case EMPTY : evaluator = new IsEmptyEvaluator ( value ) ; break ; case NOT_EMPTY : evaluator = new Inverse ( new IsEmptyEvaluator ( value ) ) ; break ; case LIKE : evaluator = new LikeEvaluator ( value ) ; break ; case NOT_LIKE : evaluator = new Inverse ( new LikeEvaluator ( value ) ) ; break ; case CONTAINS : evaluator = new LikeEvaluator ( "*" + value + "*" ) ; break ; case MATCHES : evaluator = new LikeEvaluator ( value , true ) ; break ; case LT : evaluator = new Inverse ( new GreaterThanEvaluator ( value , true ) ) ; break ; case LTE : evaluator = new Inverse ( new GreaterThanEvaluator ( value , false ) ) ; break ; case NEQ : evaluator = new Inverse ( new EqualsEvaluator ( value ) ) ; break ; default : evaluator = null ; break ; } } else { evaluator = null ; } return evaluator ; }
private Evaluator createEvaluator ( Conditional conditional , String value ) { Evaluator evaluator ; if ( conditional != null ) { switch ( conditional ) { case EQ : evaluator = new EqualsEvaluator ( value ) ; break ; case BETWEEN : evaluator = new BetweenEvaluator ( value ) ; break ; case GT : evaluator = new GreaterThanEvaluator ( value , false ) ; break ; case GTE : evaluator = new GreaterThanEvaluator ( value , true ) ; break ; case EMPTY : evaluator = new IsEmptyEvaluator ( value ) ; break ; case NOT_EMPTY : evaluator = new Inverse ( new IsEmptyEvaluator ( value ) ) ; break ; case LIKE : evaluator = new LikeEvaluator ( value ) ; break ; case NOT_LIKE : evaluator = new Inverse ( new LikeEvaluator ( value ) ) ; break ; case CONTAINS : evaluator = new LikeEvaluator ( "*" + value + "*" ) ; break ; case MATCHES : evaluator = new LikeEvaluator ( value , true ) ; break ; case LT : evaluator = new Inverse ( new GreaterThanEvaluator ( value , true ) ) ; break ; case LTE : evaluator = new Inverse ( new GreaterThanEvaluator ( value , false ) ) ; break ; case NEQ : evaluator = new Inverse ( new EqualsEvaluator ( value ) ) ; break ; default : LOGGER . error ( "No Evaluator Available for comparison operator " + conditional ) ; evaluator = null ; break ; } } else { evaluator = null ; } return evaluator ; }
868
public String getMsg ( ) { if ( responseMsg != null && responseMsg == "" ) { final HttpServletRequest httpRequest = ServletActionContext . getRequest ( ) ; final Enumeration < String > paramNames = httpRequest . getParameterNames ( ) ; final Map < String , String > responseMap = new HashMap < > ( 0 ) ; while ( paramNames . hasMoreElements ( ) ) { final String paramName = paramNames . nextElement ( ) ; final String paramValue = httpRequest . getParameter ( paramName ) ; if ( isNotBlank ( paramValue ) ) responseMap . put ( paramName , paramValue ) ; } responseMsg = responseMap . toString ( ) ; } return responseMsg ; }
public String getMsg ( ) { if ( responseMsg != null && responseMsg == "" ) { final HttpServletRequest httpRequest = ServletActionContext . getRequest ( ) ; final Enumeration < String > paramNames = httpRequest . getParameterNames ( ) ; final Map < String , String > responseMap = new HashMap < > ( 0 ) ; while ( paramNames . hasMoreElements ( ) ) { final String paramName = paramNames . nextElement ( ) ; final String paramValue = httpRequest . getParameter ( paramName ) ; if ( isNotBlank ( paramValue ) ) responseMap . put ( paramName , paramValue ) ; } responseMsg = responseMap . toString ( ) ; } LOGGER . debug ( "responseMsg::::::" + responseMsg ) ; return responseMsg ; }
869
private boolean isWextDriverSupported ( String ifaceName ) { if ( ! LinuxNetworkUtil . toolExists ( "iwconfig" ) ) { return false ; } boolean ret = false ; String [ ] cmd = formIwconfigCommand ( ifaceName ) ; Command command = new Command ( cmd ) ; command . setTimeout ( 60 ) ; command . setOutputStream ( new ByteArrayOutputStream ( ) ) ; CommandStatus status = this . executorService . execute ( command ) ; if ( ! status . getExitStatus ( ) . isSuccessful ( ) ) { if ( logger . isWarnEnabled ( ) ) { } return ret ; } for ( String line : new String ( ( ( ByteArrayOutputStream ) status . getOutputStream ( ) ) . toByteArray ( ) , Charsets . UTF_8 ) . split ( "\n" ) ) { if ( line . contains ( "IEEE 802.11" ) || line . contains ( "Mode:" ) || line . contains ( "Access Point:" ) ) { ret = true ; break ; } } return ret ; }
private boolean isWextDriverSupported ( String ifaceName ) { if ( ! LinuxNetworkUtil . toolExists ( "iwconfig" ) ) { return false ; } boolean ret = false ; String [ ] cmd = formIwconfigCommand ( ifaceName ) ; Command command = new Command ( cmd ) ; command . setTimeout ( 60 ) ; command . setOutputStream ( new ByteArrayOutputStream ( ) ) ; CommandStatus status = this . executorService . execute ( command ) ; if ( ! status . getExitStatus ( ) . isSuccessful ( ) ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( FAILED_TO_EXECUTE_MSG , String . join ( " " , cmd ) ) ; } return ret ; } for ( String line : new String ( ( ( ByteArrayOutputStream ) status . getOutputStream ( ) ) . toByteArray ( ) , Charsets . UTF_8 ) . split ( "\n" ) ) { if ( line . contains ( "IEEE 802.11" ) || line . contains ( "Mode:" ) || line . contains ( "Access Point:" ) ) { ret = true ; break ; } } return ret ; }
870
@ Test public void testDebug ( ) { final Logger logger = LogValidator . getSilentLogger ( ) ; final BetonQuestLogger betonQuestLogger = getBetonQuestLogger ( logger ) ; final LogValidator logValidator = LogValidator . getForLogger ( logger ) ; logValidator . assertLogEntry ( Level . FINE , LOG_MESSAGE_WITH_TOPIC ) ; logValidator . assertEmpty ( ) ; }
@ Test public void testDebug ( ) { final Logger logger = LogValidator . getSilentLogger ( ) ; final BetonQuestLogger betonQuestLogger = getBetonQuestLogger ( logger ) ; final LogValidator logValidator = LogValidator . getForLogger ( logger ) ; betonQuestLogger . debug ( mockConfigPackage ( ) , LOG_MESSAGE ) ; logValidator . assertLogEntry ( Level . FINE , LOG_MESSAGE_WITH_TOPIC ) ; logValidator . assertEmpty ( ) ; }
871
private void prepareSupportedGroups ( EllipticCurvesExtensionMessage msg ) { msg . setSupportedGroups ( createNamedGroupsArray ( ) ) ; }
private void prepareSupportedGroups ( EllipticCurvesExtensionMessage msg ) { msg . setSupportedGroups ( createNamedGroupsArray ( ) ) ; LOGGER . debug ( "SupportedGroups: " + ArrayConverter . bytesToHexString ( msg . getSupportedGroups ( ) . getValue ( ) ) ) ; }
872
private Map < String , Document > fetchFamilies ( Set < String > familySet ) { Map < String , Document > familyMap = new HashMap < > ( ) ; if ( familySet . isEmpty ( ) ) { return familyMap ; } List < Long > familyUids = new ArrayList < > ( familySet . size ( ) ) ; List < Integer > familyUidVersions = new ArrayList < > ( familySet . size ( ) ) ; for ( String familyId : familySet ) { String [ ] split = familyId . split ( UID_VERSION_SEP ) ; familyUids . add ( Long . parseLong ( split [ 0 ] ) ) ; familyUidVersions . add ( Integer . parseInt ( split [ 1 ] ) ) ; } Query query = new Query ( ) . append ( FamilyDBAdaptor . QueryParams . UID . key ( ) , familyUids ) . append ( FamilyDBAdaptor . QueryParams . VERSION . key ( ) , familyUidVersions ) ; List < Document > familyList ; try { if ( user != null ) { query . put ( FamilyDBAdaptor . QueryParams . STUDY_UID . key ( ) , studyUid ) ; familyList = familyDBAdaptor . nativeGet ( studyUid , query , familyQueryOptions , user ) . getResults ( ) ; } else { familyList = familyDBAdaptor . nativeGet ( query , familyQueryOptions ) . getResults ( ) ; } } catch ( CatalogDBException | CatalogAuthorizationException | CatalogParameterException e ) { return familyMap ; } familyList . forEach ( family -> familyMap . put ( family . get ( UID ) + UID_VERSION_SEP + family . get ( VERSION ) , family ) ) ; return familyMap ; }
private Map < String , Document > fetchFamilies ( Set < String > familySet ) { Map < String , Document > familyMap = new HashMap < > ( ) ; if ( familySet . isEmpty ( ) ) { return familyMap ; } List < Long > familyUids = new ArrayList < > ( familySet . size ( ) ) ; List < Integer > familyUidVersions = new ArrayList < > ( familySet . size ( ) ) ; for ( String familyId : familySet ) { String [ ] split = familyId . split ( UID_VERSION_SEP ) ; familyUids . add ( Long . parseLong ( split [ 0 ] ) ) ; familyUidVersions . add ( Integer . parseInt ( split [ 1 ] ) ) ; } Query query = new Query ( ) . append ( FamilyDBAdaptor . QueryParams . UID . key ( ) , familyUids ) . append ( FamilyDBAdaptor . QueryParams . VERSION . key ( ) , familyUidVersions ) ; List < Document > familyList ; try { if ( user != null ) { query . put ( FamilyDBAdaptor . QueryParams . STUDY_UID . key ( ) , studyUid ) ; familyList = familyDBAdaptor . nativeGet ( studyUid , query , familyQueryOptions , user ) . getResults ( ) ; } else { familyList = familyDBAdaptor . nativeGet ( query , familyQueryOptions ) . getResults ( ) ; } } catch ( CatalogDBException | CatalogAuthorizationException | CatalogParameterException e ) { logger . warn ( "Could not obtain the families associated to the clinical analyses: {}" , e . getMessage ( ) , e ) ; return familyMap ; } familyList . forEach ( family -> familyMap . put ( family . get ( UID ) + UID_VERSION_SEP + family . get ( VERSION ) , family ) ) ; return familyMap ; }
873
public void updateChanges ( ) { if ( dirty_position . checkAndClear ( ) ) { if ( model_widget . propVisible ( ) . getValue ( ) ) { jfx_node . setVisible ( true ) ; final int x = model_widget . propX ( ) . getValue ( ) ; final int y = model_widget . propY ( ) . getValue ( ) ; final int w = model_widget . propWidth ( ) . getValue ( ) ; final int h = model_widget . propHeight ( ) . getValue ( ) ; jfx_node . setTranslateX ( x ) ; jfx_node . setTranslateY ( y ) ; jfx_node . setPrefWidth ( w ) ; jfx_node . setPrefHeight ( h ) ; } else jfx_node . setVisible ( false ) ; } if ( dirty_resource . checkAndClear ( ) ) { JobManager . schedule ( "Read 3d viewer resource" , monitor -> { final String resource = model_widget . propResource ( ) . getValue ( ) ; InputStream inputStream = null ; try { inputStream = ResourceUtil . openResource ( resource ) ; } catch ( Exception ex ) { } if ( null != inputStream ) { try { final Xform struct = Viewer3d . buildStructure ( inputStream ) ; if ( null != struct ) Platform . runLater ( ( ) -> jfx_node . setStructure ( struct ) ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Building structure failed" , ex ) ; } } } ) ; } }
public void updateChanges ( ) { if ( dirty_position . checkAndClear ( ) ) { if ( model_widget . propVisible ( ) . getValue ( ) ) { jfx_node . setVisible ( true ) ; final int x = model_widget . propX ( ) . getValue ( ) ; final int y = model_widget . propY ( ) . getValue ( ) ; final int w = model_widget . propWidth ( ) . getValue ( ) ; final int h = model_widget . propHeight ( ) . getValue ( ) ; jfx_node . setTranslateX ( x ) ; jfx_node . setTranslateY ( y ) ; jfx_node . setPrefWidth ( w ) ; jfx_node . setPrefHeight ( h ) ; } else jfx_node . setVisible ( false ) ; } if ( dirty_resource . checkAndClear ( ) ) { JobManager . schedule ( "Read 3d viewer resource" , monitor -> { final String resource = model_widget . propResource ( ) . getValue ( ) ; InputStream inputStream = null ; try { inputStream = ResourceUtil . openResource ( resource ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Opening resource '" + resource + "' failed" , ex ) ; } if ( null != inputStream ) { try { final Xform struct = Viewer3d . buildStructure ( inputStream ) ; if ( null != struct ) Platform . runLater ( ( ) -> jfx_node . setStructure ( struct ) ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Building structure failed" , ex ) ; } } } ) ; } }
874
public void updateChanges ( ) { if ( dirty_position . checkAndClear ( ) ) { if ( model_widget . propVisible ( ) . getValue ( ) ) { jfx_node . setVisible ( true ) ; final int x = model_widget . propX ( ) . getValue ( ) ; final int y = model_widget . propY ( ) . getValue ( ) ; final int w = model_widget . propWidth ( ) . getValue ( ) ; final int h = model_widget . propHeight ( ) . getValue ( ) ; jfx_node . setTranslateX ( x ) ; jfx_node . setTranslateY ( y ) ; jfx_node . setPrefWidth ( w ) ; jfx_node . setPrefHeight ( h ) ; } else jfx_node . setVisible ( false ) ; } if ( dirty_resource . checkAndClear ( ) ) { JobManager . schedule ( "Read 3d viewer resource" , monitor -> { final String resource = model_widget . propResource ( ) . getValue ( ) ; InputStream inputStream = null ; try { inputStream = ResourceUtil . openResource ( resource ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Opening resource '" + resource + "' failed" , ex ) ; } if ( null != inputStream ) { try { final Xform struct = Viewer3d . buildStructure ( inputStream ) ; if ( null != struct ) Platform . runLater ( ( ) -> jfx_node . setStructure ( struct ) ) ; } catch ( Exception ex ) { } } } ) ; } }
public void updateChanges ( ) { if ( dirty_position . checkAndClear ( ) ) { if ( model_widget . propVisible ( ) . getValue ( ) ) { jfx_node . setVisible ( true ) ; final int x = model_widget . propX ( ) . getValue ( ) ; final int y = model_widget . propY ( ) . getValue ( ) ; final int w = model_widget . propWidth ( ) . getValue ( ) ; final int h = model_widget . propHeight ( ) . getValue ( ) ; jfx_node . setTranslateX ( x ) ; jfx_node . setTranslateY ( y ) ; jfx_node . setPrefWidth ( w ) ; jfx_node . setPrefHeight ( h ) ; } else jfx_node . setVisible ( false ) ; } if ( dirty_resource . checkAndClear ( ) ) { JobManager . schedule ( "Read 3d viewer resource" , monitor -> { final String resource = model_widget . propResource ( ) . getValue ( ) ; InputStream inputStream = null ; try { inputStream = ResourceUtil . openResource ( resource ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Opening resource '" + resource + "' failed" , ex ) ; } if ( null != inputStream ) { try { final Xform struct = Viewer3d . buildStructure ( inputStream ) ; if ( null != struct ) Platform . runLater ( ( ) -> jfx_node . setStructure ( struct ) ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "Building structure failed" , ex ) ; } } } ) ; } }
875
@ Test public void justRun ( ) { Set < Bundle > bundles = new TreeSet < > ( ( b1 , b2 ) -> ( int ) ( b1 . getBundleId ( ) - b2 . getBundleId ( ) ) ) ; bundles . addAll ( Arrays . asList ( context . getBundles ( ) ) ) ; for ( Bundle b : bundles ) { String info = String . format ( "#%d: %s (%s)" , b . getBundleId ( ) , b . getSymbolicName ( ) , b . getLocation ( ) ) ; } }
@ Test public void justRun ( ) { Set < Bundle > bundles = new TreeSet < > ( ( b1 , b2 ) -> ( int ) ( b1 . getBundleId ( ) - b2 . getBundleId ( ) ) ) ; bundles . addAll ( Arrays . asList ( context . getBundles ( ) ) ) ; for ( Bundle b : bundles ) { String info = String . format ( "#%d: %s (%s)" , b . getBundleId ( ) , b . getSymbolicName ( ) , b . getLocation ( ) ) ; LOG . info ( info ) ; } }
876
public void createBuildFiles ( String location , String [ ] serviceTypes ) { try { location = createWorkDirectory ( location ) ; createPom ( location , serviceTypes ) ; } catch ( Exception e ) { } }
public void createBuildFiles ( String location , String [ ] serviceTypes ) { try { location = createWorkDirectory ( location ) ; createPom ( location , serviceTypes ) ; } catch ( Exception e ) { log . error ( "could not generate build files" , e ) ; } }
877
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { LOGGER . info ( "Resource {} resolved as {} (base: {})" , url , path , previousBase ) ; return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Candidate resource {} from {} url not found (base: {})" , path , url , previousBase ) ; } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Trying paths {} for resource {} (base: {})" , paths . stream ( ) . collect ( Collectors . joining ( ", " ) ) , url , previousBase ) ; } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { LOGGER . info ( "Resource {} resolved as {} (base: {})" , url , path , previousBase ) ; return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Candidate resource {} from {} url not found (base: {})" , path , url , previousBase ) ; } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
878
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Trying paths {} for resource {} (base: {})" , paths . stream ( ) . collect ( Collectors . joining ( ", " ) ) , url , previousBase ) ; } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Candidate resource {} from {} url not found (base: {})" , path , url , previousBase ) ; } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Trying paths {} for resource {} (base: {})" , paths . stream ( ) . collect ( Collectors . joining ( ", " ) ) , url , previousBase ) ; } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { LOGGER . info ( "Resource {} resolved as {} (base: {})" , url , path , previousBase ) ; return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Candidate resource {} from {} url not found (base: {})" , path , url , previousBase ) ; } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
879
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Trying paths {} for resource {} (base: {})" , paths . stream ( ) . collect ( Collectors . joining ( ", " ) ) , url , previousBase ) ; } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { LOGGER . info ( "Resource {} resolved as {} (base: {})" , url , path , previousBase ) ; return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
public Import getInputSource ( String url , final URI previousBase ) { url = resolveScope ( url ) ; try { final String basePath = FilenameUtils . getPath ( url ) ; final List < String > filenameCandidates = listCandidateFilenames ( url ) ; final List < String > paths = listCandidatePaths ( basePath , filenameCandidates ) ; if ( url . startsWith ( "/" ) ) { throw new IllegalArgumentException ( String . format ( "Absolute url %s is not allowed for @import" , url ) ) ; } else if ( url . startsWith ( "../../../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } else if ( ! url . startsWith ( "../" ) && url . contains ( "../" ) ) { throw new IllegalArgumentException ( String . format ( "More than 3 level relative loading of %s is not allowed for @import" , url ) ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Trying paths {} for resource {} (base: {})" , paths . stream ( ) . collect ( Collectors . joining ( ", " ) ) , url , previousBase ) ; } for ( String path : paths ) { Import resource = resolveCandidate ( path , previousBase ) ; if ( resource != null ) { LOGGER . info ( "Resource {} resolved as {} (base: {})" , url , path , previousBase ) ; return resource ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Candidate resource {} from {} url not found (base: {})" , path , url , previousBase ) ; } } throw new IllegalArgumentException ( String . format ( "File '%s' not imported because it could not be found (candidates: %s)" , url , paths . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( "Invalid URI syntax for '%s' from path '%s'" , url , previousBase ) ) ; } }
880
public Collection < Worker > markWorkersLazy ( Predicate < ImmutableWorkerInfo > isLazyWorker , int maxWorkers ) { synchronized ( statusLock ) { for ( Map . Entry < String , WorkerHolder > worker : workers . entrySet ( ) ) { final WorkerHolder workerHolder = worker . getValue ( ) ; try { if ( isWorkerOkForMarkingLazy ( workerHolder . getWorker ( ) ) && isLazyWorker . apply ( workerHolder . toImmutable ( ) ) ) { lazyWorkers . put ( worker . getKey ( ) , workerHolder ) ; if ( lazyWorkers . size ( ) == maxWorkers ) { break ; } } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } return getLazyWorkers ( ) ; } }
public Collection < Worker > markWorkersLazy ( Predicate < ImmutableWorkerInfo > isLazyWorker , int maxWorkers ) { synchronized ( statusLock ) { for ( Map . Entry < String , WorkerHolder > worker : workers . entrySet ( ) ) { final WorkerHolder workerHolder = worker . getValue ( ) ; try { if ( isWorkerOkForMarkingLazy ( workerHolder . getWorker ( ) ) && isLazyWorker . apply ( workerHolder . toImmutable ( ) ) ) { log . info ( "Adding Worker[%s] to lazySet!" , workerHolder . getWorker ( ) . getHost ( ) ) ; lazyWorkers . put ( worker . getKey ( ) , workerHolder ) ; if ( lazyWorkers . size ( ) == maxWorkers ) { break ; } } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } return getLazyWorkers ( ) ; } }
881
private void handleStyleChange ( PreferenceChangeEvent event ) { try { Object value = event . getValueAsObject ( null ) ; if ( value instanceof StyleManagerConfig ) { StyleManagerConfig config = ( StyleManagerConfig ) value ; Set < Map . Entry < String , DataTypeStyleConfig > > entrySet ; synchronized ( myTypeKeysAndStyles ) { entrySet = New . set ( myTypeKeysAndStyles . entrySet ( ) ) ; } for ( Map . Entry < String , DataTypeStyleConfig > entry : entrySet ) { String dataTypeKey = entry . getKey ( ) ; DataTypeStyleConfig oldConfig = entry . getValue ( ) ; DataTypeStyleConfig newConfig = config . getDataTypeStyleByTypeKey ( dataTypeKey ) ; if ( ! Objects . equals ( newConfig , oldConfig ) ) { handleModelChange ( dataTypeKey ) ; } } } } catch ( JAXBException e ) { } }
private void handleStyleChange ( PreferenceChangeEvent event ) { try { Object value = event . getValueAsObject ( null ) ; if ( value instanceof StyleManagerConfig ) { StyleManagerConfig config = ( StyleManagerConfig ) value ; Set < Map . Entry < String , DataTypeStyleConfig > > entrySet ; synchronized ( myTypeKeysAndStyles ) { entrySet = New . set ( myTypeKeysAndStyles . entrySet ( ) ) ; } for ( Map . Entry < String , DataTypeStyleConfig > entry : entrySet ) { String dataTypeKey = entry . getKey ( ) ; DataTypeStyleConfig oldConfig = entry . getValue ( ) ; DataTypeStyleConfig newConfig = config . getDataTypeStyleByTypeKey ( dataTypeKey ) ; if ( ! Objects . equals ( newConfig , oldConfig ) ) { handleModelChange ( dataTypeKey ) ; } } } } catch ( JAXBException e ) { LOGGER . error ( e , e ) ; } }
882
private void checkTransformSymmetry ( byte [ ] keyBytes , byte [ ] iv , byte [ ] plaintext ) throws Exception { Configuration conf = HBaseConfiguration . create ( ) ; String algorithm = conf . get ( HConstants . CRYPTO_KEY_ALGORITHM_CONF_KEY , HConstants . CIPHER_AES ) ; Cipher aes = Encryption . getCipher ( conf , algorithm ) ; Key key = new SecretKeySpec ( keyBytes , algorithm ) ; Encryptor e = aes . getEncryptor ( ) ; e . setKey ( key ) ; e . setIv ( iv ) ; e . reset ( ) ; ByteArrayOutputStream encOut = new ByteArrayOutputStream ( ) ; Encryption . encrypt ( encOut , plaintext , 0 , plaintext . length , e ) ; byte [ ] encrypted = encOut . toByteArray ( ) ; Decryptor d = aes . getDecryptor ( ) ; d . setKey ( key ) ; d . setIv ( iv ) ; d . reset ( ) ; ByteArrayInputStream encIn = new ByteArrayInputStream ( encrypted ) ; ByteArrayOutputStream decOut = new ByteArrayOutputStream ( ) ; Encryption . decrypt ( decOut , encIn , plaintext . length , d ) ; byte [ ] result = decOut . toByteArray ( ) ; assertEquals ( "Decrypted result has different length than plaintext" , result . length , plaintext . length ) ; assertTrue ( "Transformation was not symmetric" , Bytes . equals ( result , plaintext ) ) ; }
private void checkTransformSymmetry ( byte [ ] keyBytes , byte [ ] iv , byte [ ] plaintext ) throws Exception { LOG . info ( "checkTransformSymmetry: AES, plaintext length = " + plaintext . length ) ; Configuration conf = HBaseConfiguration . create ( ) ; String algorithm = conf . get ( HConstants . CRYPTO_KEY_ALGORITHM_CONF_KEY , HConstants . CIPHER_AES ) ; Cipher aes = Encryption . getCipher ( conf , algorithm ) ; Key key = new SecretKeySpec ( keyBytes , algorithm ) ; Encryptor e = aes . getEncryptor ( ) ; e . setKey ( key ) ; e . setIv ( iv ) ; e . reset ( ) ; ByteArrayOutputStream encOut = new ByteArrayOutputStream ( ) ; Encryption . encrypt ( encOut , plaintext , 0 , plaintext . length , e ) ; byte [ ] encrypted = encOut . toByteArray ( ) ; Decryptor d = aes . getDecryptor ( ) ; d . setKey ( key ) ; d . setIv ( iv ) ; d . reset ( ) ; ByteArrayInputStream encIn = new ByteArrayInputStream ( encrypted ) ; ByteArrayOutputStream decOut = new ByteArrayOutputStream ( ) ; Encryption . decrypt ( decOut , encIn , plaintext . length , d ) ; byte [ ] result = decOut . toByteArray ( ) ; assertEquals ( "Decrypted result has different length than plaintext" , result . length , plaintext . length ) ; assertTrue ( "Transformation was not symmetric" , Bytes . equals ( result , plaintext ) ) ; }
883
protected boolean onConnectionException ( ConnectionException e , long nextDelayMs ) { if ( logger . isDebugEnabled ( ) ) return true ; }
protected boolean onConnectionException ( ConnectionException e , long nextDelayMs ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Failed reconnection to {} ({}), scheduling retry in {} milliseconds" , host , e . getMessage ( ) , nextDelayMs ) ; return true ; }
884
public AccessControlPolicy [ ] getEffectivePolicies ( Path absPath , CompiledPermissions permissions ) throws ItemNotFoundException , RepositoryException { checkInitialized ( ) ; NodeImpl targetNode ; List < AccessControlList > acls = new ArrayList < AccessControlList > ( ) ; if ( absPath == null ) { targetNode = ( NodeImpl ) session . getRootNode ( ) ; if ( isRepoAccessControlled ( targetNode ) ) { if ( permissions . grants ( targetNode . getPrimaryPath ( ) , Permission . READ_AC ) ) { acls . add ( getACL ( targetNode , N_REPO_POLICY , null ) ) ; } else { throw new AccessDeniedException ( "Access denied at " + targetNode . getPath ( ) ) ; } } } else { targetNode = ( NodeImpl ) session . getNode ( session . getJCRPath ( absPath ) ) ; NodeImpl node = getNode ( targetNode , isAcItem ( targetNode ) ) ; collectAcls ( node , permissions , acls ) ; } if ( acls . isEmpty ( ) ) { } return acls . toArray ( new AccessControlList [ acls . size ( ) ] ) ; }
public AccessControlPolicy [ ] getEffectivePolicies ( Path absPath , CompiledPermissions permissions ) throws ItemNotFoundException , RepositoryException { checkInitialized ( ) ; NodeImpl targetNode ; List < AccessControlList > acls = new ArrayList < AccessControlList > ( ) ; if ( absPath == null ) { targetNode = ( NodeImpl ) session . getRootNode ( ) ; if ( isRepoAccessControlled ( targetNode ) ) { if ( permissions . grants ( targetNode . getPrimaryPath ( ) , Permission . READ_AC ) ) { acls . add ( getACL ( targetNode , N_REPO_POLICY , null ) ) ; } else { throw new AccessDeniedException ( "Access denied at " + targetNode . getPath ( ) ) ; } } } else { targetNode = ( NodeImpl ) session . getNode ( session . getJCRPath ( absPath ) ) ; NodeImpl node = getNode ( targetNode , isAcItem ( targetNode ) ) ; collectAcls ( node , permissions , acls ) ; } if ( acls . isEmpty ( ) ) { log . warn ( "No access controlled node present in item hierarchy starting from " + targetNode . getPath ( ) ) ; } return acls . toArray ( new AccessControlList [ acls . size ( ) ] ) ; }
885
public Map < String , List < String > > getTableToBrokersMap ( ) { Map < String , Set < String > > brokerUrlsMap = new HashMap < > ( ) ; try { byte [ ] brokerResourceNodeData = zkClient . readData ( "/EXTERNALVIEW/brokerResource" , true ) ; brokerResourceNodeData = unpackZnodeIfNecessary ( brokerResourceNodeData ) ; JsonNode jsonObject = OBJECT_READER . readTree ( getInputStream ( brokerResourceNodeData ) ) ; JsonNode brokerResourceNode = jsonObject . get ( "mapFields" ) ; Iterator < Entry < String , JsonNode > > resourceEntries = brokerResourceNode . fields ( ) ; while ( resourceEntries . hasNext ( ) ) { Entry < String , JsonNode > resourceEntry = resourceEntries . next ( ) ; String resourceName = resourceEntry . getKey ( ) ; String tableName = resourceName . replace ( OFFLINE_SUFFIX , "" ) . replace ( REALTIME_SUFFIX , "" ) ; Set < String > brokerUrls = brokerUrlsMap . computeIfAbsent ( tableName , k -> new HashSet < > ( ) ) ; JsonNode resource = resourceEntry . getValue ( ) ; Iterator < Entry < String , JsonNode > > brokerEntries = resource . fields ( ) ; while ( brokerEntries . hasNext ( ) ) { Entry < String , JsonNode > brokerEntry = brokerEntries . next ( ) ; String brokerName = brokerEntry . getKey ( ) ; if ( brokerName . startsWith ( "Broker_" ) && "ONLINE" . equals ( brokerEntry . getValue ( ) . asText ( ) ) ) { String brokerHostPort = brokerName . replace ( "Broker_" , "" ) . replace ( "_" , ":" ) ; brokerUrls . add ( brokerHostPort ) ; } } } } catch ( Exception e ) { } Map < String , List < String > > tableToBrokersMap = new HashMap < > ( ) ; for ( Entry < String , Set < String > > entry : brokerUrlsMap . entrySet ( ) ) { tableToBrokersMap . put ( entry . getKey ( ) , new ArrayList < > ( entry . getValue ( ) ) ) ; } return tableToBrokersMap ; }
public Map < String , List < String > > getTableToBrokersMap ( ) { Map < String , Set < String > > brokerUrlsMap = new HashMap < > ( ) ; try { byte [ ] brokerResourceNodeData = zkClient . readData ( "/EXTERNALVIEW/brokerResource" , true ) ; brokerResourceNodeData = unpackZnodeIfNecessary ( brokerResourceNodeData ) ; JsonNode jsonObject = OBJECT_READER . readTree ( getInputStream ( brokerResourceNodeData ) ) ; JsonNode brokerResourceNode = jsonObject . get ( "mapFields" ) ; Iterator < Entry < String , JsonNode > > resourceEntries = brokerResourceNode . fields ( ) ; while ( resourceEntries . hasNext ( ) ) { Entry < String , JsonNode > resourceEntry = resourceEntries . next ( ) ; String resourceName = resourceEntry . getKey ( ) ; String tableName = resourceName . replace ( OFFLINE_SUFFIX , "" ) . replace ( REALTIME_SUFFIX , "" ) ; Set < String > brokerUrls = brokerUrlsMap . computeIfAbsent ( tableName , k -> new HashSet < > ( ) ) ; JsonNode resource = resourceEntry . getValue ( ) ; Iterator < Entry < String , JsonNode > > brokerEntries = resource . fields ( ) ; while ( brokerEntries . hasNext ( ) ) { Entry < String , JsonNode > brokerEntry = brokerEntries . next ( ) ; String brokerName = brokerEntry . getKey ( ) ; if ( brokerName . startsWith ( "Broker_" ) && "ONLINE" . equals ( brokerEntry . getValue ( ) . asText ( ) ) ) { String brokerHostPort = brokerName . replace ( "Broker_" , "" ) . replace ( "_" , ":" ) ; brokerUrls . add ( brokerHostPort ) ; } } } } catch ( Exception e ) { LOGGER . warn ( "Exception while reading External view from zookeeper" , e ) ; } Map < String , List < String > > tableToBrokersMap = new HashMap < > ( ) ; for ( Entry < String , Set < String > > entry : brokerUrlsMap . entrySet ( ) ) { tableToBrokersMap . put ( entry . getKey ( ) , new ArrayList < > ( entry . getValue ( ) ) ) ; } return tableToBrokersMap ; }
886
@ Deprecated public static void deleteCommerceShipment ( long commerceShipmentId ) throws RemoteException { try { CommerceShipmentServiceUtil . deleteCommerceShipment ( commerceShipmentId ) ; } catch ( Exception exception ) { throw new RemoteException ( exception . getMessage ( ) ) ; } }
@ Deprecated public static void deleteCommerceShipment ( long commerceShipmentId ) throws RemoteException { try { CommerceShipmentServiceUtil . deleteCommerceShipment ( commerceShipmentId ) ; } catch ( Exception exception ) { _log . error ( exception , exception ) ; throw new RemoteException ( exception . getMessage ( ) ) ; } }
887
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { logger . error ( new StatisticYearEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { logger . error ( new StatisticMonthEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { logger . error ( new UnitNamesEmptyException ( ) ) ; return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { logger . error ( new StatisticYearEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { logger . error ( new StatisticMonthEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
888
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { logger . error ( new UnitNamesEmptyException ( ) ) ; return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { logger . error ( new StatisticMonthEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { logger . error ( new UnitNamesEmptyException ( ) ) ; return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { logger . error ( new StatisticYearEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { logger . error ( new StatisticMonthEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
889
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { logger . error ( new UnitNamesEmptyException ( ) ) ; return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { logger . error ( new StatisticYearEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
public Long sumLateCountByTopUnitNamesYearAndMonth ( List < String > unitName , String sYear , String sMonth ) throws Exception { if ( unitName == null || unitName . size ( ) == 0 ) { logger . error ( new UnitNamesEmptyException ( ) ) ; return null ; } EntityManager em = this . entityManagerContainer ( ) . get ( StatisticUnitForMonth . class ) ; CriteriaBuilder cb = em . getCriteriaBuilder ( ) ; CriteriaQuery < Long > cq = cb . createQuery ( Long . class ) ; Root < StatisticUnitForMonth > root = cq . from ( StatisticUnitForMonth . class ) ; cq . select ( cb . sum ( root . get ( StatisticUnitForMonth_ . lateCount ) ) ) ; Predicate p = root . get ( StatisticUnitForMonth_ . unitName ) . in ( unitName ) ; if ( sYear == null || sYear . isEmpty ( ) ) { logger . error ( new StatisticYearEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticYear ) , sYear ) ) ; } if ( sMonth == null || sMonth . isEmpty ( ) ) { logger . error ( new StatisticMonthEmptyException ( ) ) ; } else { p = cb . and ( p , cb . equal ( root . get ( StatisticUnitForMonth_ . statisticMonth ) , sMonth ) ) ; } return em . createQuery ( cq . where ( p ) ) . getSingleResult ( ) ; }
890
public Long decrementCounter ( String name , long decrement ) { Long value = null ; synchronized ( metrics ) { if ( ! metrics . hasKey ( name ) ) { value = Long . valueOf ( decrement ) ; set ( name , - value ) ; } else { try { value = ( ( Long ) get ( name ) ) - decrement ; set ( name , value ) ; } catch ( JMException e ) { } } } return value ; }
public Long decrementCounter ( String name , long decrement ) { Long value = null ; synchronized ( metrics ) { if ( ! metrics . hasKey ( name ) ) { value = Long . valueOf ( decrement ) ; set ( name , - value ) ; } else { try { value = ( ( Long ) get ( name ) ) - decrement ; set ( name , value ) ; } catch ( JMException e ) { LOG . warn ( "Could not find counter value for " + name + ", decrement operation skipped." , e ) ; } } } return value ; }
891
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
892
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
893
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
894
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { } return createdClass ; }
@ SuppressWarnings ( "unchecked" ) public < C > C createAndInitialize ( final Class < C > c , final String className , final Configuration configuration ) { C createdClass = null ; try { final Class < ? > clazz = Class . forName ( className ) ; if ( c . isAssignableFrom ( clazz ) ) { createdClass = ( C ) clazz . getConstructor ( Configuration . class ) . newInstance ( configuration . flatten ( ) ) ; } else { LOGGER . error ( "Class '{}' has to implement '{}'" , className , c . getSimpleName ( ) ) ; } } catch ( final ClassNotFoundException e ) { LOGGER . error ( "{}: Class '{}' not found" , c . getSimpleName ( ) , className , e ) ; } catch ( final NoSuchMethodException e ) { LOGGER . error ( "{}: Class '{}' has to implement a (public) constructor that accepts a single Configuration" , c . getSimpleName ( ) , className , e ) ; } catch ( final Exception e ) { LOGGER . error ( "{}: Failed to load class for name '{}'" , c . getSimpleName ( ) , className , e ) ; } return createdClass ; }
895
public static com . liferay . portal . kernel . repository . model . FileEntry movePageAttachmentToTrash ( HttpPrincipal httpPrincipal , long nodeId , String title , String fileName ) throws com . liferay . portal . kernel . exception . PortalException { try { MethodKey methodKey = new MethodKey ( WikiPageServiceUtil . class , "movePageAttachmentToTrash" , _movePageAttachmentToTrashParameterTypes38 ) ; MethodHandler methodHandler = new MethodHandler ( methodKey , nodeId , title , fileName ) ; Object returnObj = null ; try { returnObj = TunnelUtil . invoke ( httpPrincipal , methodHandler ) ; } catch ( Exception exception ) { if ( exception instanceof com . liferay . portal . kernel . exception . PortalException ) { throw ( com . liferay . portal . kernel . exception . PortalException ) exception ; } throw new com . liferay . portal . kernel . exception . SystemException ( exception ) ; } return ( com . liferay . portal . kernel . repository . model . FileEntry ) returnObj ; } catch ( com . liferay . portal . kernel . exception . SystemException systemException ) { throw systemException ; } }
public static com . liferay . portal . kernel . repository . model . FileEntry movePageAttachmentToTrash ( HttpPrincipal httpPrincipal , long nodeId , String title , String fileName ) throws com . liferay . portal . kernel . exception . PortalException { try { MethodKey methodKey = new MethodKey ( WikiPageServiceUtil . class , "movePageAttachmentToTrash" , _movePageAttachmentToTrashParameterTypes38 ) ; MethodHandler methodHandler = new MethodHandler ( methodKey , nodeId , title , fileName ) ; Object returnObj = null ; try { returnObj = TunnelUtil . invoke ( httpPrincipal , methodHandler ) ; } catch ( Exception exception ) { if ( exception instanceof com . liferay . portal . kernel . exception . PortalException ) { throw ( com . liferay . portal . kernel . exception . PortalException ) exception ; } throw new com . liferay . portal . kernel . exception . SystemException ( exception ) ; } return ( com . liferay . portal . kernel . repository . model . FileEntry ) returnObj ; } catch ( com . liferay . portal . kernel . exception . SystemException systemException ) { _log . error ( systemException , systemException ) ; throw systemException ; } }
896
@ SuppressWarnings ( "unchecked" ) private void initTxMgr ( String txFactoryClassName ) { try { Class < ? > txFactClass = getClass ( ) . getClassLoader ( ) . loadClass ( txFactoryClassName ) ; Object txFact = txFactClass . newInstance ( ) ; _txMgr = ( TransactionManager ) txFactClass . getMethod ( "getTransactionManager" , ( Class [ ] ) null ) . invoke ( txFact ) ; } catch ( Exception e ) { __log . error ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; throw new RuntimeException ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; } }
@ SuppressWarnings ( "unchecked" ) private void initTxMgr ( String txFactoryClassName ) { __log . info ( "ProcessStore initializing transaction manager using " + txFactoryClassName ) ; try { Class < ? > txFactClass = getClass ( ) . getClassLoader ( ) . loadClass ( txFactoryClassName ) ; Object txFact = txFactClass . newInstance ( ) ; _txMgr = ( TransactionManager ) txFactClass . getMethod ( "getTransactionManager" , ( Class [ ] ) null ) . invoke ( txFact ) ; } catch ( Exception e ) { __log . error ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; throw new RuntimeException ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; } }
897
@ SuppressWarnings ( "unchecked" ) private void initTxMgr ( String txFactoryClassName ) { __log . info ( "ProcessStore initializing transaction manager using " + txFactoryClassName ) ; try { Class < ? > txFactClass = getClass ( ) . getClassLoader ( ) . loadClass ( txFactoryClassName ) ; Object txFact = txFactClass . newInstance ( ) ; _txMgr = ( TransactionManager ) txFactClass . getMethod ( "getTransactionManager" , ( Class [ ] ) null ) . invoke ( txFact ) ; } catch ( Exception e ) { throw new RuntimeException ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; } }
@ SuppressWarnings ( "unchecked" ) private void initTxMgr ( String txFactoryClassName ) { __log . info ( "ProcessStore initializing transaction manager using " + txFactoryClassName ) ; try { Class < ? > txFactClass = getClass ( ) . getClassLoader ( ) . loadClass ( txFactoryClassName ) ; Object txFact = txFactClass . newInstance ( ) ; _txMgr = ( TransactionManager ) txFactClass . getMethod ( "getTransactionManager" , ( Class [ ] ) null ) . invoke ( txFact ) ; } catch ( Exception e ) { __log . error ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; throw new RuntimeException ( "Couldn't initialize a transaction manager with factory: " + txFactoryClassName , e ) ; } }
898
protected boolean isRemainingTimeSufficient ( int remainingSeconds ) { if ( remainingSeconds <= MIN_REMAINING_TIME_FOR_RETRY_SECONDS ) { return false ; } return true ; }
protected boolean isRemainingTimeSufficient ( int remainingSeconds ) { if ( remainingSeconds <= MIN_REMAINING_TIME_FOR_RETRY_SECONDS ) { logger . warn ( "{} No time left to execute query '{}' s" , traceItem , remainingSeconds ) ; return false ; } return true ; }
899
public String getGLCode ( final String detailName , final String detailKey , final Connection con ) throws TaskFailedException { String code = "" ; try { final String str = "select glcode as \"code\" from chartofaccounts,bankaccount where bankaccount.glcodeid=chartofaccounts.id and bankaccount.id= ?" ; final PreparedStatement pst = con . prepareStatement ( str ) ; pst . setString ( 0 , detailKey ) ; final ResultSet resultset = pst . executeQuery ( ) ; if ( resultset . next ( ) ) code = resultset . getString ( "code" ) ; } catch ( final Exception e ) { } return code ; }
public String getGLCode ( final String detailName , final String detailKey , final Connection con ) throws TaskFailedException { String code = "" ; try { final String str = "select glcode as \"code\" from chartofaccounts,bankaccount where bankaccount.glcodeid=chartofaccounts.id and bankaccount.id= ?" ; final PreparedStatement pst = con . prepareStatement ( str ) ; pst . setString ( 0 , detailKey ) ; final ResultSet resultset = pst . executeQuery ( ) ; if ( resultset . next ( ) ) code = resultset . getString ( "code" ) ; } catch ( final Exception e ) { LOGGER . error ( "error" + e . toString ( ) , e ) ; } return code ; }