org.griphyn.cPlanner.engine
Class Authenticate

java.lang.Object
  extended by org.griphyn.cPlanner.engine.Authenticate

public class Authenticate
extends Object

It takes in a authenticate request and authenticates against the resource on the basis of the type of the resource against which authentication is required.

Version:
$Revision: 50 $
Author:
Karan Vahi

Nested Class Summary
(package private)  class Authenticate.HostPort
          A convenience inner class that stores the host and the port associated with a server.
 
Field Summary
static int GRID_FTP_STANDARD_PORT
          The standard port at which Grid FTP runs.
private  AuthenticateRequest mAuthRequest
          The object containing the authenticate request.
private  GSSCredential mCredential
          The credential to be used while authentication to jobmanager.
private  LogManager mLogger
          The handle to the LogManager object.
private  PoolInfoProvider mPoolHandle
          The handle to the Pool Info Provider.
private  PegasusProperties mProps
          The handle to the PegasusProperties object.
private  int mTimeout
          The timeout value that is to be used in milliseconds
static int TIMEOUT_VALUE
          The timeout in seconds.
 
Constructor Summary
Authenticate(PegasusProperties properties, PoolInfoProvider poolHandle)
          The overloaded constructor.
 
Method Summary
 boolean authenticate(AuthenticateRequest ar)
          Authenticates against a resource referred to in the authenticate request object.
 boolean authenticateJobManager(String contact)
          It authenticates against the jobmanager specifyied.
private  String combine(String host, int port)
          A small helper method that returns the standard host and port combination to be used for logging purposes.
private  Authenticate.HostPort getHostPort(String urlPrefix)
          Determines the hostname from the urlPrefix string in the pool file.
 boolean gridFTPAlive(String host, int port)
          It checks with a grid ftp server running at a particular host and port, to see if it is up or not.
static void main(String[] args)
           
private  boolean parseGridFTPResponse(String response, char type)
          The parses the grid ftp server response and returns if the response was valid or not.
 boolean removeResource(AuthenticateRequest ar)
          It tries to remove a resource from the soft state of the pool.
 void setCredential(GSSCredential credential)
          Sets the credential that has to be used for authentication.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID_FTP_STANDARD_PORT

public static final int GRID_FTP_STANDARD_PORT
The standard port at which Grid FTP runs.

See Also:
Constant Field Values

TIMEOUT_VALUE

public static final int TIMEOUT_VALUE
The timeout in seconds. All sockets opened timeout after this period.

See Also:
Constant Field Values

mTimeout

private int mTimeout
The timeout value that is to be used in milliseconds


mAuthRequest

private AuthenticateRequest mAuthRequest
The object containing the authenticate request.


mPoolHandle

private PoolInfoProvider mPoolHandle
The handle to the Pool Info Provider.


mLogger

private LogManager mLogger
The handle to the LogManager object.


mProps

private PegasusProperties mProps
The handle to the PegasusProperties object.


mCredential

private GSSCredential mCredential
The credential to be used while authentication to jobmanager.

Constructor Detail

Authenticate

public Authenticate(PegasusProperties properties,
                    PoolInfoProvider poolHandle)
The overloaded constructor.

Parameters:
properties - the PegasusProperties to be used.
Method Detail

setCredential

public void setCredential(GSSCredential credential)
Sets the credential that has to be used for authentication.

Parameters:
credential - the credential to be set.

authenticate

public boolean authenticate(AuthenticateRequest ar)
Authenticates against a resource referred to in the authenticate request object.


removeResource

public boolean removeResource(AuthenticateRequest ar)
It tries to remove a resource from the soft state of the pool. This is possible only if the underlying pool interface implementation is soft state.

Parameters:
ar - the AuthenticateRequest containing the resource info
Returns:
boolean true removal was successful. false unable to remove.

authenticateJobManager

public boolean authenticateJobManager(String contact)
It authenticates against the jobmanager specifyied.

Parameters:
contact - the jobmanager contact.

gridFTPAlive

public boolean gridFTPAlive(String host,
                            int port)
It checks with a grid ftp server running at a particular host and port, to see if it is up or not. This is done by opening a socket to the specified host at the specified port. If the socket timesout (which could be due to excessive load on the server or server being hung) false is returned.

Parameters:
host - the host at which the gridftp server is running .
port - the port at which server is running on the host.
Returns:
true the gridftp server is alive and kicking. false - the submit host is not connected to the network. - the server is not running. - we were able to connect but timeout. - version is not compatible.

parseGridFTPResponse

private boolean parseGridFTPResponse(String response,
                                     char type)
The parses the grid ftp server response and returns if the response was valid or not.

Parameters:
response - the response got from the grid ftp server.
type - c response when first connected to server. q response when sent the quit command.
Returns:
boolean true if the response was valid false invalid response.

combine

private String combine(String host,
                       int port)
A small helper method that returns the standard host and port combination to be used for logging purposes.

Parameters:
host - the host.
port - the port.
Returns:
combined string.

getHostPort

private Authenticate.HostPort getHostPort(String urlPrefix)
Determines the hostname from the urlPrefix string in the pool file.

Parameters:
urlPrefix - the protocol, hostname and port combination.
Returns:
the host name.

main

public static void main(String[] args)


Copyright © 2007 The University of Southern California. All Rights Reserved.