Package com.perforce.p4java.server
Class AbstractAuthHelper
java.lang.Object
com.perforce.p4java.server.AbstractAuthHelper
- Direct Known Subclasses:
AuthTicketsHelper,FingerprintsHelper
This super class is designed to lookup auth entries from file or memory.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFileEntries(File authFile) Get all the auth entries found in the specified auth file.getMemoryEntries(Map<String, String> authMap) Get all the auth entries found in the specified auth store in memory.Get the auth entry in the specified auth map that matches the specified user name and server address.protected static voidsaveFileEntry(String userName, String serverAddress, String authValue, File authFile, int lockTry, long lockDelay, long lockWait) Save the specified parameters as an entry into the specified auth file.protected static voidsaveMemoryEntry(String userName, String serverAddress, String authValue, Map<String, String> authMap) Save the specified parameters as an entry into the specified auth map.
-
Field Details
-
DEFAULT_LOCK_TRY
public static final int DEFAULT_LOCK_TRY- See Also:
-
DEFAULT_LOCK_DELAY
public static final long DEFAULT_LOCK_DELAY- See Also:
-
DEFAULT_LOCK_WAIT
public static final long DEFAULT_LOCK_WAIT- See Also:
-
SERVER_ADDRESS_MAP_KEY
- See Also:
-
USER_NAME_MAP_KEY
- See Also:
-
AUTH_VALUE_MAP_KEY
- See Also:
-
-
Constructor Details
-
AbstractAuthHelper
public AbstractAuthHelper()
-
-
Method Details
-
getMemoryEntry
protected static Map<String,String> getMemoryEntry(String userName, String serverAddress, Map<String, String> authMap) Get the auth entry in the specified auth map that matches the specified user name and server address. The user name be non-null and the server address must be non-null and be of the form server:port.- Parameters:
userName- userNameserverAddress- serverAddressauthMap- authMap- Returns:
- - list of auth entries found in the specified auth map
-
getMemoryEntries
Get all the auth entries found in the specified auth store in memory.- Parameters:
authMap- authMap- Returns:
- - list of auth entries found in the specified auth map
-
saveMemoryEntry
protected static void saveMemoryEntry(String userName, String serverAddress, String authValue, Map<String, String> authMap) Save the specified parameters as an entry into the specified auth map. This method will add or replace the current entry for the user name and server address in the auth map. If the specified auth value is null then the current entry (if exits) in the specified map will be removed.- Parameters:
userName- - non-null user nameserverAddress- - non-null server addressauthValue- - possibly null auth valueauthMap- - non-null auth map
-
getFileEntries
Get all the auth entries found in the specified auth file.- Parameters:
authFile- authFile- Returns:
- - list of auth entries found in the specified auth file
- Throws:
IOException- - io exception from reading auth file
-
saveFileEntry
protected static void saveFileEntry(String userName, String serverAddress, String authValue, File authFile, int lockTry, long lockDelay, long lockWait) throws IOException Save the specified parameters as an entry into the specified auth file. This method will replace the current entry for the user name and server address in the auth file. If a current entry is not found then the specified entry will be appended to the file. If the specified auth value is null then the current entry in the specified file will be removed if found.- Parameters:
userName- - non-null user nameserverAddress- - non-null server addressauthValue- - possibly null auth valueauthFile- - non-null filelockTry- lockTrylockDelay- lockDelaylockWait- lockWait- Throws:
IOException- on error
-