summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/policy/IPolicyRule.java
blob: d7eeb1cfb0505c19c773b810d78c97ccd7b16c9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.policy;


import java.util.*;
import com.netscape.certsrv.base.*;
import com.netscape.certsrv.common.*;
import com.netscape.certsrv.request.PolicyResult;
import com.netscape.certsrv.request.IRequest;


/**
 * Interface for a policy rule.
 * <P>
 * <PRE>
 * NOTE:  The Policy Framework has been replaced by the Profile Framework.
 * </PRE>
 * <P>
 *
 * @deprecated
 * @version $Revision$, $Date$
 */
public interface IPolicyRule
    extends com.netscape.certsrv.request.IPolicy {
    public static final String PROP_ENABLE = "enable";
    public static final String PROP_PREDICATE = "predicate";
    public static final String PROP_IMPLNAME = "implName";

    /**
     * Initializes the policy rule.
     * <P>
     *
     * @param config The config store reference
     */
    void init(ISubsystem owner, IConfigStore config)
        throws EBaseException;

    /**
     * Gets the description for this policy rule.
     * <P>
     * @return The Description for this rule.
     */
    String getDescription();

    /**
     * Returns the name of the policy rule class.
     * <P>
     *
     * @return The name of the policy class.
     */
    String getName();

    /**
     * Returns the name of the policy rule instance.
     * <P>
     *
     * @return The name of the policy rule instance. If none
     * 	is set the name of the implementation will be returned.
     * 	
     */
    String getInstanceName();

    /**
     * Sets a predicate expression for rule matching.
     * <P>
     *
     * @param exp	The predicate expression for the rule.
     */
    void setPredicate(IExpression exp);

    /**
     * Returns the predicate expression for the rule.
     * <P>
     *
     * @return The predicate expression for the rule.
     */
    IExpression getPredicate();

    /**
     * Applies the policy on the given Request. This may modify
     * the request appropriately.
     * <P>
     *
     * @param req	The request on which to apply policy.
     * @return The PolicyResult object.
     */
    PolicyResult apply(IRequest req);

    /**
     * Return configured parameters for a policy rule instance.
     *
     * @return nvPairs A Vector of name/value pairs. Each name/value
     *				pair is constructed as a String in name=value format.
     */
    public Vector getInstanceParams();

    /**
     * Return default parameters for a policy implementation.
     *
     * @return nvPairs A Vector of name/value pairs. Each name/value
     *		  		pair is constructed as a String in name=value.
     */
    public Vector getDefaultParams();

    public void setError(IRequest req, String format, Object[] params);

    public void setInstanceName(String instanceName);

    public void setPolicyException(IRequest req, EBaseException ex);
}