Changeset 28880

Show
Ignore:
Timestamp:
06.03.2014 14:05:12 (6 years ago)
Author:
kjdon
Message:

added a field in data for initial time that resumption token started - so we can check if a collection has changed since the token was issued. Currently just the token name as the current time is used for token name. added method to manually expire a token - if a collection has changed since the token was issued that expire the token as they should reissue the request from the beginning.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIResumptionToken.java

    r28874 r28880  
    4949  public static final String NAME = "name"; 
    5050  public static final String EXPIRATION = "expiration"; 
     51  public static final String INITIAL_TIME = "initial"; 
    5152  //public static final String FROM 
    5253  public static final String FILE_SEPARATOR = File.separator; 
     
    189190      data.put(CURRENT_SET, parts[2]); 
    190191      data.put(CURRENT_CURSOR, parts[3]); 
     192      data.put(INITIAL_TIME, base_name); 
    191193    } 
    192194    return data; 
     
    194196  } 
    195197 
     198  // used to manually expire a particular token - eg when one of its collections has changed since token was issued. 
     199  public static void expireToken(String token) { 
     200    if (token.indexOf(":") != -1) { 
     201      token = token.substring(0, token.indexOf(":")); 
     202    } 
     203    expiration_data.remove(token); 
     204    stored_tokens.remove(token); 
     205  } 
    196206  // read through all stored expiry dates, and delete any tokens that are too 
    197207  // old