org/objectweb/proactive/ext/security/PolicyRule.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.ext.security;
00032 
00033 import java.io.Serializable;
00034 import java.util.ArrayList;
00035 
00036 import org.objectweb.proactive.ext.security.securityentity.DefaultEntity;
00037 import org.objectweb.proactive.ext.security.securityentity.Entity;
00038 
00039 
00040 public class PolicyRule implements Serializable {
00041     protected ArrayList<Entity> from;
00042     protected ArrayList<Entity> to;
00043     protected Communication communicationReply;
00044     protected Communication communicationRequest;
00045     protected boolean migration = false;
00046     protected boolean aocreation = false;
00047 
00052     public PolicyRule() {
00053         from = new ArrayList<Entity>();
00054         from.add(new DefaultEntity());
00055         to = new ArrayList<Entity>();
00056         to.add(new DefaultEntity());
00057         communicationReply = new Communication();
00058         communicationRequest = new Communication();
00059     }
00060 
00064     public void setEntitiesFrom(ArrayList<Entity> object) {
00065         this.from = object;
00066     }
00067 
00071     public void setEntitiesTo(ArrayList<Entity> object) {
00072         this.to = object;
00073     }
00074 
00078     public void setCommunicationRulesRequest(Communication object) {
00079         communicationRequest = object;
00080     }
00081 
00085     public void setCommunicationRulesReply(Communication object) {
00086         communicationReply = object;
00087     }
00088 
00089     public String toString() {
00090         String vnFrom;
00091         String vnTo;
00092         vnFrom = vnTo = null;
00093         if (from == null) {
00094             vnFrom = null;
00095         } else {
00096             Entity[] f = new Entity[0];
00097             Entity[] eF = (Entity[]) from.toArray(f);
00098             for (int i = 0; i < eF.length; i++)
00099                 vnFrom = eF[i].getName() + ",";
00100         }
00101         if (to == null) {
00102             vnTo = null;
00103         } else {
00104             Entity[] f = new Entity[0];
00105             Entity[] eT = (Entity[]) to.toArray(f);
00106             for (int i = 0; i < eT.length; i++)
00107                 vnTo = eT[i].getName() + ",";
00108         }
00109 
00110         return vnFrom + "-->" + vnTo + "||  Request:" + communicationRequest +
00111         " :: Reply : " + communicationReply + " || Migration :" + migration +
00112         "|| AOCreation:" + aocreation;
00113     }
00114 
00118     public void setCommunicationRules(Communication[] arrayLists) {
00119         setCommunicationRulesReply(arrayLists[0]);
00120         setCommunicationRulesRequest(arrayLists[1]);
00121     }
00122 
00123     public Communication getCommunicationReply() {
00124         return communicationReply;
00125     }
00126 
00127     public Communication getCommunicationRequest() {
00128         return communicationRequest;
00129     }
00130 
00131     public ArrayList getEntitiesFrom() {
00132         return from;
00133     }
00134 
00135     public ArrayList getEntitiesTo() {
00136         return to;
00137     }
00138 
00142     public boolean isAocreation() {
00143         return aocreation;
00144     }
00145 
00149     public boolean isMigration() {
00150         return migration;
00151     }
00152 
00156     public void setAocreation(boolean b) {
00157         aocreation = b;
00158     }
00159 
00163     public void setMigration(boolean b) {
00164         migration = b;
00165     }
00166 }

Generated on Mon Jan 22 15:16:11 2007 for ProActive by  doxygen 1.5.1