~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/authentication/src/main/java/com/eucalyptus/auth/policy/condition/DateGreaterThanEquals.java

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.eucalyptus.auth.policy.condition;
 
2
 
 
3
import java.text.ParseException;
 
4
import org.apache.log4j.Logger;
 
5
import com.eucalyptus.auth.policy.key.Iso8601DateParser;
 
6
 
 
7
@PolicyCondition( { Conditions.DATEGREATERTHANEQUALS, Conditions.DATEGREATERTHANEQUALS_S } )
 
8
public class DateGreaterThanEquals implements DateConditionOp {
 
9
  
 
10
  private static final Logger LOG = Logger.getLogger( DateEquals.class );
 
11
  
 
12
  @Override
 
13
  public boolean check( String key, String value ) {
 
14
    try {
 
15
      return Iso8601DateParser.parse( key ).compareTo( Iso8601DateParser.parse( value ) ) >= 0;
 
16
    } catch ( ParseException e ) {
 
17
      LOG.error( "Invalid input date input", e );
 
18
      return false;
 
19
    }
 
20
  }
 
21
  
 
22
}