Changeset 1942

Show
Ignore:
Timestamp:
02/21/08 07:25:57 (9 months ago)
Author:
dsugar
Message:

output dictionary into support (.spt) file instead of into module interfaces.
This will allow us to have multiple modules generated and not give us duplicate template names.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dictionary_changes/src/com/tresys/framework/compiler/Compiler.java

    r1938 r1942  
    2323 
    2424import com.tresys.framework.compiler.dictionary.Dictionary; 
     25import com.tresys.framework.compiler.dictionary.TranslatorDictionary; 
    2526import com.tresys.framework.compiler.linkage.Linkage; 
    2627import com.tresys.framework.compiler.policy.Policy; 
     
    5253        static String ifFilename = null; 
    5354 
     55        static String dictionarySupportFile = null; 
     56         
    5457        static String libPath = System.getProperty ("user.dir") + "/libselinuxjava/libselinuxjava.so"; 
    5558 
     
    169172                                        fcOutputFilename = args[x]; 
    170173                                } 
     174                                else 
     175                                { 
     176                                        printUsage (); 
     177                                        System.exit (1); 
     178                                } 
     179                        } 
     180                        else if (args[x].equals ("-do")) 
     181                        { 
     182                                x++; 
     183                                if (x < args.length) 
     184                                        dictionarySupportFile = args[x]; 
    171185                                else 
    172186                                { 
     
    250264        private static void printUsage () 
    251265        { 
    252                 System.out.println ("SEFramework compiler usage:\n"); 
     266                System.out.println ("CDSFramework compiler usage:\n"); 
    253267                System.out.println ("java com.tresys.framework.compiler.Compiler [-h] [-v]\n" 
    254268                        + "[-lib <dir/libselinuxjava.so>]\n" + "[-fc <file_context>] -pc <policy.conf>\n" 
    255269                        + "[-ds <dictionary source> [-do <dictionary output>]]\n" 
    256                         + "[-dc <compiled dictionary>]\n" + "[-p <policy>] [-po output]\n" 
     270                        + "[-p <policy>] [-po output]\n" 
    257271                        + "[-s <system resource source>] [-sf <generated file context output file>]"); 
    258                 System.out.println ("\nGeneral arguments:"); 
     272                System.out.println (); 
     273                System.out.println ("General arguments:"); 
    259274                System.out.println ("  -h display this message and exit"); 
    260275                System.out.println ("  -v display verbose output"); 
    261                 System.out 
    262                         .println ("  -lib <libselinuxjava.so> specify path to libselinuxjava.so library to be loaded"); 
    263                 System.out.println ("\nGlobal arguments:"); 
     276                System.out.println ("  -lib <libselinuxjava.so> specify path to libselinuxjava.so library to be"); 
     277                System.out.println ("       loaded"); 
     278                System.out.println (); 
     279                System.out.println ("Global arguments:"); 
    264280                System.out.println ("  -pc <flaskPath> specify path to base policy flask directory"); 
    265281                System.out.println ("  -fc <file_context> specify base policy file_context"); 
    266                 System.out.println ("\nDictionary arguments:"); 
     282                System.out.println (); 
     283                System.out.println ("Dictionary arguments:"); 
    267284                System.out.println ("  -ds <dictionary source> specify source file for dictionary"); 
    268                 System.out.println ("\nPolicy arguments:"); 
     285                System.out.println (); 
     286                System.out.println ("Policy arguments:"); 
    269287                System.out.println ("  -p <policy source> specify source file for policy parsing"); 
    270                 System.out 
    271                         .println ("  -po <output file> specify output file for translated policy output (defaults to stdout if not specified)"); 
    272                 System.out 
    273                         .println ("  -if <interface file> specify interface file for linkage to reference policy and exposing an external API (defaults to stdout if not specified)"); 
    274                 System.out.println ("\nSystem resource arguments:"); 
     288                System.out.println ("  -po <output file> specify output file for translated policy output"); 
     289                System.out.println ("       (defaults to stdout if not specified)"); 
     290                System.out.println ("  -if <interface file> specify interface file for linkage to reference policy"); 
     291                System.out.println ("       and exposing an external API (defaults to stdout if not specified)"); 
     292                System.out.println (); 
     293                System.out.println ("System resource arguments:"); 
    275294                System.out.println ("  -s <system resource source> specify source file for system parsing"); 
    276                 System.out 
    277                         .println ("  -sf <fcoutput file> specify output file for file context output (defaults to stdout if not specified)"); 
    278                 System.out.println ("\nOutput arguments (repeated here for reference):"); 
    279                 System.out 
    280                         .println ("  -do <dictionary output> specify destination file for dictionary storage"); 
    281                 System.out 
    282                         .println ("  -po <output file> specify output file for translated policy output (defaults to stdout if not specified)"); 
    283                 System.out 
    284                         .println ("  -sf <fcoutput file> specify output file for file context output (defaults to stdout if not specified)"); 
    285                 System.out 
    286                         .println ("  -if <interface file> specify interface file for linkage to reference policy and exposing an external API (defaults to stdout if not specified)"); 
    287                 System.out.println ("\nA dictionary file must be specified."); 
     295                System.out.println ("  -sf <fcoutput file> specify output file for file context output"); 
     296                System.out.println ("       (defaults to stdout if not specified)"); 
     297                System.out.println (); 
     298                System.out.println ("Output arguments (repeated here for reference):"); 
     299                System.out.println ("  -do <dictionary output> specify destination for dictionary (spt) support file"); 
     300                System.out.println ("  -po <output file> specify output file for translated policy output"); 
     301                System.out.println ("       (defaults to stdout if not specified)"); 
     302                System.out.println ("  -sf <fcoutput file> specify output file for file context output"); 
     303                System.out.println ("       (defaults to stdout if not specified)"); 
     304                System.out.println ("  -if <interface file> specify interface file for linkage to reference policy"); 
     305                System.out.println ("       and exposing an external API (defaults to stdout if not specified)"); 
     306                System.out.println (); 
     307                System.out.println ("A dictionary file must be specified."); 
    288308        } 
    289309 
     
    429449                        moduleName = moduleName.substring (slash + 1); 
    430450 
     451                if (dictionarySupportFile != null) 
     452                { 
     453                        TranslatorDictionary dictTrans = new TranslatorDictionary (); 
     454                        dictionary.Accept (dictTrans); 
     455                         
     456                        PrintStream streamDictionary = null; 
     457                        try 
     458                        { 
     459                                streamDictionary = new PrintStream (new FileOutputStream (dictionarySupportFile)); 
     460                                System.out.println ("Writing dictionary translation to " + dictionarySupportFile + "..."); 
     461                                streamDictionary.print (dictTrans.getDictionary ().toString ()); 
     462                                streamDictionary.flush (); 
     463                                streamDictionary.close (); 
     464                        } 
     465                        catch (FileNotFoundException e) 
     466                        { 
     467//                              ErrorExit (e.getMessage ()); 
     468                                 
     469                        } 
     470                         
     471                } 
    431472                translator = new TranslatorSELinux (linkage, moduleName, fcFile); 
    432473 
    433474                policy.Accept (translator); 
    434475 
     476                 
    435477                final OutputStream teData = translator.GetPolicy (); 
    436478                final OutputStream ifData = translator.GetInterfaces (); 
  • branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessDefn.java

    r1938 r1942  
    3636 */ 
    3737public final class AccessDefn 
    38         implements Comparable/* <AccessDefn> */, INameValue 
     38        implements Comparable/* <AccessDefn> */, INameValue, IDictionaryVisitable 
    3939{ 
    4040 
     
    212212        } 
    213213 
     214        public void Accept (IDictionaryVisitor i_visitor) 
     215        { 
     216                i_visitor.PreVisit (this); 
     217                 
     218                for (Iterator itr = getAccessTargets ().values ().iterator (); itr.hasNext (); ) 
     219                { 
     220                        AccessTarget target = (AccessTarget) itr.next (); 
     221                        target.Accept (i_visitor); 
     222                } 
     223                 
     224                i_visitor.PostVisit (this); 
     225        } 
     226         
    214227        /** 
    215228         * Test AccessDefn for validity. 
  • branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessDefnGroup.java

    r1878 r1942  
    3434 */ 
    3535public final class AccessDefnGroup  
     36        implements IDictionaryVisitable 
    3637{ 
    3738 
     
    124125                return defns; 
    125126        } 
     127         
     128        public void Accept (IDictionaryVisitor i_visitor) 
     129        { 
     130                i_visitor.PreVisit (this); 
     131                 
     132                for (Iterator itr = accessDefns.values ().iterator (); itr.hasNext (); ) 
     133                { 
     134                        AccessDefn ad = (AccessDefn) itr.next (); 
     135                        ad.Accept (i_visitor); 
     136                } 
     137                 
     138                i_visitor.PostVisit (this); 
     139        } 
    126140 
    127141        /** 
  • branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessTarget.java

    r1938 r1942  
    55 *   
    66 * AccessTarget.java: AccessResource target class  
    7  * Version: @version@ 
     7 *  
     8 * $Rev$ 
     9 * $Date$ 
    810 */ 
    911package com.tresys.framework.compiler.dictionary; 
     
    1820 
    1921/** 
    20  * This class represents an access target definition in a FObject. An  
     22 * This class represents an access target definition in a FObject. An 
    2123 * AccessTarget refers to one named information flow sub-group and its 
    22  * PermVector(s).   
     24 * PermVector(s). 
    2325 * <p> 
    2426 * Syntatically (each line is a separate AccessTarget):<br> 
    25  *                     <code>resource { file { read getattr lock } dir { search read } }<br> 
     27 * <code>resource { file { read getattr lock } dir { search read } }<br> 
    2628 *                      self { PermVectors... }<br> 
    2729 *                      other verb { PermVectors... }<br> 
    2830 * </code> 
    2931 *  
    30  * @see        PermVector 
     32 * @see PermVector 
    3133 * @see AccessDefn 
    3234 */ 
    33 public final class AccessTarget { 
     35public final class AccessTarget 
     36        implements IDictionaryVisitable 
     37
    3438 
    3539        /** The info. flow target associated with the instance of the class */ 
    36         protected final/*Target*/Integer TargetName; 
     40        protected final/* Target */Integer TargetName; 
    3741 
    3842        /** Map of PermVectors (default comparison operator used) */ 
    39         private final Map/*<String, PermVector>*/permvectors; 
     43        private final Map/* <String, PermVector> */permvectors; 
    4044 
    4145        /** 
    4246         * Default constructor for AccessTarget. 
    43          *   
    44          * @param target        Information flow target. 
    45          */ 
    46         public AccessTarget(Integer /*Target*/target) { 
    47                 permvectors = new TreeMap/*<String, PermVector>*/(); 
     47         *  
     48         * @param target 
     49         *            Information flow target. 
     50         */ 
     51        public AccessTarget (Integer /* Target */target) 
     52        { 
     53                permvectors = new TreeMap/* <String, PermVector> */(); 
    4854                TargetName = target; 
    4955        } 
     
    5157        /** 
    5258         * Add a PermVector to this object. 
    53          * 
    54          * @param vector        is the PermVector to add to the AccessType 
    55          * @return                      <code>true</code> if permission vector successfully  
    56          *                                      inserted, <code>false</code> otherwise 
    57          * @see                         PermVector 
    58          */ 
    59         public boolean AddPermVector(PermVector vector) { 
     59         *  
     60         * @param vector 
     61         *            is the PermVector to add to the AccessType 
     62         * @return <code>true</code> if permission vector successfully inserted, 
     63         *         <code>false</code> otherwise 
     64         * @see PermVector 
     65         */ 
     66        public boolean AddPermVector (PermVector vector) 
     67        { 
    6068                // add if TEVector has not been previously defined for this component 
    61                 if(permvectors.containsKey(vector.getObjectClass())) { 
     69                if (permvectors.containsKey (vector.getObjectClass ())) 
     70                { 
    6271                        return false; 
    6372                } 
    64                 permvectors.put(vector.getObjectClass(), vector); 
     73                permvectors.put (vector.getObjectClass (), vector); 
    6574                return true; 
    6675        } 
    6776 
    68         public Integer getTargetName() { 
     77        public Integer getTargetName () 
     78        { 
    6979                return TargetName; 
    7080        } 
    7181 
    7282        /** 
    73          * Get Permission Vectors(s)  
    74          *  
    75          * @return              Map of PermVector(s) 
    76          */ 
    77         public Map/*<String, PermVector>*/GetPermVectors() { 
     83         * Get Permission Vectors(s) 
     84         *  
     85         * @return Map of PermVector(s) 
     86         */ 
     87        public Map/* <String, PermVector> */GetPermVectors () 
     88        { 
    7889                return permvectors; 
    7990        } 
    8091 
    8192        /** 
    82          * Get Permission Vector by object class  
    83          *  
    84          * @param objClass The object class for this PermVector 
    85          * @return              PermVector if found, null otherwise 
    86          */ 
    87         public PermVector GetPermVector(String objClass) { 
    88                 return (PermVector) permvectors.get(objClass); 
    89         } 
    90  
    91         /** 
    92          * Check to ensure this instance is a subset of another.  In other words, 
    93          * this method returns <code>true</code> when the parameter passed to this  
    94          * method is a superset of this instance.  
    95          *  
    96          * @param other Another AccessTarget instance to perform comparison against. 
    97          * @return              <code>true</code> if this instance is a subset of other, 
    98          *                              <code>false</code> otherwise. 
    99          */ 
    100         public boolean IsSubsetOf(AccessTarget other) { 
    101                 if(other == null) { 
     93         * Get Permission Vector by object class 
     94         *  
     95         * @param objClass 
     96         *            The object class for this PermVector 
     97         * @return PermVector if found, null otherwise 
     98         */ 
     99        public PermVector GetPermVector (String objClass) 
     100        { 
     101                return (PermVector) permvectors.get (objClass); 
     102        } 
     103 
     104        /** 
     105         * Check to ensure this instance is a subset of another. In other words, 
     106         * this method returns <code>true</code> when the parameter passed to this 
     107         * method is a superset of this instance. 
     108         *  
     109         * @param other 
     110         *            Another AccessTarget instance to perform comparison against. 
     111         * @return <code>true</code> if this instance is a subset of other, 
     112         *         <code>false</code> otherwise. 
     113         */ 
     114        public boolean IsSubsetOf (AccessTarget other) 
     115        { 
     116                if (other == null) 
     117                { 
    102118                        return false; 
    103119                } 
    104120                // iterate over perm vectors checking for superset 
    105                 /*for (Map.Entry<String, PermVector> mapEntry: this.permvectors.entrySet())*/ 
    106                 Iterator iter = this.permvectors.entrySet().iterator(); 
    107                 while(iter.hasNext()) { 
    108                         Map.Entry mapEntry = (Map.Entry) iter.next(); 
     121                /* 
     122                 * for (Map.Entry<String, PermVector> mapEntry: 
     123                 * this.permvectors.entrySet()) 
     124                 */ 
     125                Iterator iter = this.permvectors.entrySet ().iterator (); 
     126                while (iter.hasNext ()) 
     127                { 
     128                        Map.Entry mapEntry = (Map.Entry) iter.next (); 
    109129                        // if it has a corresponding permVector check that permVector 
    110                         if(other.permvectors.containsKey(mapEntry.getKey())) { 
    111                                 if(!((AccessTarget) mapEntry.getValue()) 
    112                                         .IsSubsetOf((AccessTarget) other.permvectors.get(mapEntry 
    113                                                 .getKey()))) { 
     130                        if (other.permvectors.containsKey (mapEntry.getKey ())) 
     131                        { 
     132                                if (! ((AccessTarget) mapEntry.getValue ()) 
     133                                        .IsSubsetOf ((AccessTarget) other.permvectors.get (mapEntry.getKey ()))) 
     134                                { 
    114135                                        return false; 
    115136                                } 
    116                         } else { 
     137                        } 
     138                        else 
     139                        { 
    117140                                return false; 
    118141                        } 
     
    121144        } 
    122145 
     146        public void Accept (IDictionaryVisitor i_visitor) 
     147        { 
     148                i_visitor.PreVisit (this); 
     149 
     150                for (Iterator itr = GetPermVectors ().values ().iterator (); itr.hasNext ();) 
     151                { 
     152                        PermVector perms = (PermVector) itr.next (); 
     153                        perms.Accept (i_visitor); 
     154                } 
     155                 
     156                i_visitor.PostVisit (this); 
     157        } 
     158 
    123159        /** 
    124160         * Test AccessTarget for validity. 
    125          *   
    126          * @return              <code>true</code> if target is valid. 
    127          */ 
    128         final boolean Validate(Linkage linkage) { 
     161         *  
     162         * @return <code>true</code> if target is valid. 
     163         */ 
     164        final boolean Validate (Linkage linkage) 
     165        { 
    129166                boolean valid = true; 
    130167 
    131                 /*for (PermVector pv:permvectors.values())*/ 
    132                 Iterator iter = permvectors.values().iterator(); 
    133                 while(iter.hasNext()) { 
    134                         PermVector pv = (PermVector) iter.next(); 
    135                         valid &= pv.Validate(linkage); 
     168                /* for (PermVector pv:permvectors.values()) */ 
     169                Iterator iter = permvectors.values ().iterator (); 
     170                while (iter.hasNext ()) 
     171                { 
     172                        PermVector pv = (PermVector) iter.next (); 
     173                        valid &= pv.Validate (linkage); 
    136174                } 
    137175                return valid; 
    138176        } 
    139177 
    140         public static AccessTarget MergeAccessTargets (Collection/*<AccessTarget>*/targets)  
    141         { 
    142                 Map/*<String, Vector<PermVector>>*/pvMap = new TreeMap/*<String, Vector<PermVector>>*/(); 
    143                 Integer /*Target*/name = null; 
    144  
    145                 /*for (AccessTarget target:targets)*/ 
    146                 Iterator iter = targets.iterator(); 
    147                 while(iter.hasNext()) { 
    148                         AccessTarget target = (AccessTarget) iter.next(); 
    149                         if(name == null) { 
     178        public static AccessTarget MergeAccessTargets (Collection/* <AccessTarget> */targets) 
     179        { 
     180                Map/* <String, Vector<PermVector>> */pvMap = new TreeMap/* 
     181                                                                                                                                 * <String, 
     182                                                                                                                                 * Vector<PermVector>> 
     183                                                                                                                                 */(); 
     184                Integer /* Target */name = null; 
     185 
     186                /* for (AccessTarget target:targets) */ 
     187                Iterator iter = targets.iterator (); 
     188                while (iter.hasNext ()) 
     189                { 
     190                        AccessTarget target = (AccessTarget) iter.next (); 
     191                        if (name == null) 
     192                        { 
    150193                                name = target.TargetName; 
    151194                        } // assuming all targets have the same TargetName 
    152195 
    153                         /*for (PermVector pv:target.GetPermVectors().values())*/ 
    154                         Iterator iter2 = target.GetPermVectors().values().iterator(); 
    155                         while(iter2.hasNext()) { 
    156                                 PermVector pv = (PermVector) iter2.next(); 
    157                                 Vector/*<PermVector>*/unmergedVectors; 
    158  
    159                                 if((unmergedVectors = (Vector) pvMap.get(pv.getObjectClass())) == null) { 
    160                                         unmergedVectors = new Vector/*<PermVector>*/(); 
    161                                         pvMap.put(pv.getObjectClass(), unmergedVectors); 
     196                        /* for (PermVector pv:target.GetPermVectors().values()) */ 
     197                        Iterator iter2 = target.GetPermVectors ().values ().iterator (); 
     198                        while (iter2.hasNext ()) 
     199                        { 
     200                                PermVector pv = (PermVector) iter2.next (); 
     201                                Vector/* <PermVector> */unmergedVectors; 
     202 
     203                                if ( (unmergedVectors = (Vector) pvMap.get (pv.getObjectClass ())) == null) 
     204                                { 
     205                                        unmergedVectors = new Vector/* <PermVector> */(); 
     206                                        pvMap.put (pv.getObjectClass (), unmergedVectors); 
    162207                                } 
    163208 
    164                                 unmergedVectors.add(pv); 
    165                         } 
    166                 } 
    167  
    168                 AccessTarget merged = new AccessTarget(name); 
    169  
    170                 /*for (Vector<PermVector> unmergedVectors:pvMap.values())*/ 
    171                 iter = pvMap.values().iterator(); 
    172                 while(iter.hasNext()) { 
    173                         Vector unmergedVectors = (Vector) iter.next(); 
    174                         try { 
    175                                 merged.AddPermVector(PermVector 
    176                                         .MergePermVectors(unmergedVectors)); 
    177                         } catch (Exception ex) { } 
     209                                unmergedVectors.add (pv); 
     210                        } 
     211                } 
     212 
     213                AccessTarget merged = new AccessTarget (name); 
     214 
     215                /* for (Vector<PermVector> unmergedVectors:pvMap.values()) */ 
     216                iter = pvMap.values ().iterator (); 
     217                while (iter.hasNext ()) 
     218                { 
     219                        Vector unmergedVectors = (Vector) iter.next (); 
     220                        try 
     221                        { 
     222                                merged.AddPermVector (PermVector.MergePermVectors (unmergedVectors)); 
     223                        } 
     224                        catch (Exception ex) 
     225                        {} 
    178226                } 
    179227 
  • branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/Dictionary.java

    r1710 r1942  
    66 *   
    77 * Dictionary.java: Contains all objects from a single dictionary 
    8  * Version: @version@ 
     8 *  
     9 * $Rev$ 
     10 * $Date$ 
    911 */ 
    1012package com.tresys.framework.compiler.dictionary; 
     
    2325 
    2426/** 
    25  * The Dictionary class represents an entire SEFramework 
    26  * dictionary file: the FObjects, the entrypoints, and any 
    27  * other information that is part of a dictionary. 
    28  * 
     27 * The Dictionary class represents an entire SEFramework dictionary file: the 
     28 * FObjects, the entrypoints, and any other information that is part of a 
     29 * dictionary. 
     30 *  
    2931 * @see AccessDefn 
    3032 * @see Rdef 
    3133 */ 
    32 public final class Dictionary { 
     34public final class Dictionary 
     35        implements IDictionaryVisitable 
     36
    3337        // A dictionary contains a set of rdefs 
    34         private final Map/*<String, Rdef>*/rdefs; 
     38        private final Map/* <String, Rdef> */rdefs; 
    3539 
    3640        /** A single entrypoint object */ 
     
    3842 
    3943        /** 
    40          * Dictionary object constructor  
    41          */ 
    42         public Dictionary() { 
     44         * Dictionary object constructor 
     45         */ 
     46        public Dictionary () 
     47        { 
    4348                // initialize the dictionary contents 
    44                 rdefs = new HashMap/*<String, Rdef>*/(); 
     49                rdefs = new HashMap/* <String, Rdef> */(); 
    4550        } 
    4651 
     
    4853         * Add the FObjects in a dictionary source file to the Dictionary. 
    4954         *  
    50          * @param dictFilename  dictionary filename 
    51          * @param outFilename   dictionary output filename or <code>null</code> 
    52          *                                              if compiled dictionary file is not to be created. 
    53          * @param errorHandler  error handler for the given stream 
    54          */ 
    55         public void AddDictionaryFile(String dictFilename, ErrorHandler errorHandler) { 
    56                 try { 
    57                         DictionaryParser parser = new DictionaryParser(this); 
    58                         File dictFile = new File(dictFilename); 
    59                         if(dictFile.exists() && dictFile.isFile() && dictFile.canRead()) 
    60                                 parser.Parse(new FileReader(dictFilename), errorHandler); 
     55         * @param dictFilename 
     56         *            dictionary filename 
     57         * @param outFilename 
     58         *            dictionary output filename or <code>null</code> if compiled 
     59         *            dictionary file is not to be created. 
     60         * @param errorHandler 
     61         *            error handler for the given stream 
     62         */ 
     63        public void AddDictionaryFile (String dictFilename, ErrorHandler errorHandler) 
     64        { 
     65                try 
     66                { 
     67                        DictionaryParser parser = new DictionaryParser (this); 
     68                        File dictFile = new File (dictFilename); 
     69                        if (dictFile.exists () && dictFile.isFile () && dictFile.canRead ()) 
     70                                parser.Parse (new FileReader (dictFilename), errorHandler); 
    6171                        else 
    62                                 errorHandler.CriticalError("Critical error opening file: " 
    63                                         + dictFilename + " not found or is not a file"); 
    64                 } catch (java.io.FileNotFoundException e) { 
    65                         errorHandler.CriticalError(e.toString() 
    66                                 + "\nCritical error opening file: " + dictFilename 
    67                                 + " not found"); 
    68                 } catch (Exception e) { 
    69                         errorHandler.CriticalError(e.toString() 
    70                                 + "\nCritical error opening file: " + dictFilename); 
     72                                errorHandler.CriticalError ("Critical error opening file: " + dictFilename 
     73                                        + " not found or is not a file"); 
     74                } 
     75                catch (java.io.FileNotFoundException e) 
     76                { 
     77                        errorHandler.CriticalError (e.toString () + "\nCritical error opening file: " 
     78                                + dictFilename + " not found"); 
     79                } 
     80                catch (Exception e) 
     81                { 
     82                        errorHandler.CriticalError (e.toString () + "\nCritical error opening file: " 
     83                                + dictFilename); 
    7184                } 
    7285        } 
     
    7588         * Add the FObjects in a dictionary stream to the Dictionary. 
    7689         *  
    77          * @param dictStream    dictionary input stream 
    78          * @param errorHandler  error handler for the given stream 
    79          */ 
    80         public void AddDictionaryReader(Reader dictReader, ErrorHandler errorHandler) { 
    81                 try { 
    82                         DictionaryParser parser = new DictionaryParser(this); 
    83  
    84                         parser.Parse(dictReader, errorHandler); 
    85                 } catch (Exception e) { 
    86                         errorHandler.CriticalError(e.getMessage()); 
     90         * @param dictStream 
     91         *            dictionary input stream 
     92         * @param errorHandler 
     93         *            error handler for the given stream 
     94         */ 
     95        public void AddDictionaryReader (Reader dictReader, ErrorHandler errorHandler) 
     96        { 
     97                try 
     98                { 
     99                        DictionaryParser parser = new DictionaryParser (this); 
     100 
     101                        parser.Parse (dictReader, errorHandler); 
     102                } 
     103                catch (Exception e) 
     104                { 
     105                        errorHandler.CriticalError (e.getMessage ()); 
    87106                } 
    88107        } 
     
    91110         * Adds a Rdef to the dictionary. 
    92111         *  
    93          * @param rdef  Rdef to be inserted into dictionary object 
    94          * @return              <code>true</code> on successful insertion,  
    95          *                              <code>false</code> otherwise. 
    96          * @see                 Rdef 
    97          */ 
    98         public boolean Add(Rdef rdef) { 
    99                 String _name = rdef.GetName(); 
     112         * @param rdef 
     113         *            Rdef to be inserted into dictionary object 
     114         * @return <code>true</code> on successful insertion, <code>false</code> 
     115         *         otherwise. 
     116         * @see Rdef 
     117         */ 
     118        public boolean Add (Rdef rdef) 
     119        { 
     120                String _name = rdef.GetName (); 
    100121 
    101122                // test for duplicate name 
    102                 if(rdefs.containsKey(_name)) { 
    103                        rdef.GetToken().Error( 
    104                                "Failed to insert Rdef in dictionary. Duplicate found"); 
     123                if (rdefs.containsKey (_name)) 
     124                { 
     125                        rdef.GetToken ().Error ("Failed to insert Rdef in dictionary. Duplicate found"); 
    105126                        return false; 
    106127                } 
    107128                // insert unique rdef 
    108                 rdefs.put(_name, rdef); 
     129                rdefs.put (_name, rdef); 
    109130                return true; 
    110131        } 
     
    112133        /** 
    113134         * Check to see if Dictionary contains dictionary object. 
    114          *   
    115          * @param name          String identifying dictionary object to be referenced 
    116          * @return Boolean      <code>true</code> if dictionary object identified by name  
    117          *                                      is found in Dictionary, <code>false</code> otherwise 
    118          * @see                         IDictionaryObject 
    119          * @see                         Rdef 
    120          * @see                         Extern 
    121          */ 
    122         public boolean ContainsDictionaryObject(String name) { 
    123                 return(rdefs.containsKey(name)); 
    124         } 
    125  
    126         /** 
    127          * Lookup a Rdef in the Dictionary.  
    128          *  
    129          * @param name  String identifying Rdef to retrieve 
    130          * @return              Rdef identified by name or <code>null</code> 
    131          *                              if name not found 
    132          * @see                 Rdef 
    133          */ 
    134         public Rdef GetRdef(String name) { 
    135                 return (Rdef) rdefs.get(name); 
    136         } 
    137  
    138         public Entrypoint GetEntrypoint() { 
     135         *  
     136         * @param name 
     137         *            String identifying dictionary object to be referenced 
     138         * @return Boolean <code>true</code> if dictionary object identified by 
     139         *         name is found in Dictionary, <code>false</code> otherwise 
     140         * @see IDictionaryObject 
     141         * @see Rdef 
     142         * @see Extern 
     143         */ 
     144        public boolean ContainsDictionaryObject (String name) 
     145        { 
     146                return (rdefs.containsKey (name)); 
     147        } 
     148 
     149        /** 
     150         * Lookup a Rdef in the Dictionary. 
     151         *  
     152         * @param name 
     153         *            String identifying Rdef to retrieve 
     154         * @return Rdef identified by name or <code>null</code> if name not found 
     155         * @see Rdef 
     156         */ 
     157        public Rdef GetRdef (String name) 
     158        { 
     159                return (Rdef) rdefs.get (name); 
     160        } 
     161 
     162        public Entrypoint GetEntrypoint () 
     163        { 
    139164                return Entrypoint; 
    140165        } 
     
    144169                Entrypoint = i_ep; 
    145170        } 
     171 
     172        /** 
     173         * Get all rdefs in the Dictionary. 
     174         *  
     175         * @return A Map<String, Rdef> of rdefs 
     176         * @see Rdef 
     177         */ 
     178        public Map/* <String, Rdef> */GetRdefs () 
     179        { 
     180                return rdefs; 
     181        } 
    146182         
    147         /** 
    148          * Get all rdefs in the Dictionary.  
    149          *  
    150          * @return              A Map<String, Rdef> of rdefs 
    151          * @see                 Rdef 
    152          */ 
    153         public Map/*<String, Rdef>*/GetRdefs() { 
    154                 return rdefs; 
     183        public void Accept (IDictionaryVisitor i_visitor) 
     184        { 
     185                i_visitor.PreVisit (this); 
     186                 
     187