idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
39,400
private void transfer ( OutputStream os , String path ) throws IOException { path = decodeUrlPath ( path ) ; File f = new File ( path ) ; FileInputStream file = new FileInputStream ( f ) ; long length = f . length ( ) ; StringBuffer buf = new StringBuffer ( OKHEADER ) . append ( CONNECTION_CLOSE ) . append ( SERVER ) ....
Transfer from a file given its path to the given OutputStream . The BufferedWriter points to the same stream but is used to write HTTP header information .
39,401
private long fromHex ( String s ) { long result = 0 ; int size = s . length ( ) ; for ( int i = 0 ; i < size ; i ++ ) { char c = s . charAt ( i ) ; result *= 16 ; switch ( c ) { case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : result += ( c - '0' ) ; break ; ...
Convert a String representing a hex number to a long .
39,402
protected String makeRequest ( boolean includePassword ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( VERSION ) . append ( CRLF ) ; buf . append ( COMMAND ) . append ( String . valueOf ( command ) ) . append ( CRLF ) ; buf . append ( USERNAME ) . append ( this . username ) . append ( CRLF ) ; String pwd =...
Serializes the parameters into a MyProxy request . Subclasses should overwrite this function and append the custom parameters to the output of this function .
39,403
protected void engineInit ( KeyStore keyStore ) throws KeyStoreException { try { this . engineInit ( new CertPathTrustManagerParameters ( new X509ProxyCertPathParameters ( keyStore , null , null , false ) ) ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new KeyStoreException ( e ) ; } }
Initializes this factory with a source of certificate authorities and related trust material .
39,404
public void setProtection ( int protection ) { switch ( protection ) { case GridFTPSession . PROTECTION_CLEAR : throw new IllegalArgumentException ( "Unsupported protection: " + protection ) ; case GridFTPSession . PROTECTION_SAFE : case GridFTPSession . PROTECTION_CONFIDENTIAL : case GridFTPSession . PROTECTION_PRIVAT...
Sets data channel protection level .
39,405
public boolean isValidSubject ( X500Principal subject ) { if ( subject == null ) { throw new IllegalArgumentException ( ) ; } String subjectDN = CertificateUtil . toGlobusID ( subject ) ; if ( ( this . allowedDNs == null ) || ( this . allowedDNs . size ( ) < 1 ) ) { return false ; } int size = this . allowedDNs . size ...
Ascertains if the subjectDN is valid against this policy .
39,406
public static String getIdentity ( X509Certificate cert ) { if ( cert == null ) { return null ; } String subjectDN = cert . getSubjectX500Principal ( ) . getName ( X500Principal . RFC2253 ) ; X509Name name = new X509Name ( true , subjectDN ) ; return X509NameHelper . toString ( name ) ; }
Returns the subject DN of the given certificate in the Globus format .
39,407
public static byte [ ] getExtensionValue ( byte [ ] certExtValue ) throws IOException { ByteArrayInputStream inStream = new ByteArrayInputStream ( certExtValue ) ; ASN1InputStream derInputStream = new ASN1InputStream ( inStream ) ; ASN1Primitive object = derInputStream . readObject ( ) ; if ( object instanceof ASN1Octe...
Retrieves the actual value of the X . 509 extension .
39,408
public static byte [ ] getExtensionValue ( X509Certificate cert , String oid ) throws IOException { if ( cert == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "certNull" ) ) ; } if ( oid == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "oidNull" ) ) ; } byte [ ] value = cert . ge...
Returns the actual value of the extension .
39,409
protected void parse ( ) throws IOException { String line ; line = _reader . readLine ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( line ) ; } parseHead ( line ) ; while ( ( line = _reader . readLine ( ) ) . length ( ) != 0 ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( line ) ; } if ( line . s...
Parses the typical HTTP header .
39,410
public long getSize ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "SIZE" , filename ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; return Long . parseLong ...
Returns the remote file size .
39,411
public Date getLastModified ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "MDTM" , filename ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; } catch ( FTPRep...
Returns last modification time of the specifed file .
39,412
public void changeDir ( String dir ) throws IOException , ServerException { if ( dir == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "CWD" , dir ) ; try { controlChannel . execute ( cmd ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . em...
Changes the remote current working directory .
39,413
public void deleteFile ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "DELE" , filename ) ; try { controlChannel . execute ( cmd ) ; } catch ( FTPReplyParseException rpe ) { throw Ser...
Deletes the remote file .
39,414
public void rename ( String oldName , String newName ) throws IOException , ServerException { if ( oldName == null || newName == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "RNFR" , oldName ) ; try { Reply reply = controlChannel . exchange ( cmd ) ; if ( !...
Renames remote directory .
39,415
public String getCurrentDir ( ) throws IOException , ServerException { Reply reply = null ; try { reply = controlChannel . execute ( Command . PWD ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerExcept...
Returns remote current working directory .
39,416
public void goUpDir ( ) throws IOException , ServerException { try { controlChannel . execute ( Command . CDUP ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeExcept...
Changes remote current working directory to the higher level .
39,417
public Vector list ( String filter , String modifier ) throws ServerException , ClientException , IOException { ByteArrayDataSink sink = new ByteArrayDataSink ( ) ; list ( filter , modifier , sink ) ; ByteArrayOutputStream received = sink . getData ( ) ; BufferedReader reader = new BufferedReader ( new StringReader ( r...
Performs remote directory listing with the specified filter and modifier . Sends LIST &lt ; modifier&gt ; &lt ; filter&gt ; command .
39,418
public void list ( String filter , String modifier , DataSink sink ) throws ServerException , ClientException , IOException { String arg = null ; if ( modifier != null ) { arg = modifier ; } if ( filter != null ) { arg = ( arg == null ) ? filter : arg + " " + filter ; } Command cmd = new Command ( "LIST" , arg ) ; perf...
Performs directory listing and writes the result to the supplied data sink . This method is allowed in ASCII mode only .
39,419
public Vector nlist ( String path ) throws ServerException , ClientException , IOException { ByteArrayDataSink sink = new ByteArrayDataSink ( ) ; nlist ( path , sink ) ; ByteArrayOutputStream received = sink . getData ( ) ; BufferedReader reader = new BufferedReader ( new StringReader ( received . toString ( ) ) ) ; Ve...
Performs remote directory listing on the given path . Sends NLST &lt ; path&gt ; command .
39,420
public MlsxEntry mlst ( String fileName ) throws IOException , ServerException { try { Reply reply = controlChannel . execute ( new Command ( "MLST" , fileName ) ) ; String replyMessage = reply . getMessage ( ) ; StringTokenizer replyLines = new StringTokenizer ( replyMessage , System . getProperty ( "line.separator" )...
Get info of a certain remote file in Mlsx format .
39,421
public void setType ( int type ) throws IOException , ServerException { localServer . setTransferType ( type ) ; String typeStr = null ; switch ( type ) { case Session . TYPE_IMAGE : typeStr = "I" ; break ; case Session . TYPE_ASCII : typeStr = "A" ; break ; case Session . TYPE_LOCAL : typeStr = "E" ; break ; case Sess...
Sets transfer type .
39,422
public void close ( boolean ignoreQuitReply ) throws IOException , ServerException { try { if ( ignoreQuitReply ) { controlChannel . write ( Command . QUIT ) ; } else { controlChannel . execute ( Command . QUIT ) ; } } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; ...
Closes connection . Sends QUIT and closes connection even if the server reply was not positive . Also closes the local server .
39,423
public FeatureList getFeatureList ( ) throws IOException , ServerException { if ( this . session . featureList != null ) { return this . session . featureList ; } Reply featReply = null ; try { featReply = controlChannel . execute ( Command . FEAT ) ; if ( featReply . getCode ( ) != 211 ) { throw ServerException . embe...
Returns list of features supported by remote server .
39,424
public HostPort setPassive ( ) throws IOException , ServerException { Reply reply = null ; try { reply = controlChannel . execute ( ( controlChannel . isIPv6 ( ) ) ? Command . EPSV : Command . PASV ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce ) ; }...
Sets remote server to passive server mode .
39,425
public void setActive ( HostPort hostPort ) throws IOException , ServerException { Command cmd = new Command ( ( controlChannel . isIPv6 ( ) ) ? "EPRT" : "PORT" , hostPort . toFtpCmdArgument ( ) ) ; try { controlChannel . execute ( cmd ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUne...
Sets remote server active telling it to connect to the given address .
39,426
public void setLocalActive ( ) throws ClientException , IOException { if ( session . serverAddress == null ) { throw new ClientException ( ClientException . CALL_PASSIVE_FIRST ) ; } try { localServer . setActive ( session . serverAddress ) ; } catch ( java . net . UnknownHostException e ) { throw new ClientException ( ...
Starts local server in active server mode .
39,427
public void setOptions ( Options opts ) throws IOException , ServerException { Command cmd = new Command ( "OPTS" , opts . toFtpCmdArgument ( ) ) ; try { controlChannel . execute ( cmd ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCod...
Sets the supplied options to the server .
39,428
public void setRestartMarker ( RestartData restartData ) throws IOException , ServerException { Command cmd = new Command ( "REST" , restartData . toFtpCmdArgument ( ) ) ; Reply reply = null ; try { reply = controlChannel . exchange ( cmd ) ; } catch ( FTPReplyParseException e ) { throw ServerException . embedFTPReplyP...
Sets restart parameter of the next transfer .
39,429
public void authorize ( String user , String password ) throws IOException , ServerException { Reply userReply = null ; try { userReply = controlChannel . exchange ( new Command ( "USER" , user ) ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } if ( Reply . is...
Performs user authorization with specified user and password .
39,430
public void transfer ( String remoteSrcFile , FTPClient destination , String remoteDstFile , boolean append , MarkerListener mListener ) throws IOException , ServerException , ClientException { session . matches ( destination . session ) ; if ( session . serverMode == Session . SERVER_DEFAULT ) { HostPort hp = destinat...
Performs third - party transfer between two servers .
39,431
protected void transferRun ( BasicClientControlChannel other , MarkerListener mListener ) throws IOException , ServerException , ClientException { TransferState transferState = transferBegin ( other , mListener ) ; transferWait ( transferState ) ; }
Actual transfer management . Transfer is controlled by two new threads listening to the two servers .
39,432
public Reply quote ( String command ) throws IOException , ServerException { Command cmd = new Command ( command ) ; return doCommand ( cmd ) ; }
Executes arbitrary operation on the server .
39,433
public void allocate ( long size ) throws IOException , ServerException { Command cmd = new Command ( "ALLO" , String . valueOf ( size ) ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( u...
Reserve sufficient storage to accommodate the new file to be transferred .
39,434
protected void checkGETPUTSupport ( ) throws ServerException , IOException { if ( ! isFeatureSupported ( FeatureList . GETPUT ) ) { throw new ServerException ( ServerException . UNSUPPORTED_FEATURE ) ; } if ( controlChannel . isIPv6 ( ) ) { throw new ServerException ( ServerException . UNSUPPORTED_FEATURE , "Cannot use...
Throws ServerException if GFD . 47 GETPUT is not supported or cannot be used .
39,435
protected HostPort get127Reply ( ) throws ServerException , IOException , FTPReplyParseException { Reply reply = controlChannel . read ( ) ; if ( Reply . isTransientNegativeCompletion ( reply ) || Reply . isPermanentNegativeCompletion ( reply ) ) { throw ServerException . embedUnexpectedReplyCodeException ( new Unexpec...
Reads a GFD . 47 compliant 127 reply and extracts the port information from it .
39,436
private void issueGETPUT ( String command , boolean passive , HostPort port , int mode , String path ) throws IOException { Command cmd = new Command ( command , ( passive ? "pasv" : ( "port=" + port . toFtpCmdArgument ( ) ) ) + ";" + "path=" + path + ";" + ( mode > 0 ? "mode=" + getModeStr ( mode ) + ";" : "" ) ) ; co...
Writes a GFD . 47 compliant GET or PUT command to the control channel .
39,437
public String getChecksum ( String algorithm , String path ) throws ClientException , ServerException , IOException { return getChecksum ( algorithm , 0 , - 1 , path ) ; }
GridFTP v2 CKSM command for the whole file
39,438
public int getDelegationKeyCacheLifetime ( ) { int valueInt = 0 ; String valueStr = System . getProperty ( DELEGATION_KEY_CACHE_LIFETIME ) ; if ( valueStr != null && valueStr . length ( ) > 0 ) { int parsedvalueInt = Integer . parseInt ( valueStr ) ; if ( parsedvalueInt > 0 ) { valueInt = parsedvalueInt ; } } if ( valu...
Returns the delegation key cache lifetime for all delegations from this JVM . If this property is not set or set to zero or less no caching is done .
39,439
public long getCRLCacheLifetime ( ) { long value = getCertCacheLifetime ( ) ; String property = getProperty ( CRL_CACHE_LIFETIME ) ; if ( property != null && property . length ( ) > 0 ) { long parsedValue = Long . parseLong ( property ) ; if ( parsedValue > 0 ) { value = parsedValue ; } } property = System . getPropert...
Returns the CRL cache lifetime . If this property is set to zero or less no caching is done . The value is the number of milliseconds the CRLs are cached without checking for modifications on disk .
39,440
public long getCertCacheLifetime ( ) throws NumberFormatException { long value = 60 * 1000 ; String property = getProperty ( CERT_CACHE_LIFETIME ) ; if ( property != null && property . length ( ) > 0 ) { long parsedValue = Long . parseLong ( property ) ; if ( parsedValue > 0 ) { value = parsedValue ; } } property = Sys...
Returns the Cert cache lifetime . If this property is set to zero or less no caching is done . The value is the number of milliseconds the certificates are cached without checking for modifications on disk .
39,441
public long getReveseDNSCacheLifetime ( ) throws NumberFormatException { long value = 60 * 60 * 1000 ; String property = getProperty ( REVERSE_DNS_CACHE_LIFETIME ) ; if ( property != null && property . length ( ) > 0 ) { long parsedValue = Long . parseLong ( property ) ; if ( parsedValue > 0 ) { value = parsedValue ; }...
Returns the reverse DNS cache time .
39,442
public String getReverseDNSCacheType ( ) { String value = System . getProperty ( REVERSE_DNS_CACHETYPE ) ; if ( value != null ) { return value ; } return getProperty ( REVERSE_DNS_CACHETYPE , THREADED_CACHE ) ; }
Returns the reverse DNS cache type . Defaults to a threaded chache .
39,443
public void add ( Binding binding ) { if ( values == null ) values = new LinkedList ( ) ; values . add ( binding ) ; }
Adds a new variable definition to the list .
39,444
public Bindings evaluate ( Map symbolTable ) throws RslEvaluationException { if ( symbolTable == null ) { throw new IllegalArgumentException ( "Symbol table must be initialized." ) ; } List newValues = new LinkedList ( ) ; Iterator iter = values . iterator ( ) ; Object vl ; Binding binding ; while ( iter . hasNext ( ) ...
Evaluates the variable definitions as variable definitions can reference each other against the symbol table . The evaluation process updates the symbol table .
39,445
protected TrustManager [ ] getTrustManagers ( String keystoreType , String keystoreProvider , String algorithm ) throws Exception { KeyStore trustStore = getTrustStore ( keystoreType , keystoreProvider ) ; CertStore crlStore = null ; if ( crlLocation != null ) { crlStore = GlobusSSLHelper . findCRLStore ( ( String ) cr...
Create a Globus trust manager which supports proxy certificates . This requires that the CRL store and signing policy store be configured .
39,446
public static synchronized PortRange getTcpInstance ( ) { if ( tcpPortRange == null ) { tcpPortRange = new PortRange ( ) ; tcpPortRange . init ( CoGProperties . getDefault ( ) . getTcpPortRange ( ) ) ; } return tcpPortRange ; }
Returns PortRange instance for TCP listening sockets . If the tcp . port . range property is set the class will be initialized with the specified port ranges .
39,447
public static synchronized PortRange getTcpSourceInstance ( ) { if ( tcpSourcePortRange == null ) { tcpSourcePortRange = new PortRange ( ) ; tcpSourcePortRange . init ( CoGProperties . getDefault ( ) . getTcpSourcePortRange ( ) ) ; } return tcpSourcePortRange ; }
Returns PortRange instance for TCP source sockets . If the tcp . source . port . range property is set the class will be initialized with the specified port ranges .
39,448
public static synchronized PortRange getUdpSourceInstance ( ) { if ( udpSourcePortRange == null ) { udpSourcePortRange = new PortRange ( ) ; udpSourcePortRange . init ( CoGProperties . getDefault ( ) . getUdpSourcePortRange ( ) ) ; } return udpSourcePortRange ; }
Returns PortRange instance for UDP source sockets . If the udp . source . port . range property is set the class will be initialized with the specified port ranges .
39,449
public synchronized int getFreePort ( int lastPortNumber ) throws IOException { int id = 0 ; if ( lastPortNumber != 0 ) { id = lastPortNumber - minPort ; if ( id < 0 ) { throw new IOException ( "Port number out of range." ) ; } } for ( int i = id ; i < ports . length ; i ++ ) { if ( ports [ i ] == USED ) continue ; ret...
Returns first available port .
39,450
public void save ( OutputStream out ) throws IOException { try { cred . save ( out ) ; } catch ( CertificateEncodingException e ) { throw new ChainedIOException ( e . getMessage ( ) , e ) ; } }
Saves the credential into a specified output stream . The self - signed certificates in the certificate chain will not be saved . The output stream should always be closed after calling this function .
39,451
public ASN1Primitive toASN1Primitive ( ) { ASN1EncodableVector vec = new ASN1EncodableVector ( ) ; if ( this . pathLenConstraint != null ) { vec . add ( this . pathLenConstraint ) ; } vec . add ( this . proxyPolicy . toASN1Primitive ( ) ) ; return new DERSequence ( vec ) ; }
Returns the DER - encoded ASN . 1 representation of the extension .
39,452
public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { if ( ! requireSigningPolicyCheck ( certType ) ) { return ; } X500Principal caPrincipal = cert . getIssuerX500Principal ( ) ; SigningPolicy policy ; try { policy = this . policyStore . getSigningPoli...
Validate DN against the signing policy
39,453
private boolean requireSigningPolicyCheck ( GSIConstants . CertificateType certType ) { return ! ProxyCertificateUtil . isProxy ( certType ) && certType != GSIConstants . CertificateType . CA ; }
if a certificate is not a CA or if it is not a proxy return true .
39,454
public DataChannelReader getDataChannelSource ( TransferContext context ) throws Exception { String id = getHandlerID ( session . transferMode , session . transferType , SOURCE ) ; logger . debug ( "type/mode: " + id ) ; Class clazz = ( Class ) dataHandlers . get ( id ) ; if ( clazz == null ) { throw new Exception ( "N...
currently context is only needed in case of EBlock mode
39,455
public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { X500Principal certIssuer = cert . getIssuerX500Principal ( ) ; X509CRLSelector crlSelector = new X509CRLSelector ( ) ; crlSelector . addIssuer ( certIssuer ) ; Collection < ? extends CRL > crls ; if...
Method that checks the if the certificate is in a CRL if CRL is available If no CRL is found then no error is thrown If an expired CRL is found an error is thrown
39,456
public static ServerException embedFTPReplyParseException ( FTPReplyParseException rpe , String message ) { ServerException se = new ServerException ( WRONG_PROTOCOL , message ) ; se . setRootCause ( rpe ) ; return se ; }
Constructs server exception with FTPReplyParseException nested in it .
39,457
public static ServerException embedUnexpectedReplyCodeException ( UnexpectedReplyCodeException urce , String message ) { ServerException se = new ServerException ( SERVER_REFUSED , message ) ; se . setRootCause ( urce ) ; return se ; }
Constructs server exception with UnexpectedReplyCodeException nested in it .
39,458
public static synchronized I18n getI18n ( String resource ) { I18n instance = ( I18n ) mapping . get ( resource ) ; if ( instance == null ) { instance = new I18n ( ResourceBundle . getBundle ( resource , Locale . getDefault ( ) , getClassLoader ( ) ) ) ; mapping . put ( resource , instance ) ; } return instance ; }
Retrieve a I18n instance by resource name .
39,459
public String toFtpCmdArgument ( ) { if ( this . sporCommandParam == null && this . vector != null ) { StringBuffer cmd = new StringBuffer ( ) ; for ( int i = 0 ; i < this . vector . size ( ) ; i ++ ) { HostPort hp = ( HostPort ) this . vector . get ( i ) ; if ( i != 0 ) { cmd . append ( ' ' ) ; } cmd . append ( hp . t...
Returns the host - port infromation in the format used by SPOR command .
39,460
public synchronized void transferError ( Exception e ) { logger . debug ( "intercepted exception" , e ) ; if ( transferException == null ) { transferException = e ; } else if ( transferException instanceof InterruptedException || transferException instanceof InterruptedIOException ) { transferException = e ; } notifyAl...
this is called when an error occurs during transfer
39,461
public synchronized void waitForEnd ( ) throws ServerException , ClientException , IOException { try { while ( ! isDone ( ) && ! hasError ( ) ) { wait ( ) ; } } catch ( InterruptedException e ) { } checkError ( ) ; }
Blocks until the transfer is complete or the transfer fails .
39,462
public synchronized void waitForStart ( ) throws ServerException , ClientException , IOException { try { while ( ! isStarted ( ) && ! hasError ( ) ) { wait ( ) ; } } catch ( InterruptedException e ) { } checkError ( ) ; }
Blocks until the transfer begins or the transfer fails to start .
39,463
public void add ( ASN1ObjectIdentifier oid , String value ) { ASN1EncodableVector v = new ASN1EncodableVector ( ) ; v . add ( oid ) ; v . add ( new DERPrintableString ( value ) ) ; add ( new DERSet ( new DERSequence ( v ) ) ) ; }
Appends the specified OID and value pair name component to the end of the current name .
39,464
public void add ( ASN1Set entry ) { ASN1EncodableVector v = new ASN1EncodableVector ( ) ; int size = seq . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { v . add ( seq . getObjectAt ( i ) ) ; } v . add ( entry ) ; seq = new DERSequence ( v ) ; }
Appends the specified name component entry to the current name . This can be used to add handle multiple AVAs in one name component .
39,465
public static String GET ( String path , String host ) { return HTTPProtocol . createGETHeader ( "/" + path , host , USER_AGENT ) ; }
This method concatenates a properly formatted header for performing Globus Gass GETs with the given information .
39,466
public static String PUT ( String path , String host , long length , boolean append ) { String newPath = null ; if ( append ) { newPath = APPEND_URI + "/" + path ; } else { newPath = "/" + path ; } return HTTPProtocol . createPUTHeader ( newPath , host , USER_AGENT , TYPE , length , append ) ; }
This method concatenates a properly formatted header for performing Globus Gass PUTs with the given information .
39,467
public void close ( ) throws IOException { logger . debug ( "ftp socket closed" ) ; if ( ftpIn != null ) ftpIn . close ( ) ; if ( ftpOut != null ) ftpOut . close ( ) ; if ( socket != null ) socket . close ( ) ; hasBeenOpened = false ; }
Closes the control channel
39,468
public Reply read ( ) throws ServerException , IOException , FTPReplyParseException , EOFException { Reply reply = new Reply ( ftpIn ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Control channel received: " + reply ) ; } lastReply = reply ; return reply ; }
Block until a reply is available in the control channel .
39,469
public void write ( Command cmd ) throws IOException , IllegalArgumentException { if ( cmd == null ) { throw new IllegalArgumentException ( "null argument: cmd" ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Control channel sending: " + cmd ) ; } writeStr ( cmd . toString ( ) ) ; }
Sends the command over the control channel . Do not wait for reply .
39,470
public Reply exchange ( Command cmd ) throws ServerException , IOException , FTPReplyParseException { write ( cmd ) ; return read ( ) ; }
Write the command to the control channel block until reply arrives and return the reply . Before calling this method make sure that no old replies are waiting on the control channel . Otherwise the reply returned may not be the reply to this command .
39,471
public static Class getClassContextAt ( int i ) { Class [ ] classes = MANAGER . getClassContext ( ) ; if ( classes != null && classes . length > i ) { return classes [ i ] ; } return null ; }
Returns a class at specified depth of the current execution stack .
39,472
public static ClassLoader getClassLoaderContextAt ( int i ) { Class [ ] classes = MANAGER . getClassContext ( ) ; if ( classes != null && classes . length > i ) { return classes [ i ] . getClassLoader ( ) ; } return null ; }
Returns a classloader at specified depth of the current execution stack .
39,473
public static InputStream getResourceAsStream ( String name ) { ClassLoader loader = getClassLoaderContextAt ( 3 ) ; InputStream in = ( loader == null ) ? null : loader . getResourceAsStream ( name ) ; if ( in == null ) { ClassLoader contextLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contextL...
Gets an InputStream to a resource of a specified name . First the caller s classloader is used to load the resource and if it fails the thread s context classloader is used to load the resource .
39,474
public static Class forName ( String name ) throws ClassNotFoundException { ClassLoader loader = getClassLoaderContextAt ( 3 ) ; try { return Class . forName ( name , true , loader ) ; } catch ( ClassNotFoundException e ) { ClassLoader contextLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contex...
Loads a specified class . First the caller s classloader is used to load the class and if it fails the thread s context classloader is used to load the specified class .
39,475
public void start ( String rmc ) throws GassException { if ( rmc == null ) { throw new IllegalArgumentException ( "Resource manager contact not specified" ) ; } GassServer gassServer = null ; String error = null ; try { gassServer = new GassServer ( this . cred , 0 ) ; String gassURL = gassServer . getURL ( ) ; String ...
Starts the gass server on the remote machine .
39,476
public boolean shutdown ( ) { if ( url != null ) { logger . debug ( "Trying to shutdown gass server directly..." ) ; try { GlobusURL u = new GlobusURL ( url ) ; GassServer . shutdown ( this . cred , u ) ; } catch ( Exception e ) { logger . debug ( "gass server shutdown failed" , e ) ; } try { gassJobListener . reset ( ...
Shutdowns remotely running gass server .
39,477
public static File createFile ( String filename ) throws SecurityException , IOException { File f = new File ( filename ) ; if ( ! f . createNewFile ( ) ) { if ( ! destroy ( f ) ) { throw new SecurityException ( "Could not destroy existing file" ) ; } if ( ! f . createNewFile ( ) ) { throw new SecurityException ( "Fail...
Attempts to create a new file in an atomic way . If the file already exists it if first deleted .
39,478
public static boolean destroy ( File file ) { if ( ! file . exists ( ) ) return false ; RandomAccessFile f = null ; long size = file . length ( ) ; try { f = new RandomAccessFile ( file , "rw" ) ; long rec = size / DMSG . length ( ) ; int left = ( int ) ( size - rec * DMSG . length ( ) ) ; while ( rec != 0 ) { f . writ...
Overwrites the contents of the file with a random string and then deletes the file .
39,479
public static String getInput ( String prompt ) { System . out . print ( prompt ) ; try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return in . readLine ( ) ; } catch ( IOException e ) { return null ; } }
Displays a prompt and then reads in the input from System . in .
39,480
public static String getPrivateInput ( String prompt ) { System . out . print ( prompt ) ; PrivateInputThread privateInput = new PrivateInputThread ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; privateInput . start ( ) ; try { return in . readLine ( ) ; } catch ( Exception e )...
Displays a prompt and then reads in private input from System . in . Characters typed by the user are replaced with a space on the screen .
39,481
public static String quote ( String str ) { int len = str . length ( ) ; StringBuffer buf = new StringBuffer ( len + 2 ) ; buf . append ( "\"" ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = str . charAt ( i ) ; if ( c == '"' || c == '\\' ) { buf . append ( "\\" ) ; } buf . append ( c ) ; } buf . append ( "\"" ) ...
Quotifies a specified string . The entire string is encompassed by double quotes and each is replaced with \ \ is replaced with \\ .
39,482
public static String unquote ( String str ) throws Exception { int len = str . length ( ) ; StringBuffer buf = new StringBuffer ( len ) ; boolean inQuotes = false ; char c ; int i = 0 ; if ( str . charAt ( i ) == '"' ) { inQuotes = true ; i ++ ; } while ( i < len ) { c = str . charAt ( i ) ; if ( inQuotes ) { if ( c ==...
Dequotifies a specified string . The quotes are removed and each \ is replaced with and each \\ is replaced with \ .
39,483
public X509Credential createCredential ( X509Certificate [ ] certs , PrivateKey privateKey , int bits , int lifetime , GSIConstants . CertificateType certType , X509ExtensionSet extSet , String cnValue ) throws GeneralSecurityException { X509Certificate [ ] bcCerts = getX509CertificateObjectChain ( certs ) ; KeyPairGen...
Creates a new proxy credential from the specified certificate chain and a private key . A set of X . 509 extensions can be optionally included in the new proxy certificate . This function automatically creates a RSA - based key pair .
39,484
public X509Certificate loadCertificate ( InputStream in ) throws IOException , GeneralSecurityException { ASN1InputStream derin = new ASN1InputStream ( in ) ; ASN1Primitive certInfo = derin . readObject ( ) ; ASN1Sequence seq = ASN1Sequence . getInstance ( certInfo ) ; return new X509CertificateObject ( Certificate . g...
Loads a X509 certificate from the specified input stream . Input stream must contain DER - encoded certificate .
39,485
public byte [ ] createCertificateRequest ( X509Name subjectDN , String sigAlgName , KeyPair keyPair ) throws GeneralSecurityException { DERSet attrs = null ; PKCS10CertificationRequest certReq = null ; certReq = new PKCS10CertificationRequest ( sigAlgName , subjectDN , keyPair . getPublic ( ) , attrs , keyPair . getPri...
Creates a certificate request from the specified subject name signing algorithm and a key pair .
39,486
public static GSIConstants . CertificateType decideProxyType ( X509Certificate issuerCert , GSIConstants . DelegationType delegType ) throws CertificateException { GSIConstants . CertificateType proxyType = GSIConstants . CertificateType . UNDEFINED ; if ( delegType == GSIConstants . DelegationType . LIMITED ) { GSICon...
Given a delegation mode and an issuing certificate decides an appropriate certificate type to use for proxies
39,487
public NameOpValue getParam ( String attribute ) { if ( _relations == null || attribute == null ) return null ; return ( NameOpValue ) _relations . get ( canonicalize ( attribute ) ) ; }
Returns the relation associated with the given attribute .
39,488
public Bindings removeBindings ( String attribute ) { if ( _relations == null || attribute == null ) return null ; return ( Bindings ) _bindings . remove ( canonicalize ( attribute ) ) ; }
Removes a bindings list for the specified attribute .
39,489
public void toRSL ( StringBuffer buf , boolean explicitConcat ) { Iterator iter ; buf . append ( getOperatorAsString ( ) ) ; if ( _bindings != null && _bindings . size ( ) > 0 ) { iter = _bindings . keySet ( ) . iterator ( ) ; Bindings binds ; while ( iter . hasNext ( ) ) { binds = getBindings ( ( String ) iter . next ...
Produces a RSL representation of node .
39,490
public String getSingle ( String attribute ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return null ; Object obj = nv . getFirstValue ( ) ; if ( obj != null && obj instanceof Value ) { return ( ( Value ) obj ) . getCompleteValue ( ) ; } else { ret...
Returns a string value of the specified attribute . If the attribute contains multiple values the first one is returned .
39,491
public List getMulti ( String attribute ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return null ; List values = nv . getValues ( ) ; List list = new LinkedList ( ) ; Iterator iter = values . iterator ( ) ; Object obj ; while ( iter . hasNext ( ) ...
Returns a list of strings for a specified attribute . For example for arguments attribute .
39,492
public void addVariable ( String attribute , String varName , String value ) { Bindings binds = rslTree . getBindings ( attribute ) ; if ( binds == null ) { binds = new Bindings ( attribute ) ; rslTree . put ( binds ) ; } binds . add ( new Binding ( varName , value ) ) ; }
Adds a new variable definition to the specified variable definitions attribute .
39,493
public boolean removeVariable ( String attribute , String varName ) { Bindings binds = rslTree . getBindings ( attribute ) ; if ( binds == null ) return false ; return binds . removeVariable ( varName ) ; }
Removes a specific variable definition given a variable name .
39,494
public boolean remove ( String attribute , String value ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return false ; return nv . remove ( new Value ( value ) ) ; }
Removes a specific value from a list of values of the specified attribute .
39,495
public boolean removeMap ( String attribute , String key ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return false ; List values = nv . getValues ( ) ; Iterator iter = values . iterator ( ) ; Object obj ; int i = 0 ; int found = - 1 ; while ( iter...
Removes a specific key from a list of values of the specified attribute . The attribute values must be in the right form . See the environment rsl attribute .
39,496
public void add ( String attribute , String value ) { NameOpValue nv = getRelation ( attribute ) ; nv . add ( new Value ( value ) ) ; }
Adds a simple value to the list of values of a given attribute .
39,497
public void setMulti ( String attribute , String [ ] values ) { NameOpValue nv = getRelation ( attribute ) ; nv . clear ( ) ; List list = new LinkedList ( ) ; for ( int i = 0 ; i < values . length ; i ++ ) { list . add ( new Value ( values [ i ] ) ) ; } nv . add ( list ) ; }
Sets the attribute value to the given list of values . The list of values is added as a single value .
39,498
public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { if ( proxyCertValidator . getIdentityCertificate ( ) == null ) { if ( ProxyCertificateUtil . isLimitedProxy ( certType ) ) { proxyCertValidator . setLimited ( true ) ; if ( proxyCertValidator . isRe...
Method that sets the identity of the certificate path . Also checks if limited proxy is acceptable .
39,499
private void notReflexive ( List < String > conditions , QueryNode node , QueryNode target ) { Validate . isTrue ( node != target , "notReflexive(...) implies that source " + "and target node are not the same, but someone is violating this constraint!" ) ; Validate . notNull ( node ) ; Validate . notNull ( target ) ; i...
Explicitly disallow reflexivity .