Changeset 2218
- Timestamp:
- 06/10/08 13:21:28 (3 months ago)
- Files:
-
- trunk/framework-plugin/src/com/tresys/framework/compiler/FNetGenerator.java (modified) (1 diff)
- trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkAdder.java (modified) (2 diffs)
- trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkConfig.java (modified) (5 diffs)
- trunk/framework-plugin/src/com/tresys/framework/compiler/policy/AccessNetwork.java (modified) (1 diff)
- trunk/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java (modified) (3 diffs)
- trunk/framework-plugin/src/com/tresys/framework/compiler/policy/PolicyParser.jj (modified) (2 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AbstractAccessConnectionCommand.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/framework-plugin/src/com/tresys/framework/compiler/FNetGenerator.java
r2215 r2218 42 42 public void Visit (NetConnection i_net_connection) 43 43 { 44 i_net_connection.getESPNumber ();45 i_net_connection.getSource ();46 i_net_connection.getTarget ();47 44 StringBuffer ip_info_source = new StringBuffer (70); 48 45 StringBuffer ip_info_target = new StringBuffer (70); trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkAdder.java
r2216 r2218 16 16 import com.tresys.framework.compiler.dictionary.Rdef; 17 17 import com.tresys.framework.compiler.dictionary.SysResourceState; 18 import com.tresys.framework.compiler.dictionary.Verb; 19 import com.tresys.framework.compiler.policy.Access; 20 import com.tresys.framework.compiler.policy.AccessNetwork; 21 import com.tresys.framework.compiler.policy.IDomain; 18 22 import com.tresys.framework.compiler.policy.Policy; 19 23 import com.tresys.framework.compiler.policy.NetworkResource; 20 24 import com.tresys.framework.compiler.policy.Token; 25 import com.tresys.framework.compiler.policy.UnrevokableException; 21 26 import com.tresys.framework.compiler.systemResources.LabeledNetworkResource; 22 27 import com.tresys.framework.compiler.systemResources.NetworkInfo; … … 64 69 m_sysPolicy.Add (netRes); 65 70 } 71 } 72 73 public void Visit (NetConnection i_net_connection) 74 { 75 NetResource netRes = i_net_connection.getResource (); 76 String sRdefName = (String) netRes.get (NetResource.KEY_TYPE); 77 if (sRdefName == null) 78 return; 66 79 67 if (netRes != null) 80 Rdef rdef = m_sysPolicy.getDictionary ().GetRdef (sRdefName); 81 if (rdef == null) 82 return; 83 84 if (rdef.GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.No) 85 return; 86 87 Endpoint match = null; 88 89 { 90 Endpoint source = i_net_connection.getSource (); 91 Endpoint target = i_net_connection.getTarget (); 92 if (source.getSystem ().getName ().equals (m_sysPolicy.getName ())) 93 match = source; 94 95 else if (target.getSystem ().getName ().equals (m_sysPolicy.getName ())) 96 match = target; 97 } 98 99 if (match == null) 100 return; 101 102 String sDomName = match.getSubName (); 103 IDomain dom = m_sysPolicy.GetDomain (sDomName); 104 if (dom == null) 105 return; 106 107 NetworkResource netResource = (NetworkResource) m_sysPolicy.GetResource (netRes.getName ()); 108 if (netResource == null) 109 return; 110 111 112 for (Iterator itr = netResource.GetAccesses ().iterator (); itr.hasNext (); ) 113 { 114 Access access = (Access) itr.next (); 115 if (access.getDomain ().equals (dom)) 116 return; 117 } 118 119 try 120 { 121 Token accessTok = new Token ("Access", m_errorHandler); 122 AccessNetwork access = new AccessNetwork (dom, netResource, new Integer (Verb.readwrite), accessTok, null, null); 123 124 m_sysPolicy.Add (access); 125 } 126 catch (UnrevokableException uve) 68 127 { 69 128 70 129 } 71 130 72 } 73 74 public void Visit (NetConnection i_net_connection) 75 { 76 // i_net_connection. 131 { 132 LabeledNetworkResource lnetRes = (LabeledNetworkResource) netResource.GetSystemResource (rdef); 133 NetworkInfo info = lnetRes.getNetworkInfo (); 134 if (info.getIPAddr () == null || info.getIPAddr ().length () == 0) 135 { 136 info.setIPAddr (match.getNetworkInfo ().getIPAddr ()); 137 info.setPorts (match.getNetworkInfo ().getPorts ()); 138 } 139 } 77 140 } 78 141 trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkConfig.java
r2217 r2218 68 68 m_netresources.put (sName, i_item); 69 69 if (!m_endpoints.containsKey (sName)) 70 m_endpoints.put (sName, new HashSet());70 m_endpoints.put (sName, new Vector ()); 71 71 if (!m_connections.containsKey (sName)) 72 m_connections.put (sName, new HashSet());72 m_connections.put (sName, new Vector ()); 73 73 } 74 74 } … … 150 150 String sName = res.getName (); 151 151 Collection cons = (Collection) m_connections.get (sName); 152 cons.add (i_connection); 152 if (!cons.contains (i_connection)) 153 cons.add (i_connection); 153 154 154 155 Collection entrypoints = (Collection) m_endpoints.get (sName); 155 entrypoints.add (i_connection.getSource ()); 156 entrypoints.add (i_connection.getTarget ()); 156 if (!entrypoints.contains (i_connection.getSource ())) 157 entrypoints.add (i_connection.getSource ()); 158 if (!entrypoints.contains (i_connection.getTarget ())) 159 entrypoints.add (i_connection.getTarget ()); 157 160 } 158 161 } … … 277 280 Token domTok = new Token (dom.getToken ()); 278 281 Endpoint pt1 = new Endpoint (sys, domTok, netInfo); 279 280 endpoints.add (pt1);282 if (!endpoints.contains (pt1)) 283 endpoints.add (pt1); 281 284 } 282 285 … … 284 287 { 285 288 Collection oldConnections = getConnections (netRes); 286 Collection newConnection = new HashSet();289 Collection newConnection = new Vector (); 287 290 288 291 for (Iterator itr = endpoints.iterator (); itr.hasNext (); ) … … 384 387 } 385 388 } 386 387 } 388 389 } 389 390 } 390 391 trunk/framework-plugin/src/com/tresys/framework/compiler/policy/AccessNetwork.java
r2144 r2218 21 21 extends AccessResource 22 22 { 23 24 25 26 23 public AccessNetwork (IDomain dom, Resource res, Integer /*Verb*/verb, 27 AbstractToken token, AbstractToken bool, Boolean activeOnBool , Integer nESP)24 AbstractToken token, AbstractToken bool, Boolean activeOnBool) 28 25 throws UnrevokableException 29 26 { trunk/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java
r2179 r2218 267 267 * <code>false</code> otherwise. 268 268 */ 269 public boolean Add (AccessResource axx)270 { 271 if (axx.getResource().IsDescendant(axx.getDomain ()))269 public boolean Add (AccessResource axx) 270 { 271 if (axx.getResource().IsDescendant(axx.getDomain ())) 272 272 { 273 273 axx.Token.Error("Constraint violation: a domain cannot access its children"); … … 277 277 Domain resourceParent = axx.getResource().getParent(); 278 278 279 if (resourceParent != null && !axx.getDomain ().IsDescendant(resourceParent))279 if (resourceParent != null && !axx.getDomain ().IsDescendant(resourceParent)) 280 280 { 281 281 axx.Token.Error("Constraint violation: a domain cannot access a resource enclosed in another domain"); … … 284 284 285 285 Iterator itr = axx.getDomain().GetAccesses(axx.verb().intValue()).iterator(); 286 while (itr.hasNext())286 while (itr.hasNext()) 287 287 { 288 288 Access tmpAccess = (Access)itr.next(); trunk/framework-plugin/src/com/tresys/framework/compiler/policy/PolicyParser.jj
r2191 r2218 54 54 import com.tresys.framework.compiler.linkage.net.NetworkConfig; 55 55 import com.tresys.framework.compiler.linkage.net.NetResource; 56 import com.tresys.framework.compiler.linkage.net.NetConnection;57 56 58 57 import com.tresys.slide.utility.policyxmlparser.Interface; … … 894 893 if (component instanceof NetworkResource) 895 894 { 896 // NetConnection connection = m_netConfig.getResource (component.getName ()); 897 // Integer nESP = new Integer (connection.getESPNumber ()); 898 access = new AccessNetwork (domain, (Resource) component, verb, addHandlerToToken(tokAccess), bool, onOrOff, null); 895 access = new AccessNetwork (domain, (Resource) component, verb, addHandlerToToken(tokAccess), bool, onOrOff); 899 896 } 900 897 else if(component instanceof Resource) trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AbstractAccessConnectionCommand.java
r2152 r2218 12 12 import java.util.Collection; 13 13 import java.util.Iterator; 14 import java.util.Random;15 14 import java.util.Vector; 16 15 … … 112 111 else if (resource instanceof NetworkResource) 113 112 { 114 int nESP = new Random ().nextInt (15000) + 1000;115 113 try 116 114 { 117 access = new AccessNetwork (domain, (NetworkResource) resource, m_nVerb, tok, null, null , new Integer (nESP));115 access = new AccessNetwork (domain, (NetworkResource) resource, m_nVerb, tok, null, null); 118 116 } 119 117 catch (UnrevokableException ue)
