01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.security;
11:
12: import org.mmbase.util.functions.Parameters;
13: import org.mmbase.util.LocalizedString;
14:
15: /**
16: * An action is something which an authenticated user may want to do, but which is not directly
17: * associated with MMBase nodes. Actions are e.g. provided by components (and can be added to
18: * component XML's).
19: *
20: * @author Michiel Meeuwissen
21: * @version $Id: Action.java,v 1.6 2008/01/21 17:28:15 michiel Exp $
22: * @since MMBase-1.9
23: */
24: public class Action implements java.io.Serializable {
25: protected final String name;
26: protected final LocalizedString description;
27: protected final ActionChecker defaultChecker;
28: protected final String nameSpace;
29:
30: public Action(String ns, String n, ActionChecker c) {
31: nameSpace = ns;
32: name = n;
33: defaultChecker = c;
34: description = new LocalizedString(name);
35: }
36:
37: /**
38: * Every action needs to do a proposal on how to check it. The security implementation may
39: * override this. But since components can freely define new actions, which may not be
40: * anticipated by the authorization implementation, the action itself must provide some basic
41: * checker (e.g. an instance of {@link ActionChecker.Rank}.
42: */
43: public ActionChecker getDefault() {
44: return defaultChecker;
45: }
46:
47: /**
48: * Every action has a non-null name. Together with the {@link #getNameSpace} it uniquely
49: * identifies the action.
50: */
51: public String getName() {
52: return name;
53: }
54:
55: /**
56: * Most 'actions' have a namespace. This is normally identical to thye name of the component
57: * with wich there are associated. It can be <code>null</code> though.
58: */
59: public String getNameSpace() {
60: return nameSpace;
61: }
62:
63: public LocalizedString getDescription() {
64: return description;
65: }
66:
67: public String toString() {
68: return nameSpace + ":" + name + ":" + defaultChecker;
69: }
70:
71: public Parameters createParameters() {
72: return new Parameters();
73: }
74: }
|