01: /**
02: * $RCSfile$
03: * $Revision: $
04: * $Date: $
05: *
06: * Copyright (C) 2007 Jive Software. All rights reserved.
07: *
08: * This software is published under the terms of the GNU Public License (GPL),
09: * a copy of which is included in this distribution.
10: */package org.jivesoftware.openfire.sip.tester.security;
11:
12: import java.util.Vector;
13:
14: /**
15: * Used to cache credentials through a call.
16: *
17: * @author Emil Ivov <emcho@dev.java.net>
18: * @version 1.0
19: */
20: class CredentialsCacheEntry {
21: // The header that was used last time
22: // AuthorizationHeader authorization = null;
23:
24: UserCredentials userCredentials = null;
25:
26: /**
27: * The transactionHistory list contains transactions where the entry has
28: * been and that had not yet been responded to (or at least the response has
29: * not reached this class). The transactionHistory's elements are Strings
30: * corresponding to branch ids.
31: */
32: private Vector transactionHistory = new Vector();
33:
34: /**
35: * Adds the specified branch id to the transaction history list.
36: *
37: * @param requestBranchID the id to add to the list of uncofirmed transactions.
38: */
39: void processRequest(String requestBranchID) {
40: transactionHistory.add(requestBranchID);
41: }
42:
43: /**
44: * Determines whether these credentials have been used for the specified
45: * transaction. If yes - the transaction is removed and true is returned.
46: * Otherwise we return false.
47: *
48: * @param responseBranchID the branchi id of the response to process.
49: * @return true if this entry hase been used for the transaction.
50: */
51: boolean processResponse(String responseBranchID) {
52: return transactionHistory.remove(responseBranchID);
53: }
54: }
|