KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > security > SecurityContext


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.ext.security;
32
33 import java.io.Serializable JavaDoc;
34
35 import java.util.ArrayList JavaDoc;
36
37
38 /**
39  * @author acontes
40  *
41  * To change the template for this generated type comment go to
42  * Window>Preferences>Java>Code Generation>Code and Comments
43  */

44 public class SecurityContext implements Serializable JavaDoc {
45     public static int COMMUNICATION_SEND_REQUEST_TO = 0;
46     public static int COMMUNICATION_RECEIVE_REQUEST_FROM = 1;
47     public static int COMMUNICATION_SEND_REPLY_TO = 2;
48     public static int COMMUNICATION_RECEIVE_REPLY_FROM = 3;
49     public static int MIGRATION_TO = 4;
50     public static int MIGRATION_FROM = 5;
51     protected ArrayList JavaDoc entitiesFrom;
52     protected ArrayList JavaDoc entitiesTo;
53     protected Communication sendRequest;
54     protected Communication receiveRequest;
55     protected Communication sendReply;
56     protected Communication receiveReply;
57     protected boolean migration;
58     protected boolean migrationTo;
59     protected boolean creationActiveObjectFrom;
60     protected boolean creationActiveObjectTo;
61     protected int type;
62
63     public SecurityContext() {
64     }
65
66     public SecurityContext(int type, ArrayList JavaDoc entitiesFrom,
67         ArrayList JavaDoc entitiesTo) {
68         this.type = type;
69         this.entitiesFrom = entitiesFrom;
70         this.entitiesTo = entitiesTo;
71     }
72
73     public void addEntityFrom(Entity entity) {
74         entitiesFrom.add(entity);
75     }
76
77     public void addEntityTo(Entity entity) {
78         entitiesTo.add(entity);
79     }
80
81     /**
82      * @return type of the interaction (migration, request, reply)
83      */

84     public int getType() {
85         return type;
86     }
87
88     /**
89      * @param set the type of the interaction (migration, request, reply)
90      */

91     public void setType(int i) {
92         type = i;
93     }
94
95     /**
96      * @return true if creation of an active object is authorized by the from entities
97      */

98     public boolean isCreationActiveObjectFrom() {
99         return creationActiveObjectFrom;
100     }
101
102     /**
103      * @return true if creation of an active object is authorized to the 'to' entities
104      */

105     public boolean isCreationActiveObjectTo() {
106         return creationActiveObjectTo;
107     }
108
109     /**
110      * @return entities of the 'from' objects
111      */

112     public ArrayList JavaDoc getEntitiesFrom() {
113         return entitiesFrom;
114     }
115
116     /**
117      * @return entities of the 'to' objects
118      */

119     public ArrayList JavaDoc getEntitiesTo() {
120         return entitiesTo;
121     }
122
123     /**
124      * @return true if migration is granted
125      */

126     public boolean isMigration() {
127         return migration;
128     }
129
130     /**
131      * @return true if object can receive replies
132      */

133     public Communication getReceiveReply() {
134         return receiveReply;
135     }
136
137     /**
138      * @return true if object can receive requests
139      */

140     public Communication getReceiveRequest() {
141         return receiveRequest;
142     }
143
144     /**
145      * @return true if object can send replies
146      */

147     public Communication getSendReply() {
148         return sendReply;
149     }
150
151     /**
152      * @return true if object can send requests
153      */

154     public Communication getSendRequest() {
155         return sendRequest;
156     }
157
158     /**
159      * @param true if object on 'from' can create object
160      */

161     public void setCreationActiveObjectFrom(boolean b) {
162         creationActiveObjectFrom = b;
163     }
164
165     /**
166      * @param true if object is authorized to create onject on 'to'
167      */

168     public void setCreationActiveObjectTo(boolean b) {
169         creationActiveObjectTo = b;
170     }
171
172     /**
173      * @param lists all entities from 'from'
174      */

175     public void setEntitiesFrom(ArrayList JavaDoc list) {
176         entitiesFrom = list;
177     }
178
179     /**
180      * @param lists all entities from 'to'
181      */

182     public void setEntitiesTo(ArrayList JavaDoc list) {
183         entitiesTo = list;
184     }
185
186     /**
187      * @param true if migration is granted
188      */

189     public void setMigration(boolean b) {
190         migration = b;
191     }
192
193     /**
194      * @param true if migration is granted to
195      */

196     public void setMigrationTo(boolean b) {
197         migrationTo = b;
198     }
199
200     /**
201      * @param communication attributes for receiving a reply
202      */

203     public void setReceiveReply(Communication communication) {
204         receiveReply = communication;
205     }
206
207     /**
208      * @param communication attributes for receiving a request
209      */

210     public void setReceiveRequest(Communication communication) {
211         receiveRequest = communication;
212     }
213
214     /**
215      * @param communication attributes for send a reply
216      */

217     public void setSendReply(Communication communication) {
218         sendReply = communication;
219     }
220
221     /**
222      * @param communication attributes for send a request
223      */

224     public void setSendRequest(Communication communication) {
225         sendRequest = communication;
226     }
227 }
228
Popular Tags