Changeset 2171
- Timestamp:
- 05/21/08 11:51:51
(6 months ago)
- Author:
- apatel
- Message:
add/delete system from the in memory network configuration.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2149 |
r2171 |
|
| 24 | 24 | public class NetworkConfig |
|---|
| 25 | 25 | { |
|---|
| 26 | | private final Map m_itemss = new HashMap (); |
|---|
| | 26 | private final Map m_items = new HashMap (); |
|---|
| 27 | 27 | // private final Map m_resources = new HashMap (); |
|---|
| 28 | 28 | private final Map m_connections = new HashMap (); |
|---|
| … | … | |
| 34 | 34 | { |
|---|
| 35 | 35 | String sName = i_item.getName (); |
|---|
| 36 | | m_itemss.put (sName, i_item); |
|---|
| | 36 | m_items.put (sName, i_item); |
|---|
| 37 | 37 | } |
|---|
| 38 | 38 | |
|---|
| | 39 | public void Remove (String item_name) |
|---|
| | 40 | { |
|---|
| | 41 | m_items.remove (item_name); |
|---|
| | 42 | } |
|---|
| | 43 | |
|---|
| 39 | 44 | public void Accept(INetVisitor i_visitor) |
|---|
| 40 | 45 | { |
|---|
| 41 | 46 | i_visitor.Visit (this); |
|---|
| 42 | 47 | |
|---|
| 43 | | for( Iterator itr= m_itemss.values ().iterator (); itr.hasNext (); ) |
|---|
| | 48 | for( Iterator itr= m_items.values ().iterator (); itr.hasNext (); ) |
|---|
| 44 | 49 | { |
|---|
| 45 | 50 | Object item = itr.next (); |
|---|
| … | … | |
| 57 | 62 | public NetSystem getSystem (String i_sName) |
|---|
| 58 | 63 | { |
|---|
| 59 | | NetItem item = (NetItem) m_itemss.get (i_sName); |
|---|
| | 64 | NetItem item = (NetItem) m_items.get (i_sName); |
|---|
| 60 | 65 | |
|---|
| 61 | 66 | if (item instanceof NetSystem) |
|---|
| … | … | |
| 66 | 71 | public NetResource getResource (String i_sName) |
|---|
| 67 | 72 | { |
|---|
| 68 | | NetItem item = (NetItem) m_itemss.get (i_sName); |
|---|
| | 73 | NetItem item = (NetItem) m_items.get (i_sName); |
|---|
| 69 | 74 | |
|---|
| 70 | 75 | if (item instanceof NetResource) |
|---|
| … | … | |
| 75 | 80 | public Collection getNetworkItems () |
|---|
| 76 | 81 | { |
|---|
| 77 | | return m_itemss.values (); |
|---|
| | 82 | return m_items.values (); |
|---|
| 78 | 83 | } |
|---|
| 79 | 84 | |
|---|
| r2170 |
r2171 |
|
| 354 | 354 | } |
|---|
| 355 | 355 | } |
|---|
| 356 | | else |
|---|
| 357 | | { |
|---|
| 358 | | //TODO::adding and removing systems, somewhere else |
|---|
| 359 | | for( Iterator sys_itr = getSystems ().iterator (); sys_itr.hasNext (); ) |
|---|
| 360 | | { |
|---|
| 361 | | Token tok = new Token(); |
|---|
| 362 | | tok.image = ((SELinuxSystem)sys_itr.next ()).getName (); |
|---|
| 363 | | NetSystem sys = new NetSystem(tok); |
|---|
| 364 | | m_networkConfiguration.Add (sys); |
|---|
| 365 | | } |
|---|
| 366 | | } |
|---|
| 367 | 356 | } |
|---|
| 368 | 357 | return m_networkConfiguration; |
|---|
| … | … | |
| 632 | 621 | Collection systems = getSystems(); |
|---|
| 633 | 622 | if (!systems.contains(i_system)) |
|---|
| | 623 | { |
|---|
| 634 | 624 | systems.add(i_system); |
|---|
| | 625 | // add the system to netconfing |
|---|
| | 626 | Token tok = new Token(); |
|---|
| | 627 | tok.image = i_system.getName (); |
|---|
| | 628 | NetSystem sys = new NetSystem(tok); |
|---|
| | 629 | getNetworkConfiguration ().Add (sys); |
|---|
| | 630 | } |
|---|
| 635 | 631 | } |
|---|
| 636 | 632 | |
|---|
| … | … | |
| 639 | 635 | Collection systems = getSystems(); |
|---|
| 640 | 636 | if (systems.contains(i_system)) |
|---|
| | 637 | { |
|---|
| 641 | 638 | systems.remove(i_system); |
|---|
| | 639 | // remove the system from the netconfig |
|---|
| | 640 | getNetworkConfiguration ().Remove(i_system.getName ()); |
|---|
| | 641 | } |
|---|
| 642 | 642 | } |
|---|
| 643 | 643 | |
|---|
Download in other formats:
* Generating other formats may take time.