Package com.perforce.p4java.server
Class FingerprintsHelper
java.lang.Object
com.perforce.p4java.server.AbstractAuthHelper
com.perforce.p4java.server.FingerprintsHelper
This class is designed to lookup fingerprints from a trust file or the
in-memory fingerprints map. If a null trust file parameter is passed to the
methods, the in-memory fingerprints map will be used instead.
-
Field Summary
Fields inherited from class com.perforce.p4java.server.AbstractAuthHelper
AUTH_VALUE_MAP_KEY, DEFAULT_LOCK_DELAY, DEFAULT_LOCK_TRY, DEFAULT_LOCK_WAIT, SERVER_ADDRESS_MAP_KEY, USER_NAME_MAP_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FingerprintgetFingerprint(String serverAddress, String trustFilePath) Get the first found fingerprint in the specified fingerprint file that matches the specified server address.static FingerprintgetFingerprint(String userName, String serverAddress, String trustFilePath) Get the first found fingerprint in the specified trust file that matches the specified user name and server address.static Fingerprint[]getFingerprints(File trustFile) Get all the fingerprints found in the specified file.static Fingerprint[]getFingerprints(String trustFilePath) Get all the fingerprints found in the file at the specified file path.static StringgetFingerprintValue(String userName, String serverAddress, String trustFilePath) Get the first found fingerprint value that matches the specified user name and server address.static voidsaveFingerprint(Fingerprint fingerprint, File trustFile) Save the specified fingerprint as an entry into the specified trust file.static voidsaveFingerprint(Fingerprint fingerprint, String trustFilePath) Save the specified fingerprint as an entry into the specified trust file.static voidsaveFingerprint(String userName, String serverAddress, String fingerprintValue, File trustFile) Save the specified parameters as an entry into the specified trust file.static voidsaveFingerprint(String userName, String serverAddress, String fingerprintValue, File trustFile, int lockTry, long lockDelay, long lockWait) Save the specified parameters as an entry into the specified trust file.static voidsaveFingerprint(String userName, String serverAddress, String fingerprintValue, String trustFilePath) Save the specified parameters as an entry into the specified trust file.static voidsaveFingerprint(String userName, String serverAddress, String fingerprintValue, String trustFilePath, int lockTry, long lockDelay, long lockWait) Save the specified parameters as an entry into the specified trust file.Methods inherited from class com.perforce.p4java.server.AbstractAuthHelper
getFileEntries, getMemoryEntries, getMemoryEntry, saveFileEntry, saveMemoryEntry
-
Constructor Details
-
FingerprintsHelper
public FingerprintsHelper()
-
-
Method Details
-
getFingerprintValue
public static String getFingerprintValue(String userName, String serverAddress, String trustFilePath) throws IOException Get the first found fingerprint value 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- serverAddresstrustFilePath- trustFilePath- Returns:
- - fingerprint value or null if not found
- Throws:
IOException- - io exception from reading trust file
-
getFingerprints
Get all the fingerprints found in the file at the specified file path.- Parameters:
trustFilePath- trustFilePath- Returns:
- - array of fingerprints found in the specified trust file at the specified path
- Throws:
IOException- - io exception from reading trust file
-
getFingerprints
Get all the fingerprints found in the specified file.- Parameters:
trustFile- trustFile- Returns:
- - array of fingerprints found in the specified trust file
- Throws:
IOException- - io exception from reading trust file
-
getFingerprint
public static Fingerprint getFingerprint(String userName, String serverAddress, String trustFilePath) throws IOException Get the first found fingerprint in the specified trust file that matches the specified user name and server address. The server address must be non-null and be of the form server:port. The user name may be null and if that is the case the found first fingerprint for the specified server address will be returned.- Parameters:
userName- - possibly null user name to match against the found fingerprintsserverAddress- - non-null server addresstrustFilePath- - path to trust file to search- Returns:
- - found fingerprint or null if not found
- Throws:
IOException- - io exception from reading trust file
-
getFingerprint
public static Fingerprint getFingerprint(String serverAddress, String trustFilePath) throws IOException Get the first found fingerprint in the specified fingerprint file that matches the specified server address. The server address must be non-null and be of the form server:port.- Parameters:
serverAddress- - non-null server addresstrustFilePath- - path to trust file to search- Returns:
- - found fingerprint or null if not found
- Throws:
IOException- - io exception from reading trust file
-
saveFingerprint
public static void saveFingerprint(Fingerprint fingerprint, String trustFilePath) throws IOException Save the specified fingerprint as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file.- Parameters:
fingerprint- - non-null fingerprinttrustFilePath- - non-null path- Throws:
IOException- on error
-
saveFingerprint
Save the specified fingerprint as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file.- Parameters:
fingerprint- - non-null fingerprinttrustFile- - non-null file- Throws:
IOException- on error
-
saveFingerprint
public static void saveFingerprint(String userName, String serverAddress, String fingerprintValue, String trustFilePath) throws IOException Save the specified parameters as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file.- Parameters:
userName- - non-null user nameserverAddress- - non-null server addressfingerprintValue- - non-null fingerprint valuetrustFilePath- - non-null file path- Throws:
IOException- on error
-
saveFingerprint
public static void saveFingerprint(String userName, String serverAddress, String fingerprintValue, String trustFilePath, int lockTry, long lockDelay, long lockWait) throws IOException Save the specified parameters as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file.- Parameters:
userName- - non-null user nameserverAddress- - non-null server addressfingerprintValue- - non-null fingerprint valuetrustFilePath- - non-null file pathlockTry- - number of tries for lockinglockDelay- - delay time (ms) for lockinglockWait- - wait time (ms) for other process/thread to finish locking- Throws:
IOException- on error
-
saveFingerprint
public static void saveFingerprint(String userName, String serverAddress, String fingerprintValue, File trustFile) throws IOException Save the specified parameters as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file. If the specified fingerprint 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 addressfingerprintValue- - possibly null fingerprint valuetrustFile- - non-null file- Throws:
IOException- on error
-
saveFingerprint
public static void saveFingerprint(String userName, String serverAddress, String fingerprintValue, File trustFile, int lockTry, long lockDelay, long lockWait) throws IOException Save the specified parameters as an entry into the specified trust file. This method will replace the current entry for the user name and server address in the trust file. If a current entry is not found then the specified entry will be appended to the file. If the specified fingerprint 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 addressfingerprintValue- - possibly null fingerprint valuetrustFile- - non-null filelockTry- - number of tries for lockinglockDelay- - delay time (ms) for lockinglockWait- - wait time (ms) for other process/thread to finish locking- Throws:
IOException- on error
-