Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sun/xacml/combine/PolicyCombiningAlgorithm.java


1   
2   /*
3    * @(#)PolicyCombiningAlgorithm.java
4    *
5    * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions are met:
9    *
10   *   1. Redistribution of source code must retain the above copyright notice,
11   *      this list of conditions and the following disclaimer.
12   * 
13   *   2. Redistribution in binary form must reproduce the above copyright
14   *      notice, this list of conditions and the following disclaimer in the
15   *      documentation and/or other materials provided with the distribution.
16   *
17   * Neither the name of Sun Microsystems, Inc. or the names of contributors may
18   * be used to endorse or promote products derived from this software without
19   * specific prior written permission.
20   * 
21   * This software is provided "AS IS," without a warranty of any kind. ALL
22   * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
23   * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
24   * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
25   * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
26   * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
27   * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
28   * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
29   * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
30   * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
31   * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32   *
33   * You acknowledge that this software is not designed or intended for use in
34   * the design, construction, operation or maintenance of any nuclear facility.
35   */
36  
37  package com.sun.xacml.combine;
38  
39  import com.sun.xacml.EvaluationCtx;
40  
41  import com.sun.xacml.ctx.Result;
42  
43  import java.net.URI;
44  
45  import java.util.List;
46  
47  
48  /**
49   * The base type for all Policy combining algorithms. Unlike in Rule 
50   * Combining Algorithms, each policy must be matched before they're evaluated
51   * to make sure they apply. Also, in combining policies, obligations must be
52   * handled correctly. Specifically, no obligation may be included in the
53   * <code>Result</code> that doesn't match the effect being returned. So, if
54   * INDETERMINATE or NOT_APPLICABLE is the returned effect, no obligations
55   * may be included in the result. If the effect of the combining algorithm
56   * is PERMIT or DENY, then obligations with a matching fulfillOn effect
57   * are also included in the result.
58   *
59   * @since 1.0
60   * @author Seth Proctor
61   * @author Marco Barreno
62   */
63  public abstract class PolicyCombiningAlgorithm extends CombiningAlgorithm
64  {
65  
66      /**
67       * Constructor that takes the algorithm's identifier.
68       *
69       * @param identifier the algorithm's identifier
70       */
71      public PolicyCombiningAlgorithm(URI identifier) {
72          super(identifier);
73      }
74  
75      /**
76       * Combines the policies based on the context to produce some unified
77       * result. This is the one function of a combining algorithm.
78       * <p>
79       * Note that unlike in the RuleCombiningAlgorithms, here you must
80       * explicitly match the sub-policies to make sure that you should
81       * consider them, and you must handle Obligations.
82       *
83       * @param context the representation of the request
84       * @param policies the policies to combine
85       *
86       * @return a single unified result based on the combining logic
87       */
88      public abstract Result combine(EvaluationCtx context, List policies);
89  
90  }