Changeset 2218

Show
Ignore:
Timestamp:
06/10/08 13:21:28 (3 months ago)
Author:
dsugar
Message:

rename better now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/framework-plugin/src/com/tresys/framework/compiler/FNetGenerator.java

    r2215 r2218  
    4242        public void Visit (NetConnection i_net_connection) 
    4343        { 
    44                 i_net_connection.getESPNumber (); 
    45                 i_net_connection.getSource (); 
    46                 i_net_connection.getTarget (); 
    4744                StringBuffer ip_info_source = new StringBuffer (70); 
    4845                StringBuffer ip_info_target = new StringBuffer (70); 
  • trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkAdder.java

    r2216 r2218  
    1616import com.tresys.framework.compiler.dictionary.Rdef; 
    1717import com.tresys.framework.compiler.dictionary.SysResourceState; 
     18import com.tresys.framework.compiler.dictionary.Verb; 
     19import com.tresys.framework.compiler.policy.Access; 
     20import com.tresys.framework.compiler.policy.AccessNetwork; 
     21import com.tresys.framework.compiler.policy.IDomain; 
    1822import com.tresys.framework.compiler.policy.Policy; 
    1923import com.tresys.framework.compiler.policy.NetworkResource; 
    2024import com.tresys.framework.compiler.policy.Token; 
     25import com.tresys.framework.compiler.policy.UnrevokableException; 
    2126import com.tresys.framework.compiler.systemResources.LabeledNetworkResource; 
    2227import com.tresys.framework.compiler.systemResources.NetworkInfo; 
     
    6469                        m_sysPolicy.Add (netRes); 
    6570                } 
     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; 
    6679                 
    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) 
    68127                { 
    69128                         
    70129                } 
    71130                 
    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                } 
    77140        } 
    78141 
  • trunk/framework-plugin/src/com/tresys/framework/compiler/linkage/net/NetworkConfig.java

    r2217 r2218  
    6868                        m_netresources.put (sName, i_item); 
    6969                        if (!m_endpoints.containsKey (sName)) 
    70                                 m_endpoints.put (sName, new HashSet ()); 
     70                                m_endpoints.put (sName, new Vector ()); 
    7171                        if (!m_connections.containsKey (sName)) 
    72                                 m_connections.put (sName, new HashSet ()); 
     72                                m_connections.put (sName, new Vector ()); 
    7373                } 
    7474        } 
     
    150150                        String sName = res.getName (); 
    151151                        Collection cons = (Collection) m_connections.get (sName); 
    152                         cons.add (i_connection); 
     152                        if (!cons.contains (i_connection)) 
     153                                cons.add (i_connection); 
    153154                         
    154155                        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 ()); 
    157160                } 
    158161        } 
     
    277280                        Token domTok = new Token (dom.getToken ()); 
    278281                        Endpoint pt1 = new Endpoint (sys, domTok, netInfo);  
    279                          
    280                         endpoints.add (pt1); 
     282                        if (!endpoints.contains (pt1)) 
     283                               endpoints.add (pt1); 
    281284                } 
    282285                 
     
    284287                { 
    285288                        Collection oldConnections = getConnections (netRes); 
    286                         Collection newConnection = new HashSet (); 
     289                        Collection newConnection = new Vector (); 
    287290 
    288291                        for (Iterator itr = endpoints.iterator (); itr.hasNext (); ) 
     
    384387                                } 
    385388                        } 
    386                          
    387                 } 
    388                  
     389                } 
    389390        } 
    390391 
  • trunk/framework-plugin/src/com/tresys/framework/compiler/policy/AccessNetwork.java

    r2144 r2218  
    2121        extends AccessResource 
    2222{ 
    23          
    24          
    25          
    2623        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
    2825        throws UnrevokableException 
    2926        { 
  • trunk/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java

    r2179 r2218  
    267267         *                              <code>false</code> otherwise. 
    268268         */ 
    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 ()))  
    272272                { 
    273273                        axx.Token.Error("Constraint violation: a domain cannot access its children"); 
     
    277277                Domain resourceParent = axx.getResource().getParent(); 
    278278 
    279                 if(resourceParent != null && !axx.getDomain ().IsDescendant(resourceParent))  
     279                if (resourceParent != null && !axx.getDomain ().IsDescendant(resourceParent))  
    280280                { 
    281281                        axx.Token.Error("Constraint violation: a domain cannot access a resource enclosed in another domain"); 
     
    284284 
    285285                Iterator itr = axx.getDomain().GetAccesses(axx.verb().intValue()).iterator(); 
    286                 while(itr.hasNext()) 
     286                while (itr.hasNext()) 
    287287                { 
    288288                        Access tmpAccess = (Access)itr.next(); 
  • trunk/framework-plugin/src/com/tresys/framework/compiler/policy/PolicyParser.jj

    r2191 r2218  
    5454import com.tresys.framework.compiler.linkage.net.NetworkConfig; 
    5555import com.tresys.framework.compiler.linkage.net.NetResource; 
    56 import com.tresys.framework.compiler.linkage.net.NetConnection; 
    5756 
    5857import com.tresys.slide.utility.policyxmlparser.Interface; 
     
    894893                                if (component instanceof NetworkResource) 
    895894                                { 
    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); 
    899896                                } 
    900897                                else if(component instanceof Resource)  
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AbstractAccessConnectionCommand.java

    r2152 r2218  
    1212import java.util.Collection; 
    1313import java.util.Iterator; 
    14 import java.util.Random; 
    1514import java.util.Vector; 
    1615 
     
    112111                else if (resource instanceof NetworkResource) 
    113112                { 
    114                         int nESP = new Random ().nextInt (15000) + 1000; 
    115113                        try 
    116114                        { 
    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); 
    118116                        } 
    119117                        catch (UnrevokableException ue)