Changeset 2172
- Timestamp:
- 05/21/08 13:25:19
(6 months ago)
- Author:
- dsugar
- Message:
support in commands for adding/deleting shapes to also update the NetworkConfig? (.fnet) for the project
some cleanup
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2147 |
r2172 |
|
| 264 | 264 | } |
|---|
| 265 | 265 | |
|---|
| | 266 | |
|---|
| | 267 | |
|---|
| | 268 | rdef otheripsec |
|---|
| | 269 | [desc: "Another Labeled Networking (ipsec) configured network connection"] |
|---|
| | 270 | { |
|---|
| | 271 | requires { ipsec } |
|---|
| | 272 | # owner { |
|---|
| | 273 | # resource { |
|---|
| | 274 | # #TODO: I do not think this is correct, but the dictionary parser requires something here |
|---|
| | 275 | # association { polmatch } |
|---|
| | 276 | # } |
|---|
| | 277 | # } |
|---|
| | 278 | read { |
|---|
| | 279 | default { read } |
|---|
| | 280 | read |
|---|
| | 281 | [desc: "Read data over UDP network connection"] |
|---|
| | 282 | [backflow: 2] |
|---|
| | 283 | { |
|---|
| | 284 | self { |
|---|
| | 285 | association { sendto } |
|---|
| | 286 | } |
|---|
| | 287 | other write { |
|---|
| | 288 | association { recvfrom } |
|---|
| | 289 | } |
|---|
| | 290 | } |
|---|
| | 291 | } |
|---|
| | 292 | |
|---|
| | 293 | write { |
|---|
| | 294 | default { write } |
|---|
| | 295 | write |
|---|
| | 296 | [desc: "Write data over UDP network connection"] |
|---|
| | 297 | [backflow: 2] |
|---|
| | 298 | { |
|---|
| | 299 | self { |
|---|
| | 300 | association { recvfrom } |
|---|
| | 301 | } |
|---|
| | 302 | other read { |
|---|
| | 303 | association { sendto } |
|---|
| | 304 | } |
|---|
| | 305 | } |
|---|
| | 306 | } |
|---|
| | 307 | |
|---|
| | 308 | readwrite { |
|---|
| | 309 | default { connrw } |
|---|
| | 310 | connrw |
|---|
| | 311 | [desc: "read and write over TCP network connection"] |
|---|
| | 312 | { |
|---|
| | 313 | resource { |
|---|
| | 314 | association { recvfrom } |
|---|
| | 315 | } |
|---|
| | 316 | self { |
|---|
| | 317 | association { sendto } |
|---|
| | 318 | } |
|---|
| | 319 | other readwrite { |
|---|
| | 320 | association { sendto recvfrom } |
|---|
| | 321 | } |
|---|
| | 322 | } |
|---|
| | 323 | } |
|---|
| | 324 | } |
|---|
| | 325 | |
|---|
| | 326 | rdef ohtersecmark |
|---|
| | 327 | [desc: "Another IPTables (secmark) configured network connection"] |
|---|
| | 328 | { |
|---|
| | 329 | requires { secmark } |
|---|
| | 330 | # owner { |
|---|
| | 331 | # resource { |
|---|
| | 332 | # #TODO: I do not think this is correct, but the dictionary parser requires something here |
|---|
| | 333 | # packet { send recv } |
|---|
| | 334 | # } |
|---|
| | 335 | # } |
|---|
| | 336 | read { |
|---|
| | 337 | default { read } |
|---|
| | 338 | read |
|---|
| | 339 | [desc : "read data over network connection"] |
|---|
| | 340 | [backflow: 2] |
|---|
| | 341 | { |
|---|
| | 342 | resource { |
|---|
| | 343 | packet { recv } |
|---|
| | 344 | } |
|---|
| | 345 | } |
|---|
| | 346 | } |
|---|
| | 347 | |
|---|
| | 348 | write { |
|---|
| | 349 | default { write } |
|---|
| | 350 | write |
|---|
| | 351 | [desc : "write data over network connection"] |
|---|
| | 352 | [backflow: 1] |
|---|
| | 353 | { |
|---|
| | 354 | resource { |
|---|
| | 355 | packet { send } |
|---|
| | 356 | } |
|---|
| | 357 | } |
|---|
| | 358 | } |
|---|
| | 359 | |
|---|
| | 360 | readwrite { |
|---|
| | 361 | default { networkrw } |
|---|
| | 362 | networkrw |
|---|
| | 363 | [desc : "read and write over network connection"] |
|---|
| | 364 | { |
|---|
| | 365 | resource { |
|---|
| | 366 | packet { send recv } |
|---|
| | 367 | } |
|---|
| | 368 | } |
|---|
| | 369 | } |
|---|
| | 370 | } |
|---|
| | 371 | |
|---|
| 266 | 372 | rdef namedPipesDir |
|---|
| 267 | 373 | [desc: "named pipe and the directory it lives in"] |
|---|
| r2152 |
r2172 |
|
| 86 | 86 | IPTablesNetworkResource net = (IPTablesNetworkResource) sysRes; |
|---|
| 87 | 87 | NetworkInfo local_info = net.getLocalInfo (); |
|---|
| 88 | | if (local_info != null) |
|---|
| 89 | 88 | { |
|---|
| 90 | 89 | // nic |
|---|
| 91 | 90 | { |
|---|
| 92 | 91 | m_dataBuff.append (" { "); |
|---|
| 93 | | String device = local_info.getDevice (); |
|---|
| 94 | | if (device != null && device.length () > 0) |
|---|
| 95 | | { |
|---|
| 96 | | m_dataBuff.append (device); |
|---|
| | 92 | if (local_info != null) |
|---|
| | 93 | { |
|---|
| | 94 | String device = local_info.getDevice (); |
|---|
| | 95 | if (device != null && device.length () > 0) |
|---|
| | 96 | { |
|---|
| | 97 | m_dataBuff.append (device); |
|---|
| | 98 | } |
|---|
| 97 | 99 | } |
|---|
| 98 | 100 | m_dataBuff.append (" } "); |
|---|
| … | … | |
| 102 | 104 | { |
|---|
| 103 | 105 | m_dataBuff.append ("{"); |
|---|
| 104 | | String ip_addr = local_info.getIPAddr (); |
|---|
| 105 | | if (ip_addr != null) |
|---|
| 106 | | { |
|---|
| 107 | | m_dataBuff.append (ip_addr); |
|---|
| 108 | | String mask = local_info.getMask (); |
|---|
| 109 | | if (mask != null) |
|---|
| 110 | | { |
|---|
| 111 | | m_dataBuff.append ("/").append (mask); |
|---|
| | 106 | if (local_info != null) |
|---|
| | 107 | { |
|---|
| | 108 | String ip_addr = local_info.getIPAddr (); |
|---|
| | 109 | if (ip_addr != null) |
|---|
| | 110 | { |
|---|
| | 111 | m_dataBuff.append (ip_addr); |
|---|
| | 112 | String mask = local_info.getMask (); |
|---|
| | 113 | if (mask != null) |
|---|
| | 114 | { |
|---|
| | 115 | m_dataBuff.append ("/").append (mask); |
|---|
| | 116 | } |
|---|
| 112 | 117 | } |
|---|
| 113 | 118 | } |
|---|
| … | … | |
| 118 | 123 | { |
|---|
| 119 | 124 | m_dataBuff.append (" { "); |
|---|
| 120 | | int[] ports = local_info.getPorts (); |
|---|
| 121 | | if ( ports != null ) |
|---|
| 122 | | { |
|---|
| 123 | | for (int i = 0; i < ports.length; i++) |
|---|
| 124 | | { |
|---|
| 125 | | m_dataBuff.append (ports[i]); |
|---|
| 126 | | m_dataBuff.append (" "); |
|---|
| | 125 | if (local_info != null) |
|---|
| | 126 | { |
|---|
| | 127 | int[] ports = local_info.getPorts (); |
|---|
| | 128 | if ( ports != null ) |
|---|
| | 129 | { |
|---|
| | 130 | for (int i = 0; i < ports.length; i++) |
|---|
| | 131 | { |
|---|
| | 132 | m_dataBuff.append (ports[i]); |
|---|
| | 133 | m_dataBuff.append (" "); |
|---|
| | 134 | } |
|---|
| 127 | 135 | } |
|---|
| 128 | 136 | } |
|---|
| … | … | |
| 131 | 139 | } |
|---|
| 132 | 140 | NetworkInfo remote_info = net.getRemoteInfo (); |
|---|
| 133 | | if (remote_info != null) |
|---|
| 134 | 141 | { |
|---|
| 135 | 142 | // nic |
|---|
| 136 | 143 | { |
|---|
| 137 | 144 | m_dataBuff.append (" { "); |
|---|
| 138 | | String device = remote_info.getDevice (); |
|---|
| 139 | | if (device != null && device.length () > 0) |
|---|
| 140 | | { |
|---|
| 141 | | m_dataBuff.append (device); |
|---|
| | 145 | if (remote_info != null) |
|---|
| | 146 | { |
|---|
| | 147 | String device = remote_info.getDevice (); |
|---|
| | 148 | if (device != null && device.length () > 0) |
|---|
| | 149 | { |
|---|
| | 150 | m_dataBuff.append (device); |
|---|
| | 151 | } |
|---|
| 142 | 152 | } |
|---|
| 143 | 153 | m_dataBuff.append (" } "); |
|---|
| … | … | |
| 147 | 157 | { |
|---|
| 148 | 158 | m_dataBuff.append ("{"); |
|---|
| 149 | | String ip_addr = remote_info.getIPAddr (); |
|---|
| 150 | | if (ip_addr != null) |
|---|
| 151 | | { |
|---|
| 152 | | m_dataBuff.append (ip_addr); |
|---|
| 153 | | String mask = local_info.getMask (); |
|---|
| 154 | | if (mask != null) |
|---|
| 155 | | { |
|---|
| 156 | | m_dataBuff.append ("/").append (mask); |
|---|
| | 159 | if (remote_info != null) |
|---|
| | 160 | { |
|---|
| | 161 | String ip_addr = remote_info.getIPAddr (); |
|---|
| | 162 | if (ip_addr != null) |
|---|
| | 163 | { |
|---|
| | 164 | m_dataBuff.append (ip_addr); |
|---|
| | 165 | String mask = remote_info.getMask (); |
|---|
| | 166 | if (mask != null) |
|---|
| | 167 | { |
|---|
| | 168 | m_dataBuff.append ("/").append (mask); |
|---|
| | 169 | } |
|---|
| 157 | 170 | } |
|---|
| 158 | 171 | } |
|---|
| … | … | |
| 163 | 176 | { |
|---|
| 164 | 177 | m_dataBuff.append (" { "); |
|---|
| 165 | | int[] ports = local_info.getPorts (); |
|---|
| 166 | | if ( ports != null ) |
|---|
| 167 | | { |
|---|
| 168 | | for (int i = 0; i < ports.length; i++) |
|---|
| 169 | | { |
|---|
| 170 | | m_dataBuff.append (ports[i]); |
|---|
| 171 | | m_dataBuff.append (" "); |
|---|
| | 178 | if (remote_info != null) |
|---|
| | 179 | { |
|---|
| | 180 | int[] ports = local_info.getPorts (); |
|---|
| | 181 | if ( ports != null ) |
|---|
| | 182 | { |
|---|
| | 183 | for (int i = 0; i < ports.length; i++) |
|---|
| | 184 | { |
|---|
| | 185 | m_dataBuff.append (ports[i]); |
|---|
| | 186 | m_dataBuff.append (" "); |
|---|
| | 187 | } |
|---|
| 172 | 188 | } |
|---|
| 173 | 189 | } |
|---|
| … | … | |
| 177 | 193 | |
|---|
| 178 | 194 | String protocol = net.getProtocol (); |
|---|
| 179 | | if (protocol == null) |
|---|
| 180 | | { |
|---|
| 181 | | /** |
|---|
| 182 | | * This should not happen we must raise Exception or something |
|---|
| 183 | | */ |
|---|
| 184 | | } |
|---|
| 185 | | else |
|---|
| 186 | | { |
|---|
| 187 | | m_dataBuff.append ("{ "); |
|---|
| | 195 | m_dataBuff.append ("{ "); |
|---|
| | 196 | if (protocol != null) |
|---|
| 188 | 197 | m_dataBuff.append (protocol); |
|---|
| 189 | | m_dataBuff.append (" }"); |
|---|
| 190 | | } |
|---|
| | 198 | m_dataBuff.append (" }"); |
|---|
| 191 | 199 | } |
|---|
| 192 | 200 | else if (sysRes instanceof LabeledNetworkResource) |
|---|
| r2171 |
r2172 |
|
| 33 | 33 | public void Add (NetItem i_item) |
|---|
| 34 | 34 | { |
|---|
| | 35 | if (i_item == null) |
|---|
| | 36 | throw new IllegalArgumentException (); |
|---|
| | 37 | |
|---|
| 35 | 38 | String sName = i_item.getName (); |
|---|
| 36 | 39 | m_items.put (sName, i_item); |
|---|
| 37 | 40 | } |
|---|
| 38 | 41 | |
|---|
| 39 | | public void Remove (String item_name) |
|---|
| | 42 | public void Remove (NetItem i_item) |
|---|
| 40 | 43 | { |
|---|
| 41 | | m_items.remove (item_name); |
|---|
| | 44 | if (i_item != null) |
|---|
| | 45 | { |
|---|
| | 46 | String sName = i_item.getName (); |
|---|
| | 47 | Remove (sName); |
|---|
| | 48 | } |
|---|
| | 49 | } |
|---|
| | 50 | |
|---|
| | 51 | public void Remove (String i_sName) |
|---|
| | 52 | { |
|---|
| | 53 | if (i_sName == null) |
|---|
| | 54 | throw new IllegalArgumentException (); |
|---|
| | 55 | |
|---|
| | 56 | m_items.remove (i_sName); |
|---|
| 42 | 57 | } |
|---|
| 43 | 58 | |
|---|
| … | … | |
| 85 | 100 | public void Add (NetConnection i_connection) |
|---|
| 86 | 101 | { |
|---|
| | 102 | if (i_connection == null) |
|---|
| | 103 | throw new IllegalArgumentException (); |
|---|
| | 104 | |
|---|
| 87 | 105 | String sName = i_connection.toString (); |
|---|
| 88 | 106 | m_connections.put (sName, i_connection); |
|---|
| | 107 | } |
|---|
| | 108 | |
|---|
| | 109 | public void Remove (NetConnection i_connection) |
|---|
| | 110 | { |
|---|
| | 111 | if (i_connection != null) |
|---|
| | 112 | { |
|---|
| | 113 | String sName = i_connection.toString (); |
|---|
| | 114 | m_connections.remove (sName); |
|---|
| | 115 | } |
|---|
| 89 | 116 | } |
|---|
| 90 | 117 | |
|---|
| r2152 |
r2172 |
|
| 212 | 212 | |<COLON : ":"> |
|---|
| 213 | 213 | |<SLASH : "/"> |
|---|
| 214 | | |<PROTOCOL : "udp" | "tcp" > |
|---|
| | 214 | |<PROTOCOL : "udp" | "tcp" | "any" > |
|---|
| 215 | 215 | |<DEVICE : <ALPHA>(<ALPHA>|<DIGITS>)+ > |
|---|
| 216 | 216 | // |<IP : (["0"-"9"]){3}"."(["0"-"9"]){3}"."(["0"-"9"]){3}"."(["0"-"9"]){3} > |
|---|
| r1825 |
r2172 |
|
| 4 | 4 | |*| Author: David Sugar <dsugar@tresys.com> |
|---|
| 5 | 5 | |*| |
|---|
| 6 | | |*| Version: @version@ |
|---|
| | 6 | |*| $Rev$ |
|---|
| | 7 | |*| $Date$ |
|---|
| 7 | 8 | \*/ |
|---|
| 8 | 9 | |
|---|
| r2163 |
r2172 |
|
| 13 | 13 | package com.tresys.framework.plugin.builder; |
|---|
| 14 | 14 | |
|---|
| 15 | | import java.io.StringReader; |
|---|
| 16 | 15 | import java.util.Collection; |
|---|
| 17 | 16 | import java.util.HashSet; |
|---|
| … | … | |
| 27 | 26 | import org.eclipse.core.runtime.CoreException; |
|---|
| 28 | 27 | import org.eclipse.core.runtime.IProgressMonitor; |
|---|
| 29 | | import org.eclipse.jface.text.IDocument; |
|---|
| 30 | | |
|---|
| 31 | | import com.tresys.framework.compiler.dictionary.Dictionary; |
|---|
| 32 | 28 | import com.tresys.framework.compiler.linkage.net.NetworkConfig; |
|---|
| 33 | 29 | import com.tresys.framework.compiler.linkage.net.NetworkAdder; |
|---|
| r2144 |
r2172 |
|
| 18 | 18 | import org.eclipse.core.runtime.CoreException; |
|---|
| 19 | 19 | |
|---|
| | 20 | import com.tresys.framework.compiler.linkage.net.NetResource; |
|---|
| | 21 | import com.tresys.framework.compiler.linkage.net.NetworkConfig; |
|---|
| 20 | 22 | import com.tresys.framework.compiler.policy.Ability; |
|---|
| 21 | 23 | import com.tresys.framework.compiler.policy.AccessBaseResource; |
|---|
| … | … | |
| 126 | 128 | } |
|---|
| 127 | 129 | |
|---|
| 128 | | if ( ((NetworkResource)temp.getComponent ()).hasCustomization () ) |
|---|
| 129 | | i_resource.markCustomized (); |
|---|
| 130 | | else |
|---|
| 131 | | i_resource.removeCustomization (); |
|---|
| | 130 | NetworkResourceShape netShape = (NetworkResourceShape) temp; |
|---|
| | 131 | { |
|---|
| | 132 | NetworkResource netRes = (NetworkResource) netShape.getComponent (); |
|---|
| | 133 | if (netRes.hasCustomization ()) |
|---|
| | 134 | i_resource.markCustomized (); |
|---|
| | 135 | else |
|---|
| | 136 | i_resource.removeCustomization (); |
|---|
| | 137 | } |
|---|
| | 138 | |
|---|
| | 139 | { |
|---|
| | 140 | NetworkConfig netconfig = m_system.getNetworkConfig (); |
|---|
| | 141 | NetResource netRes = netconfig.getResource (i_resource.getName ()); |
|---|
| | 142 | netShape.setNetResource (netRes); |
|---|
| | 143 | } |
|---|
| 132 | 144 | |
|---|
| 133 | 145 | // set real component - remove from 'extras' list |
|---|
| 134 | | temp.setComponent(i_resource); |
|---|
| | 146 | temp.setComponent (i_resource); |
|---|
| 135 | 147 | m_allShapes.remove(temp.getName()); |
|---|
| 136 | 148 | |
|---|
| … | … | |
| 166 | 178 | } |
|---|
| 167 | 179 | |
|---|
| 168 | | if ( ((Resource)temp.getComponent ()).hasCustomization () ) |
|---|
| | 180 | Resource res = (Resource) temp.getComponent (); |
|---|
| | 181 | if (res.hasCustomization ()) |
|---|
| 169 | 182 | i_resource.markCustomized (); |
|---|
| 170 | 183 | else |
|---|
| r2028 |
r2172 |
|
| 1 | 1 | /*\ |
|---|
| 2 | | |*| Copyright (C) 2006 Tresys Technology, LLC |
|---|
| | 2 | |*| Copyright (C) 2006-2008 Tresys Technology, LLC |
|---|
| 3 | 3 | |*| License: refer to COPYING file for license information. |
|---|
| 4 | 4 | |*| Author: David Sugar <dsugar@tresys.com> |
|---|
| 5 | 5 | |*| |
|---|
| 6 | | |*| Version: @version@ |
|---|
| | 6 | |*| $Rev$ |
|---|
| | 7 | |*| $Date$ |
|---|
| 7 | 8 | \*/ |
|---|
| 8 | 9 | |
|---|
| … | … | |
| 34 | 35 | import org.eclipse.ui.part.FileEditorInput; |
|---|
| 35 | 36 | |
|---|
| | 37 | import com.tresys.framework.compiler.linkage.net.NetResource; |
|---|
| | 38 | import com.tresys.framework.compiler.linkage.net.NetworkConfig; |
|---|
| 36 | 39 | import com.tresys.framework.plugin.SEFramework_Plugin; |
|---|
| 37 | 40 | import com.tresys.framework.plugin.builder.FrameworkNature; |
|---|
| 38 | 41 | import com.tresys.framework.plugin.builder.SELinuxSystem; |
|---|
| 39 | 42 | import com.tresys.framework.plugin.editor.policy.graphic.GraphicPolicyEditor; |
|---|
| | 43 | import com.tresys.framework.plugin.editor.policy.graphic.model.NetworkResourceShape; |
|---|
| 40 | 44 | import com.tresys.framework.plugin.editor.policy.graphic.model.PolicyDiagram; |
|---|
| 41 | 45 | import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; |
|---|
| … | … | |
| 107 | 111 | redo(); |
|---|
| 108 | 112 | |
|---|
| 109 | | boolean bShowWizard = SEFramework_Plugin.getDefault().getPreferenceStore(). |
|---|
| 110 | | getBoolean(GraphicEditorPreferences.SHOW_WIZARD); |
|---|
| | 113 | boolean bShowWizard = SEFramework_Plugin.getDefault().getPreferenceStore().getBoolean(GraphicEditorPreferences.SHOW_WIZARD); |
|---|
| 111 | 114 | |
|---|
| 112 | 115 | if (bShowWizard) |
|---|
| … | … | |
| 138 | 141 | public void redo() |
|---|
| 139 | 142 | { |
|---|
| 140 | | m_parent.addChild (m_newShape); |
|---|
| | 143 | if (m_parent.addChild (m_newShape)) |
|---|
| | 144 | { |
|---|
| | 145 | if (m_newShape instanceof NetworkResourceShape) |
|---|
| | 146 | { |
|---|
| | 147 | NetResource netRes = ((NetworkResourceShape) m_newShape).getNetResource (); |
|---|
| | 148 | if (netRes != null) |
|---|
| | 149 | { |
|---|
| | 150 | NetworkConfig netConfig = m_parent.getSystem ().getNetworkConfig (); |
|---|
| | 151 | netConfig.Add (netRes); |
|---|
| | 152 | } |
|---|
| | 153 | } |
|---|
| | 154 | } |
|---|
| 141 | 155 | } |
|---|
| 142 | 156 | |
|---|
| … | … | |
| 146 | 160 | public void undo() |
|---|
| 147 | 161 | { |
|---|
| 148 | | m_parent.removeChild (m_newShape); |
|---|
| | 162 | |
|---|
| | 163 | if (m_parent.removeChild (m_newShape)) |
|---|
| | 164 | { |
|---|
| | 165 | if (m_newShape instanceof NetworkResourceShape) |
|---|
| | 166 | { |
|---|
| | 167 | NetResource netRes = ((NetworkResourceShape) m_newShape).getNetResource (); |
|---|
| | 168 | NetworkConfig netConfig = m_parent.getSystem ().getNetworkConfig (); |
|---|
| | 169 | netConfig.Remove (netRes); |
|---|
| | 170 | } |
|---|
| | 171 | } |
|---|
| 149 | 172 | } |
|---|
| 150 | 173 | |
|---|
| r2028 |
r2172 |
|
| 1 | 1 | /*\ |
|---|
| 2 | | |*| Copyright (C) 2006 Tresys Technology, LLC |
|---|
| | 2 | |*| Copyright (C) 2006-2008 Tresys Technology, LLC |
|---|
| 3 | 3 | |*| License: refer to COPYING file for license information. |
|---|
| 4 | 4 | |*| Author: David Sugar <dsugar@tresys.com> |
|---|
| 5 | 5 | |*| |
|---|
| 6 | | |*| Version: @version@ |
|---|
| | 6 | |*| $Rev$ |
|---|
| | 7 | |*| $Date$ |
|---|
| 7 | 8 | \*/ |
|---|
| 8 | 9 | |
|---|
| … | … | |
| 19 | 20 | import org.eclipse.ui.PlatformUI; |
|---|
| 20 | 21 | |
|---|
| | 22 | import com.tresys.framework.compiler.linkage.net.NetResource; |
|---|
| | 23 | import com.tresys.framework.compiler.linkage.net.NetworkConfig; |
|---|
| 21 | 24 | import com.tresys.framework.plugin.editor.policy.graphic.model.Connection; |
|---|
| 22 | 25 | import com.tresys.framework.plugin.editor.policy.graphic.model.ControlResourceShape; |
|---|
| … | … | |
| 24 | 27 | import com.tresys.framework.plugin.editor.policy.graphic.model.EntryPointShape; |
|---|
| 25 | 28 | import com.tresys.framework.plugin.editor.policy.graphic.model.ModelElement; |
|---|
| | 29 | import com.tresys.framework.plugin.editor.policy.graphic.model.NetworkResourceShape; |
|---|
| 26 | 30 | import com.tresys.framework.plugin.editor.policy.graphic.model.PolicyDiagram; |
|---|
| 27 | 31 | import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; |
|---|
| … | … | |
| 140 | 144 | |
|---|
| 141 | 145 | if (wasRemoved) |
|---|
| | 146 | { |
|---|
| 142 | 147 | removeConnections(m_connections); |
|---|
| | 148 | removeNetworkConfig (); |
|---|
| | 149 | } |
|---|
| 143 | 150 | else |
|---|
| 144 | 151 | addControlResources(); |
|---|
| … | … | |
| 217 | 224 | addControlResources(); |
|---|
| 218 | 225 | addConnections(m_connections); |
|---|
| | 226 | addNetworkConfig (); |
|---|
| | 227 | } |
|---|
| | 228 | } |
|---|
| | 229 | |
|---|
| | 230 | private void addNetworkConfig () |
|---|
| | 231 | { |
|---|
| | 232 | if (m_child instanceof NetworkResourceShape) |
|---|
| | 233 | { |
|---|
| | 234 | NetResource netRes = ((NetworkResourceShape) m_child).getNetResource (); |
|---|
| | 235 | NetworkConfig netConfig = m_parent.getSystem ().getNetworkConfig (); |
|---|
| | 236 | netConfig.Add (netRes); |
|---|
| | 237 | } |
|---|
| | 238 | } |
|---|
| | 239 | |
|---|
| | 240 | private void removeNetworkConfig () |
|---|
| | 241 | { |
|---|
| | 242 | if (m_child instanceof NetworkResourceShape) |
|---|
| | 243 | { |
|---|
| | 244 | NetResource netRes = ((NetworkResourceShape) m_child).getNetResource (); |
|---|
| | 245 | NetworkConfig netConfig = m_parent.getSystem ().getNetworkConfig (); |
|---|
| | 246 | netConfig.Remove (netRes); |
|---|
| 219 | 247 | } |
|---|
| 220 | 248 | } |
|---|
| r2169 |
r2172 |
|
| 100 | 100 | |
|---|
| 101 | 101 | private Rdef m_rdef; |
|---|
| | 102 | private NetResource m_netResource; |
|---|
| 102 | 103 | |
|---|
| 103 | 104 | // private String protocol; |
|---|
| … | … | |
| 150 | 151 | } |
|---|
| 151 | 152 | return m_rdefs; |
|---|
| | 153 | } |
|---|
| | 154 | |
|---|
| | 155 | public NetResource getNetResource () |
|---|
| | 156 | { |
|---|
| | 157 | return m_netResource; |
|---|
| | 158 | } |
|---|
| | 159 | |
|---|
| | 160 | public void setNetResource (NetResource i_netResource) |
|---|
| | 161 | { |
|---|
| | 162 | m_netResource = i_netResource; |
|---|
| 152 | 163 | } |
|---|
| 153 | 164 | |
|---|
| … | … | |
| 568 | 579 | { |
|---|
| 569 | 580 | HashSet protocols = new HashSet (); |
|---|
| 570 | | protocols.add ("All"); |
|---|
| | 581 | protocols.add ("any"); |
|---|
| 571 | 582 | protocols.add ("tcp"); |
|---|
| 572 | 583 | protocols.add ("udp"); |
|---|
| r2169 |
r2172 |
|
| 10 | 10 | package com.tresys.framework.plugin.wizards.shape; |
|---|
| 11 | 11 | |
|---|
| 12 | | import org.eclipse.core.resources.IProject; |
|---|
| 13 | 12 | import org.eclipse.jface.viewers.IStructuredSelection; |
|---|
| 14 | 13 | import org.eclipse.ui.IWorkbench; |
|---|
| … | … | |
| 25 | 24 | import com.tresys.framework.compiler.systemResources.NetworkInfo; |
|---|
| 26 | 25 | import com.tresys.framework.compiler.systemResources.SystemResourceTypes; |
|---|
| 27 | | import com.tresys.framework.plugin.builder.FrameworkNature; |
|---|
| 28 | 26 | import com.tresys.framework.plugin.editor.policy.graphic.model.NetworkResourceShape; |
|---|
| 29 | 27 | import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; |
|---|
| … | … | |
| 52 | 50 | public void addPages () |
|---|
| 53 | 51 | { |
|---|
| 54 | | m_page1 = new NetworkResourceShapePropertyPage ((NetworkResourceShape) getShape (), m_bFillInValues); |
|---|
| | 52 | m_page1 = new NetworkResourceShapePropertyPage (getCastedShape (), m_bFillInValues); |
|---|
| 55 | 53 | addPage (m_page1); |
|---|
| 56 | 54 | } |
|---|
| 57 | 55 | |
|---|
| | 56 | private NetworkResourceShape getCastedShape () |
|---|
| | 57 | { |
|---|
| | 58 | return (NetworkResourceShape) getShape (); |
|---|
| | 59 | } |
|---|
| | 60 | |
|---|
| 58 | 61 | public boolean performFinish () |
|---|
| 59 | 62 | { |
|---|
| 60 | 63 | //m_shape.setComponent (m_page1.getSelection()); |
|---|
| 61 | | Component comp = getShape ().getComponent (); |
|---|
| | 64 | NetworkResourceShape netShape = getCastedShape (); |
|---|
| | 65 | Component comp = netShape.getComponent (); |
|---|
| 62 | 66 | if (! (comp instanceof ComponentWithDictObjects)) |
|---|
| 63 | 67 | return false; |
|---|
| … | … | |
| 66 | 70 | component.ClearAllRdef (); |
|---|
| 67 | 71 | |
|---|
| | 72 | |
|---|
| 68 | 73 | Rdef rdef = m_page1.getNetworkType (); |
|---|
| 69 | 74 | //set the rdef |
|---|
| … | … | |
| 73 | 78 | getShape ().setName (shape_name); |
|---|
| 74 | 79 | |
|---|
| 75 | | IProject project = getShape ().getSystem ().getProject (); |
|---|
| 76 | | FrameworkNature nat = FrameworkNature.getNature (project); |
|---|
| 77 | | NetworkConfig config = nat.getNetworkConfiguration (); |
|---|
| | 80 | NetworkConfig config = getShape ().getSystem ().getNetworkConfig (); |
|---|
| 78 | 81 | |
|---|
| 79 | 82 | if (rdef.GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Yes |
|---|
| … | … | |
| 91 | 94 | net_resource.generateNewAuth (NetResource.AUTH_KEY_TYPE_MD5); |
|---|
| 92 | 95 | net_resource.generateNewKey (NetResource.ENC_KEY_TYPE_BLOWFISH); |
|---|
| | 96 | |
|---|
| | 97 | netShape.setNetResource (net_resource); |
|---|
| 93 | 98 | config.Add (net_resource); |
|---|
| 94 | 99 | } |
|---|
| … | … | |
| 124 | 129 | net_resource.put (NetResource.KEY_TYPE, rdef.GetName ()); |
|---|
| 125 | 130 | config.Add (net_resource); |
|---|
| | 131 | netShape.setNetResource (net_resource); |
|---|
| 126 | 132 | } |
|---|
| 127 | 133 | |
|---|
Download in other formats:
* Generating other formats may take time.