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

Quick Search    Search Deep

Source code: com/sun/xacml/cond/Evaluatable.java


1   
2   /*
3    * @(#)Evaluatable.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.cond;
38  
39  import com.sun.xacml.EvaluationCtx;
40  import com.sun.xacml.Indenter;
41  
42  import com.sun.xacml.attr.AttributeValue;
43  
44  import java.io.OutputStream;
45  
46  import java.net.URI;
47  
48  import java.util.List;
49  
50  
51  /**
52   * Generic interface that is implemented by all objects that can appear in
53   * an ApplyType. This lets the evaluation code of <code>Apply</code> and
54   * functions iterate through their members and evaluate them, working only
55   * on the returned values or errors.
56   *
57   * @since 1.0
58   * @author Seth Proctor
59   */
60  public interface Evaluatable
61  {
62  
63      /**
64       * Evaluates the object using the given context, and either returns an
65       * error or a resulting value.
66       *
67       * @param context the representation of the request
68       *
69       * @return the result of evaluation
70       */
71      public EvaluationResult evaluate(EvaluationCtx context);
72  
73      /**
74       * Get the type of this object.  This may be the data type of an
75       * <code>Attribute</code> or the return type of an
76       * <code>AttributeDesignator</code>, etc.
77       *
78       * @return the type of data represented by this object
79       */
80      public URI getType();
81  
82      /**
83       * Tells whether evaluation will return a bag or a single value.
84       *
85       * @return true if evaluation will return a bag, false otherwise
86       */
87      public boolean evaluatesToBag();
88  
89      /**
90       * Returns all children, in order, of this element in the Condition
91       * tree, or en empty set if this element has no children. In XACML 1.x,
92       * only the ApplyType ever has children.
93       *
94       * @return a <code>List</code> of <code>Evaluatable</code>s
95       */
96      public List getChildren();
97  
98      /**
99       * Encodes this <code>Evaluatable</code> into its XML representation and
100      * writes this encoding to the given <code>OutputStream</code> with no
101      * indentation.
102      *
103      * @param output a stream into which the XML-encoded data is written
104      */
105     public void encode(OutputStream output);
106 
107     /**
108      * Encodes this <code>Evaluatable</code> into its XML representation and
109      * writes this encoding to the given <code>OutputStream</code> with
110      * indentation.
111      *
112      * @param output a stream into which the XML-encoded data is written
113      * @param indenter an object that creates indentation strings
114      */
115     public void encode(OutputStream output, Indenter indenter);
116 
117 }