nl.uva.vlet.vrs
Class ServerInfo

java.lang.Object
  extended by nl.uva.vlet.vrs.ServerInfo

public class ServerInfo
extends java.lang.Object

ServerInfo class to keep record of server accounts. Note that multiuser account on same server is currently not supported. Only one use account per server is kept.


Field Summary
static java.lang.String ATTR_DEFAULTRESOURCE
           
static java.lang.String ATTR_HOSTNAME
           
static java.lang.String ATTR_MCATZONE
           
static java.lang.String ATTR_MDASCOLLECTIONHOME
           
static java.lang.String ATTR_MDASDOMAINHOME
           
static java.lang.String ATTR_MDASDOMAINNAME
           
static java.lang.String ATTR_PASSIVE_MODE
           
static java.lang.String ATTR_PATH
          Path for ServerInfo is default user's home (~/...)
static java.lang.String ATTR_PERSISTANT
           
static java.lang.String ATTR_PORT
           
static java.lang.String ATTR_USERNAME
           
static java.lang.String AUTH_SCHEME
           
static java.lang.String[] authSchemes
           
static java.lang.String GSI_AUTH
          This is an Attribute Value, not a type name
static java.lang.String OLD_ATTR_FORCE_SINGLE_STREAM
           
static java.lang.String PASSWORD_AUTH
          This is an Attribute Value, not a type name
 
Constructor Summary
protected ServerInfo()
           
  ServerInfo(ServerInfo info)
          Constructs default authentication info for VRL
  ServerInfo(java.lang.String scheme, java.lang.String host, int port, java.lang.String user, java.lang.String passwd, java.lang.String passp)
           
  ServerInfo(VAttribute[] attrs)
          Constructs default authentication info for VRL
  ServerInfo(VRL location)
          Constructs default authentication info for VRL
 
Method Summary
 void addAttributes(VAttributeSet set)
           
static void checkGlobalAttribute(VAttribute attr)
          Check and update Global vs ServerInfo Attribute
 void checkUpdateServerAttributes()
          Checks and sets Server Attributes.
 void copyFrom(ServerInfo source)
           
static java.lang.String createAccountID(java.lang.String scheme, java.lang.String server, int port, java.lang.String username)
          Creates unique server id.
static java.lang.String createAccountID(VRL location)
           
 java.lang.String getAuthScheme()
           
 java.lang.String getDefaultResource()
           
 int getIntValue(java.lang.String name, int defVal)
           
 java.lang.String getMdasDomainName()
           
 java.lang.String getPassphrase()
           
 java.lang.String getPassword()
           
 java.lang.String getProperty(java.lang.String name)
           
 VAttribute getServerAttribute(java.lang.String name)
           
 java.lang.String[] getServerAttributeNames()
           
 VAttribute[] getServerAttributes()
          Only return server attributes without authentication attributes
 java.lang.String getServerHostname()
           
 java.lang.String getServerID()
           
static ServerInfo getServerInfoFor(java.lang.String accountID)
          Use AccountID to get the ServerInformation
static ServerInfo getServerInfoFor(VRL location, boolean autoCreate)
          Use location to get ServerInformation
static ServerInfo getServerInfoForScheme(java.lang.String scheme)
          Return 1st ServerInfo object for the specified Scheme.
 int getServerPort()
           
 java.lang.String getServerScheme()
           
 java.lang.String getServerUserinfo()
          Return username + optional domainname info.
 java.lang.String getServerUsername()
          Returns real username, without optional domainname.
 boolean getUsePassiveMode(boolean defVal)
           
 java.lang.String getValue(java.lang.String name)
           
 boolean hasValidAuthentication()
          Returns whether authentication information is valid.
 boolean isAuthenticationNeeded()
          Returns true whether interactive authentication is needed.
 void removeServerAttribute(java.lang.String attrName)
          Remove Atrtribute from attribute hash
 void setAuthScheme(java.lang.String authStr)
          TODO: Scan all accounts which matches specified server: public static ServerInfo[] getAccountForServer(String service,String host,int port) { for(ServerInfo info:servers); }
 void setHasValidAuthentication(boolean val)
           
 void setMdasDomainHome(java.lang.String name)
           
 void setMdasDomainName(java.lang.String name)
           
 void setPassphrase(java.lang.String passphrase)
           
 void setPassword(java.lang.String passwd)
           
 void setServerAttribute(VAttribute attr)
          Sets serverAttributes.
 void setServerAttributeNames(java.lang.String[] names)
          Set the attributes which are mandatory for this server
 void setServerAttributes(VAttribute[] attrs)
          Sets server Attributes.
 void setServerHostname(java.lang.String name)
           
 void setServerPort(int port)
           
 void setServerScheme(java.lang.String scheme)
           
 void setServerUsername(java.lang.String user)
           
 void setUseGSIAuth()
           
 void setUseNoAuth()
           
 void setUsePasswordAuth()
           
 ServerInfo storeServerInfo()
          Stores this object in the ServerInfo hash
 java.lang.String toString()
           
 boolean useGSIAuth()
           
 boolean usePasswordAuth()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_PERSISTANT

public static final java.lang.String ATTR_PERSISTANT
See Also:
Constant Field Values

ATTR_USERNAME

public static final java.lang.String ATTR_USERNAME
See Also:
Constant Field Values

ATTR_HOSTNAME

public static final java.lang.String ATTR_HOSTNAME
See Also:
Constant Field Values

ATTR_PORT

public static final java.lang.String ATTR_PORT
See Also:
Constant Field Values

ATTR_PATH

public static final java.lang.String ATTR_PATH
Path for ServerInfo is default user's home (~/...)

See Also:
Constant Field Values

ATTR_MDASDOMAINNAME

public static final java.lang.String ATTR_MDASDOMAINNAME
See Also:
Constant Field Values

ATTR_MDASDOMAINHOME

public static final java.lang.String ATTR_MDASDOMAINHOME
See Also:
Constant Field Values

ATTR_MDASCOLLECTIONHOME

public static final java.lang.String ATTR_MDASCOLLECTIONHOME
See Also:
Constant Field Values

ATTR_DEFAULTRESOURCE

public static final java.lang.String ATTR_DEFAULTRESOURCE
See Also:
Constant Field Values

ATTR_MCATZONE

public static final java.lang.String ATTR_MCATZONE
See Also:
Constant Field Values

PASSWORD_AUTH

public static final java.lang.String PASSWORD_AUTH
This is an Attribute Value, not a type name

See Also:
Constant Field Values

GSI_AUTH

public static final java.lang.String GSI_AUTH
This is an Attribute Value, not a type name

See Also:
Constant Field Values

authSchemes

public static final java.lang.String[] authSchemes

AUTH_SCHEME

public static final java.lang.String AUTH_SCHEME
See Also:
Constant Field Values

ATTR_PASSIVE_MODE

public static final java.lang.String ATTR_PASSIVE_MODE
See Also:
Constant Field Values

OLD_ATTR_FORCE_SINGLE_STREAM

public static final java.lang.String OLD_ATTR_FORCE_SINGLE_STREAM
See Also:
Constant Field Values
Constructor Detail

ServerInfo

protected ServerInfo()

ServerInfo

public ServerInfo(VRL location)
Constructs default authentication info for VRL


ServerInfo

public ServerInfo(ServerInfo info)
Constructs default authentication info for VRL


ServerInfo

public ServerInfo(VAttribute[] attrs)
Constructs default authentication info for VRL


ServerInfo

public ServerInfo(java.lang.String scheme,
                  java.lang.String host,
                  int port,
                  java.lang.String user,
                  java.lang.String passwd,
                  java.lang.String passp)
Method Detail

getServerInfoFor

public static ServerInfo getServerInfoFor(VRL location,
                                          boolean autoCreate)
Use location to get ServerInformation

Parameters:
autoCreate -

getServerInfoFor

public static ServerInfo getServerInfoFor(java.lang.String accountID)
Use AccountID to get the ServerInformation


createAccountID

public static java.lang.String createAccountID(VRL location)

createAccountID

public static java.lang.String createAccountID(java.lang.String scheme,
                                               java.lang.String server,
                                               int port,
                                               java.lang.String username)
Creates unique server id. Host+Port combination should uniquely identify server. For savegaurd the service type or scheme is added also to the server id. avoiding mixup of servers if no port is supplied since this means the 'default' port.

Parameters:
user -

getServerInfoForScheme

public static ServerInfo getServerInfoForScheme(java.lang.String scheme)
Return 1st ServerInfo object for the specified Scheme. Is used to find *any* server of the specified protocol.

Parameters:
scheme -
Returns:
ServerInfo object

copyFrom

public void copyFrom(ServerInfo source)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String passwd)

getServerPort

public int getServerPort()

setServerPort

public void setServerPort(int port)

getServerHostname

public java.lang.String getServerHostname()

setServerHostname

public void setServerHostname(java.lang.String name)

getServerUsername

public java.lang.String getServerUsername()
Returns real username, without optional domainname. To get full userinfo, use getUserinfo(); In most cases the user info part is the same as the user name, except for SRB locations where getUsername() returns only the user and not the domain part of the userinfo.

Returns:
real username part of userinfo.

getServerUserinfo

public java.lang.String getServerUserinfo()
Return username + optional domainname info. This methods returns the same userinfo as defined in the VRL. For SRB Servers this includes the domain part.


setServerUsername

public void setServerUsername(java.lang.String user)

getServerScheme

public java.lang.String getServerScheme()

setServerScheme

public void setServerScheme(java.lang.String scheme)

usePasswordAuth

public boolean usePasswordAuth()

setUsePasswordAuth

public void setUsePasswordAuth()

getPassphrase

public java.lang.String getPassphrase()

setPassphrase

public void setPassphrase(java.lang.String passphrase)

getServerAttributes

public VAttribute[] getServerAttributes()
Only return server attributes without authentication attributes


setServerAttributes

public void setServerAttributes(VAttribute[] attrs)
Sets server Attributes. Merges with current serverAttributes


setServerAttribute

public void setServerAttribute(VAttribute attr)
Sets serverAttributes. Does not update serverAttributeNames


storeServerInfo

public ServerInfo storeServerInfo()
Stores this object in the ServerInfo hash

Returns:
previous object.

isAuthenticationNeeded

public boolean isAuthenticationNeeded()
Returns true whether interactive authentication is needed. This is the case for:
- useGSIAuth=true and the current proxy is invalid
- usePassword==true and no password or passphrase is specified


setHasValidAuthentication

public void setHasValidAuthentication(boolean val)

hasValidAuthentication

public boolean hasValidAuthentication()
Returns whether authentication information is valid. This means a succesfull authentication has been performed. When the authentication fails, the isValid will be set to false, to indicate a non-valid authentication.


getServerAttribute

public VAttribute getServerAttribute(java.lang.String name)

setServerAttributeNames

public void setServerAttributeNames(java.lang.String[] names)
Set the attributes which are mandatory for this server


getServerAttributeNames

public java.lang.String[] getServerAttributeNames()

removeServerAttribute

public void removeServerAttribute(java.lang.String attrName)
Remove Atrtribute from attribute hash


getServerID

public java.lang.String getServerID()

checkUpdateServerAttributes

public void checkUpdateServerAttributes()
Checks and sets Server Attributes. Adds new Server Attributes (upgrade) if the value wasn't stored yet. Uses VRS.getDefaultServerAttributes() to check against.


getProperty

public java.lang.String getProperty(java.lang.String name)

getValue

public java.lang.String getValue(java.lang.String name)

getIntValue

public int getIntValue(java.lang.String name,
                       int defVal)

getUsePassiveMode

public boolean getUsePassiveMode(boolean defVal)

addAttributes

public void addAttributes(VAttributeSet set)

getMdasDomainName

public java.lang.String getMdasDomainName()

setMdasDomainName

public void setMdasDomainName(java.lang.String name)

setMdasDomainHome

public void setMdasDomainHome(java.lang.String name)

setAuthScheme

public void setAuthScheme(java.lang.String authStr)
TODO: Scan all accounts which matches specified server: public static ServerInfo[] getAccountForServer(String service,String host,int port) { for(ServerInfo info:servers); }


setUseGSIAuth

public void setUseGSIAuth()

setUseNoAuth

public void setUseNoAuth()

getAuthScheme

public java.lang.String getAuthScheme()

useGSIAuth

public boolean useGSIAuth()

getDefaultResource

public java.lang.String getDefaultResource()

checkGlobalAttribute

public static void checkGlobalAttribute(VAttribute attr)
Check and update Global vs ServerInfo Attribute


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object