idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
39,300
public static String getStatusAsString ( int status ) { if ( status == STATUS_PENDING ) { return "PENDING" ; } else if ( status == STATUS_ACTIVE ) { return "ACTIVE" ; } else if ( status == STATUS_DONE ) { return "DONE" ; } else if ( status == STATUS_FAILED ) { return "FAILED" ; } else if ( status == STATUS_SUSPENDED ) ...
Convert the status of a GramJob from an integer to a string . This method is not typically called by users .
39,301
public void registerJob ( GramJob job ) { String id = job . getIDAsString ( ) ; _jobs . put ( id , job ) ; }
Registers gram job to listen for status updates
39,302
public void unregisterJob ( GramJob job ) { String id = job . getIDAsString ( ) ; _jobs . remove ( id ) ; }
Unregisters gram job from listening to status updates
39,303
public void authorize ( GSSContext context , String host ) throws AuthorizationException { logger . debug ( "Authorization: HOST/SELF" ) ; try { GSSName expected = this . hostAuthz . getExpectedName ( null , host ) ; GSSName target = null ; if ( context . isInitiator ( ) ) { target = context . getTargName ( ) ; } else ...
Performs host authorization . If that fails performs self authorization
39,304
public X509Extension add ( X509Extension extension ) { if ( extension == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "extensionNull" ) ) ; } return ( X509Extension ) this . extensions . put ( extension . getOid ( ) , extension ) ; }
Adds a X509Extension object to this set .
39,305
public X509Extension get ( String oid ) { if ( oid == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "oidNull" ) ) ; } return ( X509Extension ) this . extensions . get ( oid ) ; }
Retrieves X509Extension by given oid .
39,306
protected String getHostBasedServiceCN ( boolean last ) { if ( hostBasedServiceCN == null ) { String dn = name . getName ( ) ; int cnStart ; if ( last ) { cnStart = dn . lastIndexOf ( "CN=" ) + 3 ; } else { cnStart = dn . indexOf ( "CN=" ) + 3 ; } if ( cnStart == - 1 ) { return null ; } int cnEnd = dn . indexOf ( "," ,...
Returns the CN corresponding to the host part of the DN
39,307
public void concat ( Value value ) { if ( concatValue != null ) { concatValue . concat ( value ) ; } else { concatValue = value ; } }
Appends the specified value to the end of the chain of concatinated values . That is if this value has no concatinated value then set the specified value as the concatinated value . If this value already has a concatinated value then append the specified value to that concatinated value .
39,308
public String evaluate ( Map symbolTable ) throws RslEvaluationException { if ( concatValue == null ) { return value ; } else { StringBuffer buf = new StringBuffer ( value ) ; buf . append ( concatValue . evaluate ( symbolTable ) ) ; return buf . toString ( ) ; } }
Evaluates the value with the specified symbol table . In this case the function just returns the string representation of the actual value . No symbol table lookups are performed .
39,309
public void toRSL ( StringBuffer buf , boolean explicitConcat ) { if ( explicitConcat ) { buf . append ( quotify ( value ) ) ; } else { buf . append ( value ) ; } if ( concatValue == null ) { return ; } if ( explicitConcat ) { buf . append ( " # " ) ; } concatValue . toRSL ( buf , explicitConcat ) ; }
Produces a RSL representation of this value .
39,310
public static void ping ( GSSCredential cred , String resourceManagerContact ) throws GramException , GSSException { ResourceManagerContact rmc = new ResourceManagerContact ( resourceManagerContact ) ; Socket socket = gatekeeperConnect ( cred , rmc , false , false ) ; HttpResponse hd = null ; try { OutputStream out = s...
Performs ping operation on the gatekeeper with specified user credentials . Verifies if the user is authorized to submit a job to that gatekeeper .
39,311
public static void request ( String resourceManagerContact , GramJob job ) throws GramException , GSSException { request ( resourceManagerContact , job , false ) ; }
Submits a GramJob to specified gatekeeper as an interactive job . Performs limited delegation .
39,312
public static void request ( String resourceManagerContact , GramJob job , boolean batchJob ) throws GramException , GSSException { request ( resourceManagerContact , job , batchJob , true ) ; }
Submits a GramJob to specified gatekeeper as a interactive or batch job . Performs limited delegation .
39,313
public static void request ( String resourceManagerContact , GramJob job , boolean batchJob , boolean limitedDelegation ) throws GramException , GSSException { GSSCredential cred = getJobCredentials ( job ) ; String callbackURL = null ; CallbackHandler handler = null ; if ( ! batchJob ) { handler = initCallbackHandler ...
Submits a GramJob to specified gatekeeper as a interactive or batch job .
39,314
public static void renew ( GramJob job , GSSCredential newCred ) throws GramException , GSSException { renew ( job , newCred , true ) ; }
Requests that a globus job manager accept newly delegated credentials . Uses limited delegation .
39,315
public static void cancel ( GramJob job ) throws GramException , GSSException { GlobusURL jobURL = job . getID ( ) ; if ( jobURL == null ) { throw new GramException ( GramException . ERROR_JOB_CONTACT_NOT_SET ) ; } GSSCredential cred = getJobCredentials ( job ) ; String msg = GRAMProtocol . CANCEL_JOB ( jobURL . getURL...
This function cancels an already running job .
39,316
public static int jobSignal ( GramJob job , int signal , String arg ) throws GramException , GSSException { GlobusURL jobURL = job . getID ( ) ; GSSCredential cred = getJobCredentials ( job ) ; String msg = GRAMProtocol . SIGNAL ( jobURL . getURL ( ) , jobURL . getHost ( ) , signal , arg ) ; GatekeeperReply hd = null ;...
This function sends a signal to a job .
39,317
public static void unregisterListener ( GramJob job ) throws GramException , GSSException { CallbackHandler handler ; GSSCredential cred = getJobCredentials ( job ) ; handler = initCallbackHandler ( cred ) ; unregisterListener ( job , handler ) ; }
This function unregisters the job from callback listener . The job status will not be updated .
39,318
public static void deactivateAllCallbackHandlers ( ) { synchronized ( callbackHandlers ) { Enumeration e = callbackHandlers . elements ( ) ; while ( e . hasMoreElements ( ) ) { CallbackHandler handler = ( CallbackHandler ) e . nextElement ( ) ; handler . shutdown ( ) ; } callbackHandlers . clear ( ) ; } }
Deactivates all callback handlers .
39,319
public static CallbackHandler deactivateCallbackHandler ( GSSCredential cred ) { if ( cred == null ) { return null ; } CallbackHandler handler = ( CallbackHandler ) callbackHandlers . remove ( cred ) ; if ( handler == null ) { return null ; } handler . shutdown ( ) ; return handler ; }
Deactivates a callback handler for a given credential .
39,320
private static void debug ( String header , GatekeeperReply reply ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( header ) ; logger . trace ( reply . toString ( ) ) ; } }
Debug function for displaying the gatekeeper reply .
39,321
private static void debug ( String header , HttpResponse response ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( header ) ; logger . trace ( response . toString ( ) ) ; } }
Debug function for displaying HTTP responses .
39,322
private static void debug ( String header , String msg ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( header ) ; logger . trace ( msg ) ; } }
A general debug message that prints the header and msg when the debug level is smaler than 3
39,323
public void decrypt ( byte [ ] password ) throws GeneralSecurityException { if ( ! isEncrypted ( ) ) { return ; } byte [ ] enc = Base64 . decode ( this . encodedKey ) ; SecretKeySpec key = getSecretKey ( password , this . initializationVector . getIV ( ) ) ; Cipher cipher = getCipher ( ) ; cipher . init ( Cipher . DECR...
Decrypts the private key with given password . Does nothing if the key is not encrypted .
39,324
public void encrypt ( byte [ ] password ) throws GeneralSecurityException { if ( isEncrypted ( ) ) { return ; } if ( this . encAlg == null ) { setEncryptionAlgorithm ( "DES-EDE3-CBC" ) ; } if ( this . ivData == null ) { generateIV ( ) ; } Key key = getSecretKey ( password , this . initializationVector . getIV ( ) ) ; C...
Encrypts the private key with given password . Does nothing if the key is encrypted already .
39,325
public void writeTo ( String file ) throws IOException { File privateKey = FileUtil . createFile ( file ) ; try { privateKey . setReadable ( false , true ) ; privateKey . setWritable ( false , true ) ; } catch ( SecurityException e ) { } PrintWriter p = new PrintWriter ( new FileOutputStream ( privateKey ) ) ; try { p ...
Writes the private key to the specified file in PEM format . If the key was encrypted it will be encoded as an encrypted RSA key . If not it will be encoded as a regular RSA key .
39,326
private static boolean objectsEquals ( Object a , Object b ) { return ( a == b ) || ( a != null && a . equals ( b ) ) ; }
Java 7 is adopted
39,327
public synchronized void add ( SocketBox sb ) { int status = ( ( ManagedSocketBox ) sb ) . getStatus ( ) ; if ( allSockets . containsKey ( sb ) ) { throw new IllegalArgumentException ( "This socket already exists in the socket pool." ) ; } allSockets . put ( sb , sb ) ; if ( status == ManagedSocketBox . FREE ) { if ( f...
add socketBox to the pool . Depending on its state it will be added to free or busy sockets .
39,328
public synchronized void remove ( SocketBox sb ) { int status = ( ( ManagedSocketBox ) sb ) . getStatus ( ) ; if ( ! allSockets . containsKey ( sb ) ) { throw new IllegalArgumentException ( "This socket does not seem to exist in the socket pool." ) ; } allSockets . remove ( sb ) ; if ( status == ManagedSocketBox . FREE...
remove socketBox from the pool remove all references to it
39,329
public synchronized void applyToAll ( SocketOperator op ) throws Exception { Enumeration keys = allSockets . keys ( ) ; while ( keys . hasMoreElements ( ) ) { SocketBox myBox = ( SocketBox ) keys . nextElement ( ) ; op . operate ( myBox ) ; } }
Apply the suplied callback to all socketBoxes .
39,330
public synchronized void flush ( ) throws IOException { Enumeration keys = allSockets . keys ( ) ; while ( keys . hasMoreElements ( ) ) { SocketBox myBox = ( SocketBox ) keys . nextElement ( ) ; if ( myBox != null ) { myBox . setSocket ( null ) ; } } allSockets . clear ( ) ; freeSockets . clear ( ) ; busySockets . clea...
Forcibly close all sockets and remove them from the pool .
39,331
public boolean isDryRun ( ) { String run = getSingle ( "dryrun" ) ; if ( run == null ) return false ; if ( run . equalsIgnoreCase ( "yes" ) ) return true ; return false ; }
Checks if dryryn is enabled .
39,332
public void setJobType ( int jobType ) { String type = null ; switch ( jobType ) { case JOBTYPE_SINGLE : type = "single" ; break ; case JOBTYPE_MULTIPLE : type = "multiple" ; break ; case JOBTYPE_MPI : type = "mpi" ; break ; case JOBTYPE_CONDOR : type = "condor" ; break ; } if ( type != null ) { set ( "jobtype" , type ...
Sets a job type .
39,333
public int getJobType ( ) { String jobType = getSingle ( "jobtype" ) ; if ( jobType == null ) return - 1 ; if ( jobType . equalsIgnoreCase ( "single" ) ) { return JOBTYPE_SINGLE ; } else if ( jobType . equalsIgnoreCase ( "multiple" ) ) { return JOBTYPE_MULTIPLE ; } else if ( jobType . equalsIgnoreCase ( "mpi" ) ) { ret...
Returns type of the job .
39,334
public boolean load ( File file ) throws IOException { InputStream in = null ; try { in = new FileInputStream ( file ) ; this . file = file ; this . lastModified = file . lastModified ( ) ; return load ( in ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( Exception e ) { } } } }
Loads grid map definition from a given file .
39,335
public boolean load ( InputStream input ) throws IOException { boolean success = true ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( input ) ) ; Map localMap = new HashMap ( ) ; GridMapEntry entry ; QuotedStringTokenizer tokenizer ; StringTokenizer idTokenizer ; String line ; while ( ( line = re...
Loads grid map file definition from a given input stream . The input stream is not closed in case of an error .
39,336
public String getUserID ( String globusID ) { String [ ] ids = getUserIDs ( globusID ) ; if ( ids != null && ids . length > 0 ) { return ids [ 0 ] ; } else { return null ; } }
Returns first local user name mapped to the specified globusID .
39,337
public String [ ] getUserIDs ( String globusID ) { if ( globusID == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "globusIdNull" ) ) ; } if ( this . map == null ) { return null ; } GridMapEntry entry = ( GridMapEntry ) this . map . get ( normalizeDN ( globusID ) ) ; return ( entry == null ) ? null :...
Returns local user names mapped to the specified globusID .
39,338
public boolean checkUser ( String globusID , String userID ) { if ( globusID == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "glousIdNull" ) ) ; } if ( userID == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "userIdNull" ) ) ; } if ( this . map == null ) { return false ; } GridM...
Checks if a given globus ID is associated with given local user account .
39,339
public String getGlobusID ( String userID ) { if ( userID == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "userIdNull" ) ) ; } if ( this . map == null ) { return null ; } Iterator iter = this . map . entrySet ( ) . iterator ( ) ; Map . Entry mapEntry ; GridMapEntry entry ; while ( iter . hasNext ( ...
Returns globus ID associated with the specified local user name .
39,340
public String [ ] getAllGlobusID ( String userID ) { if ( userID == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "userIdNull" ) ) ; } if ( this . map == null ) { return null ; } Vector v = new Vector ( ) ; Iterator iter = this . map . entrySet ( ) . iterator ( ) ; Map . Entry mapEntry ; GridMapEntr...
Returns all globus IDs associated with the specified local user name .
39,341
public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { try { cert . checkValidity ( ) ; } catch ( CertificateExpiredException e ) { throw new CertPathValidatorException ( "Certificate " + cert . getSubjectDN ( ) + " expired" , e ) ; } catch ( Certificat...
Method that checks the time validity . Uses the standard Certificate . checkValidity method .
39,342
public CredentialInfo info ( GSSCredential credential , String username , String passphrase ) throws MyProxyException { InfoParams request = new InfoParams ( ) ; request . setUserName ( username ) ; request . setPassphrase ( passphrase ) ; return info ( credential , request ) [ 0 ] ; }
Retrieves credential information from MyProxy server . Only the information of the default credential is returned by this operation .
39,343
public void getTrustroots ( GSSCredential credential , GetTrustrootsParams params ) throws MyProxyException { if ( params == null ) { throw new IllegalArgumentException ( "params == null" ) ; } if ( credential == null ) { try { credential = getAnonymousCredential ( ) ; } catch ( GSSException e ) { throw new MyProxyExce...
Retrieves trustroot information from the MyProxy server .
39,344
public boolean writeTrustRoots ( String directory ) throws IOException { if ( this . trustrootFilenames == null || this . trustrootData == null ) { return false ; } File rootDir = new File ( directory ) ; if ( ! rootDir . exists ( ) ) { rootDir . mkdirs ( ) ; } for ( int i = 0 ; i < trustrootFilenames . length ; i ++ )...
Writes the retrieved trust roots to a trusted certificates directory .
39,345
protected static String toHex ( final byte [ ] bin ) { if ( bin == null || bin . length == 0 ) return "" ; char [ ] buffer = new char [ bin . length * 2 ] ; final char [ ] hex = "0123456789abcdef" . toCharArray ( ) ; for ( int i = 0 , j = 0 ; i < bin . length ; i ++ ) { final byte b = bin [ i ] ; buffer [ j ++ ] = hex ...
encode binary to hex
39,346
public Key engineGetKey ( String s , char [ ] chars ) throws NoSuchAlgorithmException , UnrecoverableKeyException { CredentialWrapper credential = getKeyEntry ( s ) ; Key key = null ; if ( credential != null ) { try { String password = null ; if ( chars != null ) { password = new String ( chars ) ; } key = credential ....
Get the key referenced by the specified alias .
39,347
public void engineStore ( OutputStream outputStream , char [ ] chars ) throws IOException , NoSuchAlgorithmException , CertificateException { for ( SecurityObjectWrapper < ? > object : this . aliasObjectMap . values ( ) ) { if ( object instanceof Storable ) { try { ( ( Storable ) object ) . store ( ) ; } catch ( Resour...
Persist the security material in this keystore . If the object has a path associated with it the object will be persisted to that path . Otherwise it will be stored in the default certificate directory . As a result the parameters of this method are ignored .
39,348
public Date engineGetCreationDate ( String s ) { try { ResourceTrustAnchor trustAnchor = getCertificateEntry ( s ) ; if ( trustAnchor != null ) { return trustAnchor . getTrustAnchor ( ) . getTrustedCert ( ) . getNotBefore ( ) ; } else { CredentialWrapper credential = getKeyEntry ( s ) ; if ( credential != null ) { retu...
Get the creation date for the object referenced by the alias .
39,349
public Certificate [ ] engineGetCertificateChain ( String s ) { CredentialWrapper credential = getKeyEntry ( s ) ; X509Certificate [ ] chain = new X509Certificate [ 0 ] ; if ( credential != null ) { try { chain = credential . getCredential ( ) . getCertificateChain ( ) ; } catch ( ResourceStoreException e ) { logger . ...
Get the certificateChain for the key referenced by the alias .
39,350
public Certificate engineGetCertificate ( String s ) { ResourceTrustAnchor trustAnchor = getCertificateEntry ( s ) ; if ( trustAnchor != null ) { try { return trustAnchor . getTrustAnchor ( ) . getTrustedCert ( ) ; } catch ( ResourceStoreException e ) { return null ; } } return null ; }
Get the certificate referenced by the supplied alias .
39,351
public void engineLoad ( KeyStore . LoadStoreParameter loadStoreParameter ) throws IOException , NoSuchAlgorithmException , CertificateException { if ( ! ( loadStoreParameter instanceof KeyStoreParametersFactory . FileStoreParameters ) ) { throw new IllegalArgumentException ( "Unable to process parameters: " + loadStor...
Load the keystore based on parameters in the LoadStoreParameter . The parameter object must be an instance of FileBasedKeyStoreParameters .
39,352
private void initialize ( String defaultDirectoryString , String directoryListString , String proxyFilename , String certFilename , String keyFilename ) throws IOException , CertificateException { if ( defaultDirectoryString != null ) { defaultDirectory = new GlobusPathMatchingResourcePatternResolver ( ) . getResource ...
Initialize resources from filename proxyfile name
39,353
public void engineDeleteEntry ( String s ) throws KeyStoreException { SecurityObjectWrapper < ? > object = this . aliasObjectMap . remove ( s ) ; if ( object != null ) { if ( object instanceof ResourceTrustAnchor ) { ResourceTrustAnchor descriptor = ( ResourceTrustAnchor ) object ; Certificate cert ; try { cert = descr...
Delete a security object from this keystore .
39,354
public void engineSetKeyEntry ( String s , Key key , char [ ] chars , Certificate [ ] certificates ) throws KeyStoreException { if ( ! ( key instanceof PrivateKey ) ) { throw new KeyStoreException ( "PrivateKey expected" ) ; } if ( ! ( certificates instanceof X509Certificate [ ] ) ) { throw new KeyStoreException ( "Cer...
Add a new private key to the keystore .
39,355
public void engineSetCertificateEntry ( String alias , Certificate certificate ) throws KeyStoreException { if ( ! ( certificate instanceof X509Certificate ) ) { throw new KeyStoreException ( "Certificate must be instance of X509Certificate" ) ; } File file ; ResourceTrustAnchor trustAnchor = getCertificateEntry ( alia...
Add a certificate to the keystore .
39,356
public static boolean isProxy ( GSIConstants . CertificateType certType ) { return isGsi2Proxy ( certType ) || isGsi3Proxy ( certType ) || isGsi4Proxy ( certType ) ; }
Determines if a specified certificate type indicates a GSI - 2 GSI - 3 or GSI - 4proxy certificate .
39,357
public static boolean isGsi4Proxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_4_IMPERSONATION_PROXY || certType == GSIConstants . CertificateType . GSI_4_INDEPENDENT_PROXY || certType == GSIConstants . CertificateType . GSI_4_RESTRICTED_PROXY || certType == GSIC...
Determines if a specified certificate type indicates a GSI - 4 proxy certificate .
39,358
public static boolean isGsi3Proxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_3_IMPERSONATION_PROXY || certType == GSIConstants . CertificateType . GSI_3_INDEPENDENT_PROXY || certType == GSIConstants . CertificateType . GSI_3_RESTRICTED_PROXY || certType == GSIC...
Determines if a specified certificate type indicates a GSI - 3 proxy certificate .
39,359
public static boolean isGsi2Proxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_2_PROXY || certType == GSIConstants . CertificateType . GSI_2_LIMITED_PROXY ; }
Determines if a specified certificate type indicates a GSI - 2 proxy certificate .
39,360
public static boolean isLimitedProxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_3_LIMITED_PROXY || certType == GSIConstants . CertificateType . GSI_2_LIMITED_PROXY || certType == GSIConstants . CertificateType . GSI_4_LIMITED_PROXY ; }
Determines if a specified certificate type indicates a GSI - 2 or GSI - 3 or GSI = 4 limited proxy certificate .
39,361
public static boolean isIndependentProxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_3_INDEPENDENT_PROXY || certType == GSIConstants . CertificateType . GSI_4_INDEPENDENT_PROXY ; }
Determines if a specified certificate type indicates a GSI - 3 or GS - 4 limited proxy certificate .
39,362
public static boolean isImpersonationProxy ( GSIConstants . CertificateType certType ) { return certType == GSIConstants . CertificateType . GSI_3_IMPERSONATION_PROXY || certType == GSIConstants . CertificateType . GSI_3_LIMITED_PROXY || certType == GSIConstants . CertificateType . GSI_4_IMPERSONATION_PROXY || certType...
Determines if a specified certificate type indicates a GSI - 2 or GSI - 3 or GSI - 4 impersonation proxy certificate .
39,363
public static String getProxyTypeAsString ( GSIConstants . CertificateType proxyType ) { switch ( proxyType ) { case GSI_4_IMPERSONATION_PROXY : return "RFC 3820 compliant impersonation proxy" ; case GSI_4_INDEPENDENT_PROXY : return "RFC 3820 compliant independent proxy" ; case GSI_4_LIMITED_PROXY : return "RFC 3820 co...
Returns a string description of a specified proxy type .
39,364
public Map < X500Principal , SigningPolicy > parse ( String fileName ) throws FileNotFoundException , SigningPolicyException { if ( ( fileName == null ) || ( fileName . trim ( ) . isEmpty ( ) ) ) { throw new IllegalArgumentException ( ) ; } logger . debug ( "Signing policy file name " + fileName ) ; FileReader fileRead...
Parses the file to extract signing policy defined for CA with the specified DN . If the policy file does not exist a SigningPolicy object with only CA DN is created . If policy path exists but no relevant policy exisit SigningPolicy object with CA DN and file path is created .
39,365
public Map < X500Principal , SigningPolicy > parse ( Reader reader ) throws SigningPolicyException { Map < X500Principal , SigningPolicy > policies = new HashMap < X500Principal , SigningPolicy > ( ) ; BufferedReader bufferedReader = new BufferedReader ( reader ) ; try { String line ; while ( ( line = bufferedReader . ...
Parses input stream to extract signing policy defined for CA with the specified DN .
39,366
private int findIndex ( String line ) { int index = - 1 ; if ( line == null ) { return index ; } String trimmedLine = line . trim ( ) ; int spaceIndex = trimmedLine . indexOf ( " " ) ; int tabIndex = trimmedLine . indexOf ( "\t" ) ; if ( spaceIndex != - 1 ) { if ( tabIndex != - 1 ) { if ( spaceIndex < tabIndex ) { inde...
find first space or tab as separator .
39,367
public static CertStore createCertStore ( TrustedCertificates tc ) throws Exception { CertStore store = null ; if ( tc == null ) { String caCertPattern = "file:" + CoGProperties . getDefault ( ) . getCaCertLocations ( ) + "/*.0" ; store = Stores . getCACertStore ( caCertPattern ) ; } else { SimpleMemoryCertStoreParams ...
Create a CertStore object from TrustedCertificates . The store only loads trusted certificates no signing policies
39,368
public ProxyPolicyHandler removeProxyPolicyHandler ( String id ) { return ( id != null && this . proxyPolicyHandlers != null ) ? ( ProxyPolicyHandler ) this . proxyPolicyHandlers . remove ( id ) : null ; }
Removes a restricted proxy policy handler .
39,369
public ProxyPolicyHandler setProxyPolicyHandler ( String id , ProxyPolicyHandler handler ) { if ( id == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "proxyPolicyId" ) ) ; } if ( handler == null ) { throw new IllegalArgumentException ( i18n . getMessage ( "proxyPolicyHandler" ) ) ; } if ( this . pro...
Sets a restricted proxy policy handler .
39,370
public ProxyPolicyHandler getProxyPolicyHandler ( String id ) { return ( id != null && this . proxyPolicyHandlers != null ) ? ( ProxyPolicyHandler ) this . proxyPolicyHandlers . get ( id ) : null ; }
Retrieves a restricted proxy policy handler for a given policy id .
39,371
public void activeConnect ( HostPort hp , int connections ) { for ( int i = 0 ; i < connections ; i ++ ) { SocketBox sbox = new ManagedSocketBox ( ) ; logger . debug ( "adding new empty socketBox to the socket pool" ) ; socketPool . add ( sbox ) ; logger . debug ( "connecting active socket " + i + "; total cached socke...
Act as the active side . Connect to the server and store the newly connected sockets in the socketPool .
39,372
public void activeClose ( TransferContext context , int connections ) { try { for ( int i = 0 ; i < connections ; i ++ ) { SocketBox sbox = socketPool . checkOut ( ) ; try { GridFTPDataChannel dc = new GridFTPDataChannel ( gSession , sbox ) ; EBlockImageDCWriter writer = ( EBlockImageDCWriter ) dc . getDataChannelSink ...
use only in mode E
39,373
public synchronized void startTransfer ( DataSource source , TransferContext context , int connections , boolean reusable ) throws ServerException { if ( transferThreadCount != 0 ) { throw new ServerException ( ServerException . PREVIOUS_TRANSFER_ACTIVE ) ; } for ( int i = 0 ; i < connections ; i ++ ) { logger . debug ...
This should be used once the remote active server connected to us . This method starts transfer threads that will read data from the source and send .
39,374
public synchronized void passiveConnect ( DataSink sink , TransferContext context , int connections , ServerSocket serverSocket ) throws ServerException { if ( transferThreadCount != 0 ) { throw new ServerException ( ServerException . PREVIOUS_TRANSFER_ACTIVE ) ; } for ( int i = 0 ; i < connections ; i ++ ) { Task task...
Accept connections from the remote server and start transfer threads that will read incoming data and store in the sink .
39,375
public synchronized void passiveConnect ( DataSource source , TransferContext context , ServerSocket serverSocket ) throws ServerException { if ( transferThreadCount != 0 ) { throw new ServerException ( ServerException . PREVIOUS_TRANSFER_ACTIVE ) ; } Task task = new GridFTPPassiveConnectTask ( serverSocket , source , ...
Accept connection from the remote server and start transfer thread that will read incoming data and store in the sink . This method because of direction of transfer cannot be used with EBlock . Therefore it is fixed to create only 1 connection .
39,376
public static KeyStore buildTrustStore ( String provider , String trustAnchorStoreType , String trustAnchorStoreLocation , String trustAnchorStorePassword ) throws GlobusSSLConfigurationException { try { KeyStore trustAnchorStore ; if ( provider == null ) { trustAnchorStore = KeyStore . getInstance ( trustAnchorStoreTy...
Create a trust store using the supplied details . Java SSL requires the trust store to be supplied as a java . security . KeyStore so this will create a KeyStore containing all of the Trust Anchors .
39,377
public static KeyStore findCredentialStore ( String provider , String credentialStoreType , String credentialStoreLocation , String credentialStorePassword ) throws GlobusSSLConfigurationException { try { KeyStore credentialStore ; if ( provider == null ) { credentialStore = KeyStore . getInstance ( credentialStoreType...
Create a configured CredentialStore using the supplied parameters . The credential store is a java . security . KeyStore .
39,378
public static CertStore findCRLStore ( String crlPattern ) throws GlobusSSLConfigurationException { try { return Stores . getCRLStore ( crlPattern ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new GlobusSSLConfigurationException ( e ) ; } catch ( NoSuchAlgorithmException e ) { Log logger = LogFactory . g...
Create a store of Certificate Revocation Lists . Java requires that this be a java . security . certificates . CertStore . As such the store can hold both CRL s and non - trusted certs . For the purposes of this method we assume that only crl s will be loaded . This can only be used with the Globus provided Certificate...
39,379
private String readLine ( InputStream in ) throws IOException { StringBuffer buf = new StringBuffer ( ) ; int c , length = 0 ; while ( true ) { c = in . read ( ) ; if ( c == - 1 || c == '\n' || length > 512 ) { break ; } else if ( c == '\r' ) { in . read ( ) ; return buf . toString ( ) ; } else { buf . append ( ( char ...
Read a line of text from the given Stream and return it as a String . Assumes lines end in CRLF .
39,380
private static String getUsefulMessage ( Throwable throwable ) { while ( isBoring ( throwable ) ) { throwable = throwable . getCause ( ) ; } String message = throwable . getMessage ( ) ; if ( message == null ) { message = throwable . getClass ( ) . getName ( ) ; } return message ; }
Wrapper around getMessage method that tries to provide a meaningful message . This is needed because many GSSException objects provide no useful information and the actual useful information is in the Throwable that caused the exception .
39,381
public List < Feature > getFeature ( String label ) { if ( label == null ) { throw new IllegalArgumentException ( "feature label is null" ) ; } label = label . toUpperCase ( ) ; List < Feature > foundFeatures = new ArrayList ( ) ; for ( Feature feature : features ) { if ( feature . getLabel ( ) . equals ( label ) ) { f...
Get all features that have label equal to the argument Note that RFC 2389 does not require a feature with a given label to appear only once
39,382
public static String getOperatorAsString ( int op ) { switch ( op ) { case EQ : return "=" ; case NEQ : return "!=" ; case GT : return ">" ; case GTEQ : return ">=" ; case LT : return "<" ; case LTEQ : return "<=" ; default : return "??" ; } }
Returns a string representation of the specified relation operator .
39,383
public void add ( String [ ] strValues ) { if ( strValues == null ) return ; if ( values == null ) values = new LinkedList ( ) ; for ( int i = 0 ; i < strValues . length ; i ++ ) { values . add ( new Value ( strValues [ i ] ) ) ; } }
Adds an array of values to the list of values . Each element in the array is converted into a Value object and inserted as a separate value into the list of values .
39,384
public void add ( List list ) { if ( values == null ) values = new LinkedList ( ) ; values . add ( list ) ; }
Adds a list to the list of values . It is inserted as a single element .
39,385
public NameOpValue evaluate ( Map symbolTable ) throws RslEvaluationException { List list = evaluateSub ( values , symbolTable ) ; NameOpValue newNV = new NameOpValue ( getAttribute ( ) , getOperator ( ) ) ; newNV . setValues ( list ) ; return newNV ; }
Evaluates the relation against the symbol table .
39,386
protected static String ignoreLeading0 ( String line ) { if ( line . length ( ) > 0 && line . charAt ( 0 ) == 0 ) { logger . debug ( "WARNING: The first character of the reply is 0. Ignoring the character." ) ; return line . substring ( 1 , line . length ( ) ) ; } return line ; }
GT2 . 0 wuftp server incorrectly inserts \ 0 between lines . We have to deal with that .
39,387
protected Socket openSocket ( String host , int port ) throws IOException { return SocketFactory . getDefault ( ) . createSocket ( host , port ) ; }
subclasses should overwrite this function
39,388
public void verify ( ) throws Exception { Map < String , ProxyPolicyHandler > handlers = null ; if ( proxyCertInfo != null ) { String oid = proxyCertInfo . getProxyPolicy ( ) . getPolicyLanguage ( ) . getId ( ) ; handlers = new HashMap < String , ProxyPolicyHandler > ( ) ; handlers . put ( oid , new ProxyPolicyHandler ...
verifies the proxy credential
39,389
protected List < CertificateChecker > getCertificateCheckers ( ) { List < CertificateChecker > checkers = new ArrayList < CertificateChecker > ( ) ; checkers . add ( new DateValidityChecker ( ) ) ; checkers . add ( new UnsupportedCriticalExtensionChecker ( ) ) ; checkers . add ( new IdentityChecker ( this ) ) ; Certifi...
COMMENT enable the checkers again when ProxyPathValidator starts working!
39,390
public GSSCredential createCredential ( byte [ ] buff , int option , int lifetime , Oid mech , int usage ) throws GSSException { checkMechanism ( mech ) ; if ( buff == null || buff . length < 1 ) { throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "invalidBuf" ) ; } if ( lifeti...
Imports a credential .
39,391
public static void checkMechanism ( Oid mech ) throws GSSException { if ( mech != null && ! mech . equals ( GSSConstants . MECH_OID ) ) { throw new GSSException ( GSSException . BAD_MECH ) ; } }
Checks if the specified mechanism matches the mechanism supported by this implementation .
39,392
public boolean add ( AbstractRslNode node ) { if ( _specifications == null ) _specifications = new LinkedList ( ) ; return _specifications . add ( node ) ; }
Adds a rsl parse tree to this node .
39,393
public boolean removeSpecification ( AbstractRslNode node ) { if ( _specifications == null || node == null ) return false ; return _specifications . remove ( node ) ; }
Removes a specific sub - specification tree from the sub - specification list .
39,394
public static String canonicalize ( String str ) { if ( str == null ) return null ; int length = str . length ( ) ; char ch ; StringBuffer buf = new StringBuffer ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { ch = str . charAt ( i ) ; if ( ch == '_' ) continue ; buf . append ( Character . toLowerCase ( ch ) ) ; }...
Canonicalizes a string by removing any underscores and moving all characters to lowercase .
39,395
public void waitFor ( Flag flag , int waitDelay ) throws ServerException , IOException , InterruptedException { waitFor ( flag , waitDelay , WAIT_FOREVER ) ; }
Return when reply is waiting
39,396
public void setupMessageContextImpl ( MessageContext mc , Call call , AxisEngine engine ) throws AxisFault { if ( action != null ) { mc . setUseSOAPAction ( true ) ; mc . setSOAPActionURI ( action ) ; } if ( cookie != null ) mc . setProperty ( HTTPConstants . HEADER_COOKIE , cookie ) ; if ( cookie2 != null ) mc . setPr...
Set up any transport - specific derived properties in the message context .
39,397
public ASN1Primitive toASN1Primitive ( ) { ASN1EncodableVector vec = new ASN1EncodableVector ( ) ; vec . add ( this . policyLanguage ) ; if ( this . policy != null ) { vec . add ( this . policy ) ; } return new DERSequence ( vec ) ; }
Returns the DER - encoded ASN . 1 representation of proxy policy .
39,398
public String toFtpCmdArgument ( ) { StringBuffer msg = new StringBuffer ( ) ; msg . append ( "|" ) ; if ( this . version != null ) { msg . append ( this . version ) ; } msg . append ( "|" ) ; if ( this . host != null ) { msg . append ( this . host ) ; } msg . append ( "|" ) ; msg . append ( String . valueOf ( this . p...
Returns the host - port information in the format used by EPRT command . &lt ; d&gt ; &lt ; net - prt&gt ; &lt ; d&gt ; &lt ; net - addr&gt ; &lt ; d&gt ; &lt ; tcp - port&gt ; &lt ; d&gt ;
39,399
public static void shutdown ( GSSCredential cred , GlobusURL gassURL ) throws IOException , GSSException { OutputStream output = null ; InputStream input = null ; Socket socket = null ; try { if ( gassURL . getProtocol ( ) . equalsIgnoreCase ( "https" ) ) { GSSManager manager = ExtendedGSSManager . getInstance ( ) ; Ex...
Shutdowns a remote gass server . The server must have the CLIENT_SHUTDOWN option enabled for this to work .