idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
39,200
public static String objectToString ( Object value ) { if ( value == null ) { return null ; } if ( value instanceof String ) { return ( String ) value ; } if ( value instanceof String [ ] ) { return StringUtils . join ( encodeString ( ( String [ ] ) value ) , ARRAY_DELIMITER ) ; } else if ( value instanceof Integer ) {...
Converts a typed value to it s string representation .
39,201
public ParameterBuilder < T > defaultOsgiConfigProperty ( String value ) { if ( value == null || ! OSGI_CONFIG_PROPERTY_PATTERN . matcher ( value ) . matches ( ) ) { throw new IllegalArgumentException ( "Invalid value: " + value ) ; } this . defaultOsgiConfigProperty = value ; return this ; }
References OSGi configuration property which is checked for default value if this parameter is not set in any configuration .
39,202
public ParameterBuilder < T > properties ( Map < String , Object > map ) { if ( map == null ) { throw new IllegalArgumentException ( "Map argument must not be null." ) ; } this . properties . putAll ( map ) ; return this ; }
Further properties for documentation and configuration of behavior in configuration editor .
39,203
public ParameterBuilder < T > property ( String key , Object value ) { if ( key == null ) { throw new IllegalArgumentException ( "Key argument must not be null." ) ; } this . properties . put ( key , value ) ; return this ; }
Further property for documentation and configuration of behavior in configuration editor .
39,204
@ SuppressWarnings ( "unchecked" ) public synchronized < T > Evaluator < T > createEvaluator ( String source , ClassType projection , String [ ] names , Type [ ] types , Class < ? > [ ] classes , Map < String , Object > constants ) { try { final String id = toId ( source , projection . getJavaClass ( ) , types , consta...
Create a new Evaluator instance
39,205
public void cleanQueueJob ( ) { try { Set < Long > ids = queueCleanerService . getFinishedExecStateIds ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Will clean from queue the next Exec state ids amount:" + ids . size ( ) ) ; Set < Long > execIds = new HashSet < > ( ) ; for ( Long id : ids ) { execIds . add...
Job that will handle the cleaning of queue table .
39,206
public void joinFinishedSplitsJob ( ) { try { if ( logger . isDebugEnabled ( ) ) logger . debug ( "SplitJoinJob woke up at " + new Date ( ) ) ; StopWatch stopWatch = new StopWatch ( ) ; stopWatch . start ( ) ; boolean moreToJoin = true ; for ( int i = 0 ; i < SPLIT_JOIN_ITERATIONS && moreToJoin ; i ++ ) { int joinedSpl...
Job that will handle the joining of finished branches .
39,207
public void executionRecoveryJob ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "ExecutionRecoveryJob woke up at " + new Date ( ) ) ; } try { executionRecoveryService . doRecovery ( ) ; } catch ( Exception e ) { logger . error ( "Can't run queue recovery job." , e ) ; } }
Job to execute the recovery check .
39,208
private void cancelPausedRun ( ExecutionState executionStateToCancel ) { final List < ExecutionState > branches = executionStateService . readByExecutionId ( executionStateToCancel . getExecutionId ( ) ) ; if ( branches . size ( ) > 1 ) { for ( ExecutionState branch : branches ) { if ( ! EMPTY_BRANCH . equals ( branch ...
If it doesn t - just cancel it straight away - extract the Run Object set its context accordingly and put into the queue .
39,209
private boolean isBranch ( Execution execution ) { return execution != null && ! StringUtils . isEmpty ( execution . getSystemContext ( ) . getBranchId ( ) ) ; }
Returns true when the execution is a branch with the new branch mechanism It will return true for executions of parallel multi - instance sub - flows and non blocking
39,210
public void doRecovery ( ) { try { synchronized ( this ) { executorService . shutdownNow ( ) ; threadPoolVersion ++ ; logger . warn ( "Worker is in doRecovery(). Cleaning state and cancelling running tasks. It may take up to 30 seconds..." ) ; } boolean finished = executorService . awaitTermination ( 30 , TimeUnit . SE...
Must clean the buffer that holds Runnables that wait for execution and also drop all the executions that currently run
39,211
public PythonExecutionResult exec ( String script , Map < String , Serializable > callArguments ) { checkValidInterpreter ( ) ; initInterpreter ( ) ; prepareInterpreterContext ( callArguments ) ; Exception originException = null ; for ( int i = 0 ; i < RETRIES_NUMBER_ON_THREADED_ISSUE ; i ++ ) { try { return exec ( scr...
we need this method to be synchronized so we will not have multiple scripts run in parallel on the same context
39,212
public String escapeLikeExpression ( String likeExpression ) { String normalizeLikeExpression = likeExpression ; if ( likeExpression != null && ! likeExpression . isEmpty ( ) ) { normalizeLikeExpression = normalizeLikeExpression . replace ( ESCAPE_CHAR , DOUBLE_ESCAPE_CHAR ) ; for ( String charToEscape : currentSpecial...
Escaping like expressions so wildcards will not be evaluated . The HQL query should have the ESCAPE_EXPRESSION in it s suffix for this to work!!!
39,213
public Pair < Integer , Integer > getMinSizeAndSizeOfInBuffer ( int executionThreadsCount ) { int defaultMinInBufferSize = Math . max ( 1 , executionThreadsCount / 5 ) ; int minInBufferSizeLocal = getInteger ( WORKER_INBUFFER_MIN_SIZE , defaultMinInBufferSize ) ; int minInBufferSize = ( minInBufferSizeLocal > 0 ) ? min...
10 percent of Xmx
39,214
private boolean isExecutionPaused ( Execution nextStepExecution ) { if ( nextStepExecution == null ) { executionMessage . setStatus ( ExecStatus . FINISHED ) ; executionMessage . incMsgSeqId ( ) ; executionMessage . setPayload ( null ) ; try { outBuffer . put ( executionMessage ) ; } catch ( InterruptedException e ) { ...
If execution was paused it sends the current step with status FINISHED and that is all ...
39,215
private ExecutionMessage createTerminatedExecutionMessage ( Execution nextStepExecution ) { Payload payload = converter . createPayload ( nextStepExecution ) ; ExecutionMessage finalMessage = ( ExecutionMessage ) executionMessage . clone ( ) ; finalMessage . setStatus ( ExecStatus . TERMINATED ) ; finalMessage . incMsg...
Creates termination execution message base on current execution message
39,216
private ExecutionMessage createPendingExecutionMessage ( Execution nextStepExecution ) { String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } return new ExecutionMessage ( ExecutionMessage . EMPTY_EXEC_STATE_ID , ExecutionMessage ....
Creates pending execution message for the next step base on current execution message
39,217
private ExecutionMessage createInProgressExecutionMessage ( Execution nextStepExecution ) { String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } Long id = queueStateIdGeneratorService . generateStateId ( ) ; return new ExecutionMes...
Creates InProgress execution message for the next step base on current execution message - used for short cut!
39,218
public void setFinishedChildBranchesData ( ArrayList < EndBranchDataContainer > data ) { Validate . isTrue ( ! contextMap . containsKey ( ExecutionParametersConsts . FINISHED_CHILD_BRANCHES_DATA ) , "not allowed to overwrite finished branches data" ) ; contextMap . put ( ExecutionParametersConsts . FINISHED_CHILD_BRANC...
setter for the finished child brunches data
39,219
public void setBranchId ( String brunchId ) { Validate . isTrue ( StringUtils . isEmpty ( getBranchId ( ) ) , "not allowed to overwrite branch id" ) ; contextMap . put ( BRANCH_ID , brunchId ) ; }
setter for the brunch id of the current Execution
39,220
public void setSplitId ( String splitId ) { Validate . isTrue ( StringUtils . isEmpty ( getSplitId ( ) ) , "not allowed to overwrite split id" ) ; contextMap . put ( NEW_SPLIT_ID , splitId ) ; }
set teh split id
39,221
public void addEvent ( String eventType , Serializable eventData ) { @ SuppressWarnings ( "unchecked" ) Queue < ScoreEvent > eventsQueue = getFromMap ( SCORE_EVENTS_QUEUE ) ; if ( eventsQueue == null ) { eventsQueue = new ArrayDeque < > ( ) ; contextMap . put ( SCORE_EVENTS_QUEUE , ( ArrayDeque ) eventsQueue ) ; } even...
add event - for score to fire
39,222
public void addBranch ( Long startPosition , String flowUuid , Map < String , Serializable > context ) { Map < String , Long > runningPlansIds = getFromMap ( RUNNING_PLANS_MAP ) ; Long runningPlanId = runningPlansIds . get ( flowUuid ) ; addBranch ( startPosition , runningPlanId , context , new ExecutionRuntimeServices...
add brunch - means you want to split your execution
39,223
protected boolean handlePausedFlow ( Execution execution ) throws InterruptedException { String branchId = execution . getSystemContext ( ) . getBranchId ( ) ; PauseReason reason = findPauseReason ( execution . getExecutionId ( ) , branchId ) ; if ( reason != null ) { pauseFlow ( reason , execution ) ; return true ; } ...
check if the execution should be Paused and pause it if needed
39,224
private boolean handlePausedFlowAfterStep ( Execution execution ) throws InterruptedException { String branchId = execution . getSystemContext ( ) . getBranchId ( ) ; PauseReason reason = null ; ExecutionSummary execSummary = pauseService . readPausedExecution ( execution . getExecutionId ( ) , branchId ) ; if ( execSu...
no need to check if paused - because this is called after the step when the Pause flag exists in the context
39,225
private Set < String > extractAndRemoveUpToLimit ( Set < String > source , int limit ) { Set < String > result = new HashSet < > ( ) ; Iterator < String > iterator = source . iterator ( ) ; while ( iterator . hasNext ( ) && result . size ( ) < limit ) { result . add ( iterator . next ( ) ) ; iterator . remove ( ) ; } r...
Extracts items from source in the ammount set in limit and also removes them from source
39,226
public static String getTypeName ( Class < ? extends Tag < ? > > clazz ) { return TagType . getByTagClass ( clazz ) . getTypeName ( ) ; }
Gets the type name of a tag .
39,227
public void writeTag ( Tag < ? > tag ) throws IOException { String name = tag . getName ( ) ; byte [ ] nameBytes = name . getBytes ( NBTConstants . CHARSET . name ( ) ) ; os . writeByte ( tag . getType ( ) . getId ( ) ) ; os . writeShort ( nameBytes . length ) ; os . write ( nameBytes ) ; if ( tag . getType ( ) == TagT...
Writes a tag .
39,228
private void writeTagPayload ( Tag < ? > tag ) throws IOException { switch ( tag . getType ( ) ) { case TAG_END : writeEndTagPayload ( ( EndTag ) tag ) ; break ; case TAG_BYTE : writeByteTagPayload ( ( ByteTag ) tag ) ; break ; case TAG_SHORT : writeShortTagPayload ( ( ShortTag ) tag ) ; break ; case TAG_INT : writeInt...
Writes tag payload .
39,229
public T load ( CompoundTag tag ) { Tag subTag = tag . getValue ( ) . get ( key ) ; if ( subTag == null ) { return ( value = defaultValue ) ; } return ( value = field . getValue ( subTag ) ) ; }
Get this field from a CompoundTag
39,230
public static < T > FieldValue < T > from ( String name , Field < T > field , T defaultValue ) { return new FieldValue < T > ( name , field , defaultValue ) ; }
So generic info doesn t have to be duplicated
39,231
public static < T > T getTagValue ( Tag < ? > t , Class < ? extends T > clazz ) { Object o = toTagValue ( t ) ; if ( o == null ) { return null ; } try { return clazz . cast ( o ) ; } catch ( ClassCastException e ) { return null ; } }
Takes in an NBT tag sanely checks null status and then returns it value . This method will return null if the value cannot be cast to the given class .
39,232
public static < T , U extends T > T toTagValue ( Tag < ? > t , Class < ? extends T > clazz , U defaultValue ) { Object o = toTagValue ( t ) ; if ( o == null ) { return defaultValue ; } try { T value = clazz . cast ( o ) ; return value ; } catch ( ClassCastException e ) { return defaultValue ; } }
Takes in an NBT tag sanely checks null status and then returns it value . This method will return null if the value cannot be cast to the default value .
39,233
public static < T extends Tag < ? > > T checkTagCast ( Tag < ? > tag , Class < T > type ) throws IllegalArgumentException { if ( tag == null ) { throw new IllegalArgumentException ( "Expected tag of type " + type . getName ( ) + ", was null" ) ; } else if ( ! type . isInstance ( tag ) ) { throw new IllegalArgumentExcep...
Checks that a tag is not null and of the required type
39,234
public X509Certificate [ ] getCertificates ( ) { if ( this . certSubjectDNMap == null ) { return null ; } Collection certs = this . certSubjectDNMap . values ( ) ; return ( X509Certificate [ ] ) certs . toArray ( new X509Certificate [ certs . size ( ) ] ) ; }
so moved some things over to there
39,235
public SigningPolicy [ ] getSigningPolicies ( ) { if ( this . policyDNMap == null ) { return null ; } Collection values = this . policyDNMap . values ( ) ; return ( SigningPolicy [ ] ) this . policyDNMap . values ( ) . toArray ( new SigningPolicy [ values . size ( ) ] ) ; }
Returns all signing policies
39,236
public SigningPolicy getSigningPolicy ( String subject ) { if ( this . policyDNMap == null ) { return null ; } return ( SigningPolicy ) this . policyDNMap . get ( subject ) ; }
Returns signing policy associated with the given CA subject .
39,237
private ByteBuffer sslDataWrap ( ByteBuffer inBBuff , ByteBuffer outBBuff ) throws GSSException { try { if ( sslEngine . getHandshakeStatus ( ) != SSLEngineResult . HandshakeStatus . NOT_HANDSHAKING ) { throw new Exception ( "SSLEngine handshaking needed! " + "HandshakeStatus: " + sslEngine . getHandshakeStatus ( ) . t...
Meant for non - handshake processing
39,238
private ByteBuffer sslDataUnwrap ( ByteBuffer inBBuff , ByteBuffer outBBuff ) throws GSSException { try { int iter = 0 ; if ( sslEngine . getHandshakeStatus ( ) != SSLEngineResult . HandshakeStatus . NOT_HANDSHAKING ) { throw new Exception ( "SSLEngine handshaking needed! " + "HandshakeStatus: " + sslEngine . getHandsh...
Not all in inBBuff might be consumed by this method!!!
39,239
public byte [ ] wrap ( byte [ ] inBuf , int off , int len , MessageProp prop ) throws GSSException { checkContext ( ) ; logger . debug ( "enter wrap" ) ; byte [ ] token = null ; boolean doGSIWrap = false ; if ( prop != null ) { if ( prop . getQOP ( ) != 0 && prop . getQOP ( ) != GSSConstants . GSI_BIG ) { throw new GSS...
Wraps a message for integrity and protection . A regular SSL - wrapped token is returned .
39,240
public byte [ ] initDelegation ( GSSCredential credential , Oid mechanism , int lifetime , byte [ ] buf , int off , int len ) throws GSSException { logger . debug ( "Enter initDelegation: " + delegationState ) ; if ( mechanism != null && ! mechanism . equals ( getMech ( ) ) ) { throw new GSSException ( GSSException . B...
Initiate the delegation of a credential .
39,241
public static void installSecureRandomProvider ( ) { CoGProperties props = CoGProperties . getDefault ( ) ; String providerName = props . getSecureRandomProvider ( ) ; try { Class providerClass = Class . forName ( providerName ) ; Security . insertProviderAt ( ( Provider ) providerClass . newInstance ( ) , 1 ) ; } catc...
Installs SecureRandom provider . This function is automatically called when this class is loaded .
39,242
public static int getCAPathConstraint ( TBSCertificateStructure crt ) throws IOException { X509Extensions extensions = crt . getExtensions ( ) ; if ( extensions == null ) { return - 1 ; } X509Extension proxyExtension = extensions . getExtension ( X509Extension . basicConstraints ) ; if ( proxyExtension != null ) { Basi...
Return CA Path constraint
39,243
public static KeyPair generateKeyPair ( String algorithm , int bits ) throws GeneralSecurityException { KeyPairGenerator generator = null ; if ( provider == null ) { generator = KeyPairGenerator . getInstance ( algorithm ) ; } else { generator = KeyPairGenerator . getInstance ( algorithm , provider ) ; } generator . in...
Generates a key pair of given algorithm and strength .
39,244
public static TBSCertificateStructure getTBSCertificateStructure ( X509Certificate cert ) throws CertificateEncodingException , IOException { ASN1Primitive obj = toASN1Primitive ( cert . getTBSCertificate ( ) ) ; return TBSCertificateStructure . getInstance ( obj ) ; }
Extracts the TBS certificate from the given certificate .
39,245
public static CertPath getCertPath ( X509Certificate [ ] certs ) throws CertificateException { CertificateFactory factory = CertificateFactory . getInstance ( "X.509" ) ; return factory . generateCertPath ( Arrays . asList ( certs ) ) ; }
JGLOBUS - 91
39,246
protected X509Credential createObject ( GlobusResource certSource , GlobusResource keySource ) throws ResourceStoreException { InputStream certIns ; InputStream keyIns ; try { certIns = certSource . getInputStream ( ) ; keyIns = keySource . getInputStream ( ) ; return new X509Credential ( certIns , keyIns ) ; } catch (...
for creation of credential from a file
39,247
public HostPort setPassive ( int port , int queue ) throws IOException { if ( serverSocket == null ) { ServerSocketFactory factory = ServerSocketFactory . getDefault ( ) ; serverSocket = factory . createServerSocket ( port , queue ) ; } session . serverMode = Session . SERVER_PASSIVE ; String address = Util . getLocalH...
Start the local server
39,248
public void setActive ( HostPort hp ) throws UnknownHostException , ClientException , IOException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "hostport: " + hp . getHost ( ) + " " + hp . getPort ( ) ) ; } session . serverMode = Session . SERVER_ACTIVE ; this . remoteServerAddress = hp ; }
Asynchronous ; return before completion . Connect to the remote server . Any exception that would occure will not be thrown but returned through the local control channel .
39,249
public static void exceptionToControlChannel ( Throwable e , String msg , BasicServerControlChannel control ) { java . io . StringWriter writer = new java . io . StringWriter ( ) ; e . printStackTrace ( new java . io . PrintWriter ( writer ) ) ; String stack = writer . toString ( ) ; LocalReply reply = new LocalReply (...
Convert the exception to a negative 451 reply and pipe it to the provided control channel .
39,250
public void store ( DataSink sink ) { try { localControlChannel . resetReplyCount ( ) ; TransferContext context = createTransferContext ( ) ; if ( session . serverMode == Session . SERVER_PASSIVE ) { runTask ( createPassiveConnectTask ( sink , context ) ) ; } else { runTask ( createActiveConnectTask ( sink , context ) ...
Asynchronous ; return before completion . Start the incoming transfer and store the file to the supplied data sink . Any exception that would occure will not be thrown but returned through the local control channel .
39,251
public void retrieve ( DataSource source ) { try { localControlChannel . resetReplyCount ( ) ; TransferContext context = createTransferContext ( ) ; if ( session . serverMode == Session . SERVER_PASSIVE ) { runTask ( createPassiveConnectTask ( source , context ) ) ; } else { runTask ( createActiveConnectTask ( source ,...
Asynchronous ; return before completion . Start the outgoing transfer reading the data from the supplied data source . Any exception that would occure will not be thrown but returned through the local control channel .
39,252
private synchronized void runTask ( Task task ) { if ( taskThread == null ) { taskThread = new TaskThread ( ) ; } taskThread . runTask ( task ) ; }
Use this as an interface to the local manager thread . This submits the task to the thread queue . The thread will perform it when it s ready with other waiting tasks .
39,253
private PassiveConnectTask createPassiveConnectTask ( DataSource source , TransferContext context ) { return new PassiveConnectTask ( serverSocket , source , localControlChannel , session , dataChannelFactory , context ) ; }
use these methods to create tasks
39,254
public void close ( ) throws IOException { try { this . context . dispose ( ) ; } catch ( GSSException e ) { throw new ChainedIOException ( "dispose failed." , e ) ; } finally { this . socket . close ( ) ; } }
Disposes of the context and closes the connection
39,255
public static byte [ ] readSslMessage ( InputStream in ) throws IOException { byte [ ] header = new byte [ 5 ] ; readFully ( in , header , 0 , header . length ) ; int length ; if ( isSSLv3Packet ( header ) ) length = toShort ( header [ 3 ] , header [ 4 ] ) ; else if ( isSSLv2HelloPacket ( header ) ) length = ( ( ( head...
Reads an entire SSL message from the specified input stream .
39,256
public static void writeInt ( int v , byte [ ] buf , int off ) { buf [ off ] = ( byte ) ( ( v >>> 24 ) & 0xFF ) ; buf [ off + 1 ] = ( byte ) ( ( v >>> 16 ) & 0xFF ) ; buf [ off + 2 ] = ( byte ) ( ( v >>> 8 ) & 0xFF ) ; buf [ off + 3 ] = ( byte ) ( ( v >>> 0 ) & 0xFF ) ; }
Converts the specified int value into 4 bytes . The bytes are put into the specified byte array at a given offset location .
39,257
public void shutdown ( ) { accept = false ; try { _server . close ( ) ; } catch ( Exception e ) { } SocketFactory factory = SocketFactory . getDefault ( ) ; Socket s = null ; try { s = factory . createSocket ( InetAddress . getLocalHost ( ) , getPort ( ) ) ; s . getInputStream ( ) ; } catch ( Exception e ) { } finally ...
Stops the server but does not stop all the client threads
39,258
public Binding evaluate ( Map symbolTable ) throws RslEvaluationException { String strValue = _value . evaluate ( symbolTable ) ; return new Binding ( getName ( ) , new Value ( strValue ) ) ; }
Evaluates the variable definition with the specified symbol table .
39,259
public String toRSL ( boolean explicitConcat ) { StringBuffer buf = new StringBuffer ( ) ; toRSL ( buf , explicitConcat ) ; return buf . toString ( ) ; }
Returns a RSL representation of this variable definition .
39,260
public void toRSL ( StringBuffer buf , boolean explicitConcat ) { buf . append ( "(" ) ; buf . append ( getName ( ) ) ; buf . append ( " " ) ; getValue ( ) . toRSL ( buf , explicitConcat ) ; buf . append ( ")" ) ; }
Produces a RSL representation of this variable definition .
39,261
public static void setTimeout ( Stub stub , int timeout ) { if ( stub instanceof org . apache . axis . client . Stub ) { ( ( org . apache . axis . client . Stub ) stub ) . setTimeout ( timeout ) ; } }
Sets connection timeout .
39,262
public static void setHTTPVersion ( Stub stub , boolean http10 ) { stub . _setProperty ( MessageContext . HTTP_TRANSPORT_VERSION , ( http10 ) ? HTTPConstants . HEADER_PROTOCOL_V10 : HTTPConstants . HEADER_PROTOCOL_V11 ) ; }
Sets on option on the stub to control what HTTP protocol version should be used .
39,263
public GlobusResource getResource ( String location ) { GlobusResource returnResource ; URL resourceURL ; if ( location . startsWith ( "classpath:" ) ) { resourceURL = getClass ( ) . getClassLoader ( ) . getResource ( location . replaceFirst ( "classpath:/" , "" ) ) ; returnResource = new GlobusResource ( resourceURL ....
This method takes a location string and returns a GlobusResource of the corresponding location . This method does not accept any patterns for the location string .
39,264
public GlobusResource [ ] getResources ( String locationPattern ) { Vector < GlobusResource > pathsMatchingLocationPattern = new Vector < GlobusResource > ( ) ; String mainPath = "" ; if ( locationPattern . startsWith ( "classpath:" ) ) { String pathUntilWildcard = getPathUntilWildcard ( locationPattern . replaceFirst ...
Finds all the resources that match the Ant - Style locationPattern
39,265
private void parseFilesInDirectory ( File currentDirectory , Vector < GlobusResource > pathsMatchingLocationPattern ) { File [ ] directoryContents = null ; if ( currentDirectory . isDirectory ( ) ) { directoryContents = currentDirectory . listFiles ( ) ; } else { directoryContents = new File [ 1 ] ; directoryContents [...
Compares every file s Absolute Path against the locationPattern if they match a GlobusResource is created with the file s Absolute Path and added to pathsMatchingLocationPattern .
39,266
private void closeOutgoingSockets ( ) throws ClientException { SocketOperator op = new SocketOperator ( ) { public void operate ( SocketBox sb ) throws Exception { if ( ( ( ManagedSocketBox ) sb ) . isReusable ( ) ) { Socket s = sb . getSocket ( ) ; if ( s != null ) { EBlockImageDCWriter . close ( new DataOutputStream ...
All sockets opened when this server was active should send a special EBlock header before closing .
39,267
public void store ( DataSink sink ) { try { localControlChannel . resetReplyCount ( ) ; if ( session . transferMode != GridFTPSession . MODE_EBLOCK ) { EBlockParallelTransferContext context = ( EBlockParallelTransferContext ) createTransferContext ( ) ; context . setEodsTotal ( 0 ) ; if ( session . serverMode == Sessio...
Store the data from the data channel to the data sink . Does not block . If operation fails exception might be thrown via local control channel .
39,268
public void retrieve ( DataSource source ) { try { localControlChannel . resetReplyCount ( ) ; if ( session . transferMode != GridFTPSession . MODE_EBLOCK ) { EBlockParallelTransferContext context = ( EBlockParallelTransferContext ) createTransferContext ( ) ; context . setEodsTotal ( 0 ) ; logger . debug ( "starting o...
Retrieve the data from the data source and write to the data channel . This method does not block . If operation fails exception might be thrown via local control channel .
39,269
public static Socket authenticate ( Socket simpleSocket , boolean isClientSocket , GSSCredential credential , int protection , DataChannelAuthentication dcau ) throws Exception { GSSContext gssContext = null ; GSSManager manager = ExtendedGSSManager . getInstance ( ) ; if ( isClientSocket ) { gssContext = manager . cre...
authenticate socket . if protection on return authenticated socket wrapped over the original simpleSocket else return original socket .
39,270
public void addUrlCopyListener ( UrlCopyListener listener ) { if ( listeners == null ) listeners = new LinkedList ( ) ; listeners . add ( listener ) ; }
Adds url copy listener .
39,271
public void setSourceUrl ( GlobusURL source ) throws UrlCopyException { if ( source == null ) { throw new IllegalArgumentException ( "Source url cannot be null" ) ; } checkUrl ( source ) ; srcUrl = source ; }
Sets source url .
39,272
public void setDestinationUrl ( GlobusURL dest ) throws UrlCopyException { if ( dest == null ) { throw new IllegalArgumentException ( "Desitination url cannot be null" ) ; } checkUrl ( dest ) ; dstUrl = dest ; }
Sets destination url .
39,273
protected GlobusInputStream getInputStream ( ) throws Exception { GlobusInputStream in = null ; String fromP = srcUrl . getProtocol ( ) ; String fromFile = srcUrl . getPath ( ) ; if ( fromP . equalsIgnoreCase ( "file" ) ) { fromFile = URLDecoder . decode ( fromFile ) ; in = new GlobusFileInputStream ( fromFile ) ; } el...
Returns input stream based on the source url
39,274
protected GlobusOutputStream getOutputStream ( long size ) throws Exception { GlobusOutputStream out = null ; String toP = dstUrl . getProtocol ( ) ; String toFile = dstUrl . getPath ( ) ; if ( toP . equalsIgnoreCase ( "file" ) ) { toFile = URLDecoder . decode ( toFile ) ; out = new GlobusFileOutputStream ( toFile , ap...
Returns output stream based on the destination url .
39,275
private boolean transfer ( long total , GlobusInputStream in , GlobusOutputStream out ) throws IOException { byte [ ] buffer = new byte [ bufferSize ] ; int bytes = 0 ; long totalBytes = total ; long transferedBytes = 0 ; if ( total == - 1 ) { while ( ( bytes = in . read ( buffer ) ) != - 1 ) { out . write ( buffer , 0...
This function performs the actual transfer .
39,276
private void thirdPartyTransfer ( ) throws UrlCopyException { logger . debug ( "Trying third party transfer..." ) ; FTPClient srcFTP = null ; FTPClient dstFTP = null ; try { srcFTP = createFTPConnection ( srcUrl , true ) ; dstFTP = createFTPConnection ( dstUrl , false ) ; negotiateDCAU ( srcFTP , dstFTP ) ; srcFTP . se...
This performs thrid party transfer only if source and destination urls are ftp urls .
39,277
public String evaluate ( Map symbolTable ) throws RslEvaluationException { String var = null ; if ( symbolTable != null ) { var = ( String ) symbolTable . get ( value ) ; } if ( var == null && defValue != null ) { var = defValue . evaluate ( symbolTable ) ; } if ( var == null ) { throw new RslEvaluationException ( "Var...
Evaluates the variable reference with the specified symbol table . The value of the reference is first looked up in the symbol table . If not found then the default value is used . If the default value is not specified the reference is evaluated to an empty string .
39,278
public void toRSL ( StringBuffer buf , boolean explicitConcat ) { buf . append ( "$(" ) ; buf . append ( value ) ; if ( defValue != null ) { buf . append ( " " ) ; defValue . toRSL ( buf , explicitConcat ) ; } buf . append ( ")" ) ; if ( concatValue == null ) return ; if ( explicitConcat ) buf . append ( " # " ) ; conc...
Produces a RSL representation of this variable reference .
39,279
public void checkClientTrusted ( X509Certificate [ ] x509Certificates , String authType ) throws CertificateException { CertPath certPath = CertificateUtil . getCertPath ( x509Certificates ) ; try { this . result = this . validator . engineValidate ( certPath , parameters ) ; } catch ( CertPathValidatorException except...
Test if the client is trusted based on the certificate chain . Does not currently support anonymous clients .
39,280
public X509Certificate [ ] getAcceptedIssuers ( ) { try { Collection < X509Certificate > trusted = CertificateLoadUtil . getTrustedCertificates ( this . parameters . getTrustStore ( ) , null ) ; return trusted . toArray ( new X509Certificate [ trusted . size ( ) ] ) ; } catch ( KeyStoreException e ) { logger . warn ( "...
Get the collection of trusted certificate issuers .
39,281
private static byte [ ] getDecodedPEMObject ( BufferedReader reader ) throws IOException { String line ; StringBuffer buf = new StringBuffer ( ) ; while ( ( line = reader . readLine ( ) ) != null ) { if ( line . indexOf ( "--END" ) != - 1 ) { return Base64 . decode ( buf . toString ( ) . getBytes ( ) ) ; } else { buf ....
Reads Base64 encoded data from the stream and returns its decoded value . The reading continues until the END string is found in the data . Otherwise returns null .
39,282
public void saveCertificateChain ( OutputStream out ) throws IOException , CertificateEncodingException { CertificateIOUtil . writeCertificate ( out , this . certChain [ 0 ] ) ; for ( int i = 1 ; i < this . certChain . length ; i ++ ) { if ( this . certChain [ i ] . getSubjectDN ( ) . equals ( certChain [ i ] . getIssu...
COMMENT Used to be key cert cert cert ... which is wrong afaik . must be cert key cert cert ...
39,283
public int getCertNum ( ) { for ( int i = this . certChain . length - 1 ; i >= 0 ; i -- ) { if ( ! this . certChain [ i ] . getSubjectDN ( ) . equals ( this . certChain [ i ] . getIssuerDN ( ) ) ) { return i + 1 ; } } return this . certChain . length ; }
Returns the number of certificates in the credential without the self - signed certificates .
39,284
public long getTimeLeft ( ) { Date earliestTime = null ; for ( int i = 0 ; i < this . certChain . length ; i ++ ) { Date time = this . certChain [ i ] . getNotAfter ( ) ; if ( earliestTime == null || time . before ( earliestTime ) ) { earliestTime = time ; } } long diff = ( earliestTime . getTime ( ) - System . current...
Returns time left of this credential . The time left of the credential is based on the certificate with the shortest validity time .
39,285
public X509Certificate getIdentityCertificate ( ) { try { return BouncyCastleUtil . getIdentityCertificate ( this . certChain ) ; } catch ( CertificateException e ) { logger . debug ( "Error getting certificate identity." , e ) ; return null ; } }
Returns the identity certificate of this credential . The identity certificate is the first certificate in the chain that is not an impersonation proxy certificate .
39,286
public int getPathConstraint ( ) { int pathLength = Integer . MAX_VALUE ; try { for ( int i = 0 ; i < this . certChain . length ; i ++ ) { int length = BouncyCastleUtil . getProxyPathConstraint ( this . certChain [ i ] ) ; if ( length == - 1 ) { length = Integer . MAX_VALUE ; } if ( length < pathLength ) { pathLength =...
Returns the path length constraint . The shortest length in the chain of certificates is returned as the credential s path length .
39,287
private ServerSocket createServerSocket ( int backlog , InetAddress binAddr ) throws IOException { ServerSocket server = null ; int port = 0 ; while ( true ) { port = this . portRange . getFreePort ( port ) ; try { server = new PrServerSocket ( port , backlog , binAddr ) ; this . portRange . setUsed ( port ) ; return s...
Tries to find first available port within the port range specified . If it finds a free port it first checks if the port is not used by any other server . If it is it keeps looking for a next available port . If none found it throws an exception . If the port is available the server instance is returned .
39,288
protected void checkGridFTPSupport ( ) throws IOException , ServerException { FeatureList fl = getFeatureList ( ) ; if ( ! ( fl . contains ( FeatureList . PARALLEL ) && fl . contains ( FeatureList . ESTO ) && fl . contains ( FeatureList . ERET ) && fl . contains ( FeatureList . SIZE ) ) ) { throw new ServerException ( ...
assure that the server supports extended transfer features ; throw exception if not
39,289
public void get ( String remoteFileName , File localFile ) throws IOException , ClientException , ServerException { if ( gSession . transferMode == GridFTPSession . MODE_EBLOCK ) { DataSink sink = new FileRandomIO ( new RandomAccessFile ( localFile , "rw" ) ) ; get ( remoteFileName , sink , null ) ; } else { super . ge...
basic compatibility API
39,290
public void setChecksum ( ChecksumAlgorithm algorithm , String value ) throws IOException , ServerException { String arguments = algorithm . toFtpCmdArgument ( ) + " " + value ; Command cmd = new Command ( "SCKS" , arguments ) ; try { controlChannel . execute ( cmd ) ; } catch ( UnexpectedReplyCodeException urce ) { th...
Sets the checksum values ahead of the transfer
39,291
public String checksum ( ChecksumAlgorithm algorithm , long offset , long length , String file ) throws IOException , ServerException { String arguments = algorithm . toFtpCmdArgument ( ) + " " + String . valueOf ( offset ) + " " + String . valueOf ( length ) + " " + file ; Command cmd = new Command ( "CKSM" , argument...
Computes and returns a checksum of a file . transferred .
39,292
public void changeGroup ( String group , String file ) throws IOException , ServerException { String arguments = group + " " + file ; Command cmd = new Command ( "SITE CHGRP" , arguments ) ; try { controlChannel . execute ( cmd ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedR...
Change the Unix group membership of a file .
39,293
public void changeModificationTime ( int year , int month , int day , int hour , int min , int sec , String file ) throws IOException , ServerException { DecimalFormat df2 = new DecimalFormat ( "00" ) ; DecimalFormat df4 = new DecimalFormat ( "0000" ) ; String arguments = df4 . format ( year ) + df2 . format ( month ) ...
Change the modification time of a file .
39,294
public void createSymbolicLink ( String link_target , String link_name ) throws IOException , ServerException { String arguments = link_target . replaceAll ( " " , "%20" ) + " " + link_name ; Command cmd = new Command ( "SITE SYMLINK" , arguments ) ; try { controlChannel . execute ( cmd ) ; } catch ( UnexpectedReplyCod...
Create a symbolic link on the FTP server .
39,295
public void setOid ( String oid ) { if ( oid == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "oidNull" ) ) ; } this . oid = oid ; }
Sets the oid of this extension .
39,296
public void addListener ( GramJobListener listener ) { if ( listeners == null ) listeners = new Vector ( ) ; listeners . addElement ( listener ) ; }
Add a listener to the GramJob . The listener will be notified whenever the status of the GramJob changes .
39,297
protected void setStatus ( int status ) { if ( this . status == status ) return ; this . status = status ; if ( listeners == null ) return ; int size = listeners . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { GramJobListener listener = ( GramJobListener ) listeners . elementAt ( i ) ; listener . statusChanged ( thi...
Sets the status of the job . User should not call this function .
39,298
public void request ( String contact , boolean batch ) throws GramException , GSSException { Gram . request ( contact , this , batch ) ; }
Submits a job to the specified gatekeeper either as an interactive or batch job . Performs limited delegation .
39,299
public int signal ( int signal , String arg ) throws GramException , GSSException { return Gram . jobSignal ( this , signal , arg ) ; }
Sends a signal command to the job .