Coverage Report - org.openpermis.xacml.io.XacmlRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
XacmlRequest
90%
9/10
50%
3/6
2
 
 1  
 /*
 2  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 3  
  * All rights reserved.
 4  
  * 
 5  
  * Licensed under the Open Permis License which accompanies this distribution, 
 6  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 7  
  */
 8  
 package org.openpermis.xacml.io;
 9  
 
 10  
 import java.net.URI;
 11  
 
 12  
 
 13  
 /**
 14  
  * An xacml request consisting of subject, resource and action.
 15  
  * @since 0.4.0
 16  
  */
 17  
 public class XacmlRequest {
 18  
                 
 19  
         //---- State
 20  
         
 21  
         private URI subject;
 22  
         
 23  
         private URI resource;
 24  
         
 25  
         private String action;
 26  
         
 27  
         //---- Constructors
 28  
         
 29  
         /**
 30  
          * Creates a new xacml request.
 31  
          * @param subject the subject.
 32  
          * @param resource the resource.
 33  
          * @param action the action.
 34  
          * @since 0.4.0
 35  
          */
 36  2
         public XacmlRequest (URI subject, URI resource, String action) {
 37  2
                 if (subject == null || resource == null || action == null) {
 38  0
                         throw new IllegalArgumentException("Subject, resource or action is null.");
 39  
                 }
 40  2
                 this.subject = subject;
 41  2
                 this.resource = resource;
 42  2
                 this.action = action;
 43  2
         }
 44  
         
 45  
         /**
 46  
          * @since 0.4.0
 47  
          */
 48  
         public URI getSubject () {
 49  2
                 return this.subject;
 50  
         }
 51  
         
 52  
         /**
 53  
          * @since 0.4.0
 54  
          */
 55  
         public URI getResource () {
 56  2
                 return this.resource;
 57  
         }
 58  
         
 59  
         /**
 60  
          * @since 0.4.0
 61  
          */
 62  
         public String getAction () {
 63  2
                 return this.action;
 64  
         }
 65  
 }
 66