|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| package org.globus.cas.impl.client; |
|
12 |
| |
|
13 |
| import java.util.Vector; |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| public class ResourceActionsMap { |
|
19 |
| |
|
20 |
| private String resource; |
|
21 |
| private Vector actions; |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
0
| public ResourceActionsMap(String resource, String action)
|
|
30 |
| throws Exception { |
|
31 |
0
| if ((resource == null) ||
|
|
32 |
| ((action == null) || (action.trim().equals("")))) { |
|
33 |
0
| throw new Exception("Resource and action cannot be null");
|
|
34 |
| } |
|
35 |
0
| this.resource = resource;
|
|
36 |
0
| this.actions = new Vector();
|
|
37 |
0
| this.actions.add(action);
|
|
38 |
| } |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
0
| ResourceActionsMap(String resource, Vector actions)
|
|
48 |
| throws Exception { |
|
49 |
0
| if ((resource == null) || (actions == null)) {
|
|
50 |
0
| throw new Exception("Resource and action cannot be null");
|
|
51 |
| } |
|
52 |
0
| this.resource = resource;
|
|
53 |
0
| this.actions = actions;
|
|
54 |
| } |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
0
| public void addAction(String action) {
|
|
61 |
0
| if ((action != null) && (!action.trim().equals("")))
|
|
62 |
0
| this.actions.add(action);
|
|
63 |
| } |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
0
| public void addActions(Vector actions) {
|
|
71 |
0
| if (actions != null)
|
|
72 |
0
| this.actions.addAll(actions);
|
|
73 |
| } |
|
74 |
| |
|
75 |
0
| public String getResource() {
|
|
76 |
0
| return resource;
|
|
77 |
| } |
|
78 |
| |
|
79 |
0
| public String[] getActions() {
|
|
80 |
0
| String[] actionStrs = new String[actions.size()];
|
|
81 |
0
| actions.toArray(actionStrs);
|
|
82 |
0
| return actionStrs;
|
|
83 |
| } |
|
84 |
| |
|
85 |
0
| public Vector getActionsAsVector() {
|
|
86 |
0
| return actions;
|
|
87 |
| } |
|
88 |
| |
|
89 |
0
| public String toString() {
|
|
90 |
0
| String returnString = "Resource: " + resource + "\n Actions: \n";
|
|
91 |
0
| for (int i=0; i<actions.size(); i++) {
|
|
92 |
0
| returnString = returnString + (String)actions.get(i);
|
|
93 |
| } |
|
94 |
0
| return returnString;
|
|
95 |
| } |
|
96 |
| } |