Package org.globus.gsi.gridmap
Class GridMap
- java.lang.Object
-
- org.globus.gsi.gridmap.GridMap
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
GridMapLocal
public class GridMap extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
GridMap.GridMapEntry
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
COMMENT_CHARS
private static java.lang.String
EMAIL_KEYWORD
private static char[]
EMAIL_KEYWORD_1
private static int
EMAIL_KEYWORD_1_L
private static char[]
EMAIL_KEYWORD_2
private static int
EMAIL_KEYWORD_2_L
private java.io.File
file
private static I18n
i18n
private boolean
ignoreErrors
private long
lastModified
private static org.apache.commons.logging.Log
logger
protected java.util.Map
map
private static char[]
UID_KEYWORD
private static int
UID_KEYWORD_L
private static java.lang.String
USERID_KEYWORD
-
Constructor Summary
Constructors Constructor Description GridMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkUser(java.lang.String globusID, java.lang.String userID)
Checks if a given globus ID is associated with given local user account.java.lang.String[]
getAllGlobusID(java.lang.String userID)
Returns all globus IDs associated with the specified local user name.static java.lang.String
getDefaultGridMapLocation()
java.lang.String
getFileName()
java.lang.String
getGlobusID(java.lang.String userID)
Returns globus ID associated with the specified local user name.boolean
getIgnoreErrors()
Returns whether errors in the gridmap file are ignored.java.lang.String
getUserID(java.lang.String globusID)
Returns first local user name mapped to the specified globusID.java.lang.String[]
getUserIDs(java.lang.String globusID)
Returns local user names mapped to the specified globusID.private static boolean
keyWordPresent(char[] args, int startIndex, char[] keyword, int length)
boolean
load(java.io.File file)
Loads grid map definition from a given file.boolean
load(java.io.InputStream input)
Loads grid map file definition from a given input stream.boolean
load(java.lang.String file)
Loads grid map definition from a given file.void
map(java.lang.String globusID, java.lang.String userID)
static java.lang.String
normalizeDN(java.lang.String globusID)
boolean
refresh()
void
setIgnoreErrors(boolean ignoreErrors)
Sets whether errors in the gridmap file should be ignored.
-
-
-
Field Detail
-
i18n
private static I18n i18n
-
logger
private static org.apache.commons.logging.Log logger
-
COMMENT_CHARS
private static final java.lang.String COMMENT_CHARS
- See Also:
- Constant Field Values
-
EMAIL_KEYWORD_1
private static final char[] EMAIL_KEYWORD_1
-
EMAIL_KEYWORD_2
private static final char[] EMAIL_KEYWORD_2
-
UID_KEYWORD
private static final char[] UID_KEYWORD
-
EMAIL_KEYWORD_1_L
private static final int EMAIL_KEYWORD_1_L
- See Also:
- Constant Field Values
-
EMAIL_KEYWORD_2_L
private static final int EMAIL_KEYWORD_2_L
- See Also:
- Constant Field Values
-
UID_KEYWORD_L
private static final int UID_KEYWORD_L
- See Also:
- Constant Field Values
-
EMAIL_KEYWORD
private static final java.lang.String EMAIL_KEYWORD
- See Also:
- Constant Field Values
-
USERID_KEYWORD
private static final java.lang.String USERID_KEYWORD
- See Also:
- Constant Field Values
-
map
protected java.util.Map map
-
file
private java.io.File file
-
lastModified
private long lastModified
-
ignoreErrors
private boolean ignoreErrors
-
-
Method Detail
-
setIgnoreErrors
public void setIgnoreErrors(boolean ignoreErrors)
Sets whether errors in the gridmap file should be ignored. Errors are not ignored by default.- Parameters:
ignoreErrors
- if true, errors in the gridmap file will be ignored (warnings will be logged). If false, an exception will be raised on errors.
-
getIgnoreErrors
public boolean getIgnoreErrors()
Returns whether errors in the gridmap file are ignored.- Returns:
- true if errors in the gridmap file are ignored. False, otherwise.
-
getFileName
public java.lang.String getFileName()
Returns the absolute path anme of file used to load gridmap either using theload
orload
functions. If no file was used, returns null.- Returns:
- absolute file path, if gridmap was loaded from file. Null otherwise.
-
load
public boolean load(java.lang.String file) throws java.io.IOException
Loads grid map definition from a given file.- Parameters:
file
- the grid map file- Returns:
- true if the file was parsed and loaded successfully. False otherwise.
- Throws:
java.io.IOException
- in case of I/O error or when there are parsing errors in the file (only when errors are not ignored).
-
load
public boolean load(java.io.File file) throws java.io.IOException
Loads grid map definition from a given file.- Parameters:
file
- the grid map file- Returns:
- true if the file was parsed and loaded successfully. False otherwise.
- Throws:
java.io.IOException
- in case of I/O error or when there are parsing errors in the file (only when errors are not ignored).
-
refresh
public boolean refresh() throws java.io.IOException
Reloads the gridmap from a file only if the gridmap was initially loaded using theload
orload
functions. The file will only be reloaded if it has changed since the last time.- Returns:
- true if the file was parsed and refreshed successfully. False otherwise.
- Throws:
java.io.IOException
- in case of I/O error or when there are parsing errors in the file (only when errors are not ignored).
-
load
public boolean load(java.io.InputStream input) throws java.io.IOException
Loads grid map file definition from a given input stream. The input stream is not closed in case of an error.- Parameters:
input
- the input stream that contains the gridmap definitions.- Returns:
- true if the input was parsed successfully. False otherwise.
- Throws:
java.io.IOException
- in case of I/O error or when there are parsing errors in the input (only when errors are not ignored).
-
getUserID
public java.lang.String getUserID(java.lang.String globusID)
Returns first local user name mapped to the specified globusID.- Parameters:
globusID
- globusID- Returns:
- local user name for the specified globusID. Null if the globusID is not mapped to a local user name.
-
getUserIDs
public java.lang.String[] getUserIDs(java.lang.String globusID)
Returns local user names mapped to the specified globusID.- Parameters:
globusID
- globusID- Returns:
- array of local user names for the specified globusID. Null if the globusID is not mapped to any local user name.
-
checkUser
public boolean checkUser(java.lang.String globusID, java.lang.String userID)
Checks if a given globus ID is associated with given local user account.- Parameters:
globusID
- globus IDuserID
- userID- Returns:
- true if globus ID is associated with given local user account, false, otherwise.
-
getGlobusID
public java.lang.String getGlobusID(java.lang.String userID)
Returns globus ID associated with the specified local user name.- Parameters:
userID
- local user name- Returns:
- associated globus ID, null if there is not any.
-
getAllGlobusID
public java.lang.String[] getAllGlobusID(java.lang.String userID)
Returns all globus IDs associated with the specified local user name.- Parameters:
userID
- local user name- Returns:
- associated globus ID, null if there is not any.
-
map
public void map(java.lang.String globusID, java.lang.String userID)
-
keyWordPresent
private static boolean keyWordPresent(char[] args, int startIndex, char[] keyword, int length)
-
normalizeDN
public static java.lang.String normalizeDN(java.lang.String globusID)
-
getDefaultGridMapLocation
public static java.lang.String getDefaultGridMapLocation()
-
-