1 31 package org.objectweb.proactive.ext.security; 32 33 import java.io.Serializable ; 34 35 import java.util.ArrayList ; 36 37 38 public class Policy implements Serializable { 39 protected ArrayList from; 40 protected ArrayList to; 41 protected Communication communicationReply; 42 protected Communication communicationRequest; 43 protected boolean migration = false; 44 protected boolean aocreation = false; 45 46 50 public Policy() { 51 from = new ArrayList (); 52 from.add(new DefaultEntity()); 53 to = new ArrayList (); 54 to.add(new DefaultEntity()); 55 communicationReply = new Communication(); 56 communicationRequest = new Communication(); 57 58 } 59 60 63 public void setEntitiesFrom(ArrayList object) { 64 from = object; 65 } 66 67 70 public void setEntitiesTo(ArrayList object) { 71 to = object; 72 } 73 74 77 public void setCommunicationRulesRequest(Communication object) { 78 communicationRequest = object; 79 } 80 81 84 public void setCommunicationRulesReply(Communication object) { 85 communicationReply = object; 86 } 87 88 public String toString() { 89 String vnFrom; 90 String vnTo; 91 vnFrom = vnTo = null; 92 if (from == null) { 93 vnFrom = null; 94 } else { 95 Entity[] f = new Entity[0]; 96 Entity[] eF = (Entity[]) from.toArray(f); 97 for (int i = 0; i < eF.length; i++) 98 vnFrom = eF[i].getName() + ","; 99 } 100 if (to == null) { 101 vnTo = null; 102 } else { 103 Entity[] f = new Entity[0]; 104 Entity[] eT = (Entity[]) to.toArray(f); 105 for (int i = 0; i < eT.length; i++) 106 vnTo = eT[i].getName() + ","; 107 } 108 109 return vnFrom + "-->" + vnTo +"|| Request:" + communicationRequest + " :: Reply : " + communicationReply 110 + " || Migration :" + migration + "|| AOCreation:" + aocreation; 111 } 112 113 116 public void setCommunicationRules(Communication[] arrayLists) { 117 setCommunicationRulesReply(arrayLists[0]); 118 setCommunicationRulesRequest(arrayLists[1]); 119 } 120 121 public Communication getCommunicationReply() { 122 return communicationReply; 123 } 124 125 public Communication getCommunicationRequest() { 126 return communicationRequest; 127 } 128 129 public ArrayList getEntitiesFrom() { 130 return from; 131 } 132 133 public ArrayList getEntitiesTo() { 134 return to; 135 } 136 139 public boolean isAocreation() { 140 return aocreation; 141 } 142 143 146 public boolean isMigration() { 147 return migration; 148 } 149 150 153 public void setAocreation(boolean b) { 154 aocreation = b; 155 } 156 157 160 public void setMigration(boolean b) { 161 migration = b; 162 } 163 164 } 165 | Popular Tags |