Changeset 1953

Show
Ignore:
Timestamp:
02/25/08 14:49:06 (9 months ago)
Author:
jjarrett
Message:

Added Implementation to support removing MLS Levels correctly updating MLS Level setting if the removed one was in use.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/PolicyGenerator.java

    r1878 r1953  
    7171                        buf.append(" }"); 
    7272                } 
     73                 
     74                String mlsLevel = i_resource.getMLSLabel (); 
     75                appendMLSLevel (buf, mlsLevel); 
     76                 
    7377                buf.append(";"); 
    7478                buf.append(newLine); 
     
    113117                        buf.append("}"); 
    114118                } 
     119                 
     120                String mlsLevel = i_domain.getMLSLabel (); 
     121                appendMLSLevel (buf, mlsLevel); 
     122                 
    115123                buf.append(";"); 
    116124                buf.append(newLine); 
     
    123131                StringBuffer buf = new StringBuffer(); 
    124132 
    125                 buf.append("entrypoint " + i_ep.getName() + ";"); 
     133                buf.append("entrypoint "); 
     134                buf.append(i_ep.getName()); 
     135                 
     136                String mlsLevel = i_ep.getMLSLabel (); 
     137                appendMLSLevel (buf, mlsLevel); 
     138                 
     139                buf.append(";"); 
    126140                buf.append(newLine); 
    127141 
     
    393407                return fullResult.toString(); 
    394408        } 
     409         
     410        protected void appendMLSLevel(StringBuffer buf, String mlsLevel) 
     411        { 
     412                if ((null != mlsLevel) && (!mlsLevel.equals (""))) 
     413                { 
     414                        buf.append ("\""); 
     415                        buf.append (mlsLevel); 
     416                        buf.append ("\""); 
     417                } 
     418                 
     419                return; 
     420        } 
    395421} 
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSLevel.java

    r1936 r1953  
    3232 * 
    3333 */ 
    34 public class MLSLevel 
     34public class MLSLevel  
    3535{ 
    3636        private static final String COLOR_ATTRIBUTE_NAME = "color"; 
     
    218218                return retValue; 
    219219        } 
     220         
    220221} 
  • branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSSupport.java

    r1936 r1953  
    2121package com.tresys.framework.compiler.mls; 
    2222 
    23 import java.io.BufferedOutputStream; 
    2423import java.io.File; 
    2524import java.io.FileInputStream; 
     
    2726import java.io.IOException; 
    2827import java.io.InputStream; 
    29 import java.io.OutputStream; 
    3028import java.util.Collection; 
    3129import java.util.Enumeration; 
     
    7977 
    8078        private static final String LEVEL_ELEMENT_NAME = "level"; 
    81  
     79         
     80        private static final String DEFAULT_MLS_SYSTEM_HIGH_RANGE = "mls-systemhigh"; 
     81         
     82        private static final String DEFAULT_MLS_SYSTEM_LOW_RANGE = "mls-systemlow"; 
     83         
     84        private static final String DEFAULT_MLS_HIGH_COLOR_VALUE = "0xff0000"; 
     85         
     86        private static final String DEFAULT_MLS_HIGH_LEVEL_NAME = "mls-high"; 
     87         
     88        private static final String DEFAULT_MLS_LOW_COLOR_VALUE = "0xffffff"; 
     89         
     90        private static final String DEFAULT_MLS_LOW_LEVEL_NAME = "mls-low"; 
     91         
     92        private static MLSSupport _LEVELS = null; 
     93         
     94        public static MLSSupport getInstance() 
     95        { 
     96                return _LEVELS; 
     97        } 
     98         
    8299        // The file  
    83100        private File _file = null; 
     
    85102        // Internal representation of the MLS configuration as defined. 
    86103        private Hashtable _levels = new Hashtable(); 
     104         
     105        private MLSLevel _defaultLevel = null; 
    87106 
    88107        /** 
     
    100119                { 
    101120                        initialize (f); 
     121                        if (null == MLSSupport._LEVELS) 
     122                        { 
     123                                MLSSupport._LEVELS = this; 
     124                        } 
    102125                } 
    103126                catch (ParserConfigurationException pce) 
     
    125148        { 
    126149                _file = new File(fileName); 
     150                 
     151                MLSLevel mls = new MLSLevel(DEFAULT_MLS_LOW_LEVEL_NAME); 
     152                mls.setColor (DEFAULT_MLS_LOW_COLOR_VALUE); 
     153                mls.setRange (DEFAULT_MLS_SYSTEM_LOW_RANGE); 
     154                mls.setOrder (this.size ());             
     155                this.add (mls); 
     156                 
     157                mls = new MLSLevel(DEFAULT_MLS_HIGH_LEVEL_NAME); 
     158                mls.setColor (DEFAULT_MLS_HIGH_COLOR_VALUE); 
     159                mls.setRange (DEFAULT_MLS_SYSTEM_HIGH_RANGE); 
     160                mls.setOrder (this.size ());             
     161                this.add (mls); 
     162                 
     163                if (null == MLSSupport._LEVELS) 
     164                { 
     165                        MLSSupport._LEVELS = this; 
     166                }                
    127167        } 
    128168         
     
    425465         * @param o                                             - The object to be identified. 
    426466         * @return                                              - True if the object is defined within the configuration; otherwise false. 
    427          * @throws ClassCastException   - Thrown if object is not of type MLSLevel 
     467         * @throws ClassCastException   - Thrown if object is not of type MLSLevel or String 
    428468         *  
    429469         */ 
    430470        public boolean contains(Object o) 
    431471        { 
    432                 if (!(o instanceof MLSLevel)) 
     472                if ((!(o instanceof MLSLevel)) && (!(o instanceof String))) 
    433473                { 
    434474                        throw new ClassCastException("Can not add non-MLSLevel Objects to collection."); 
    435475                } 
    436476                 
    437                 return (_levels.containsValue (o)); 
     477                return ((_levels.containsValue (o)) || (_levels.containsKey (o))); 
    438478        } 
    439479         
     
    657697                return; 
    658698        } 
     699         
     700        /** 
     701         * orderOf 
     702         *  
     703         * Determines the ordering of the MLS by name 
     704         *  
     705         * @param name  - The name of the MLS Level whose ordering is requested 
     706         * @return              - The ordering of the identified MLS Level 
     707         */ 
     708        public int orderOf(String name) 
     709        { 
     710                int retValue = -1; 
     711                 
     712                if (contains(name)) 
     713                { 
     714                        MLSLevel mls = getLevel (name); 
     715                        retValue = mls.getOrder (); 
     716                } 
     717                return retValue;  
     718        } 
     719         
     720        /** 
     721         * getLevelOrderedAt 
     722         *  
     723         * Determines the MLS Level given the ordering 
     724         *  
     725         * @param order - The user identified ordering 
     726         * @return              - The identified MLS Level. 
     727         */ 
     728        public MLSLevel getLevelOrderedAt(int order) 
     729        { 
     730                MLSLevel retValue = null; 
     731                Iterator _iter = iterator (); 
     732                 
     733                while(_iter.hasNext ()) 
     734                { 
     735                        retValue = (MLSLevel)_iter.next (); 
     736                         
     737                        if (order == retValue.getOrder ()) 
     738                        { 
     739                                break; 
     740                        } 
     741                } 
     742                 
     743                return retValue; 
     744        } 
     745         
     746        /** 
     747         * getDefaultMLSLevel 
     748         *  
     749         *  Returns the currently defined Default Level 
     750         *   
     751         * @return      - The currently set default Level. 
     752         *  
     753         */ 
     754        public MLSLevel getDefaultMLSLevel() 
     755        { 
     756                return _defaultLevel; 
     757        } 
     758         
     759        /** 
     760         * setDefaultMLSLevel 
     761         *  
     762         * Defines the Default MLS Level 
     763         *  
     764         * @param mls   - The user selected Default Level. 
     765         * 
     766         */ 
     767        public void setDefaultMLSLevel(MLSLevel mls) 
     768        { 
     769                this._defaultLevel = mls; 
     770                 
     771                return; 
     772        } 
    659773} 
    660774 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java

    r1910 r1953  
    5454import com.tresys.framework.plugin.SEFramework_Plugin; 
    5555import com.tresys.framework.plugin.builder.FrameworkBuilder; 
     56import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; 
    5657import com.tresys.framework.plugin.preferences.PreferenceInitializer; 
    5758import com.tresys.framework.plugin.preferences.SEFPreferencePage; 
     
    127128                        m_dictionary = null; 
    128129                } 
     130                 
     131                if (event.getKey ().equals (SEFPreferencePage.MLS_UPDATE))  
     132                { 
     133                        Iterator _iter = getSystems ().iterator (); 
     134                         
     135                        while (_iter.hasNext ()) 
     136                        { 
     137                                SELinuxSystem sels = (SELinuxSystem)_iter.next (); 
     138                                 
     139                                sels.mlsDefinitionChanged (event); 
     140                        } 
     141                } 
     142                 
     143                if (event.getKey ().equals (SEFPreferencePage.DEFAULT_MLS_LEVEL)) 
     144                { 
     145                        Iterator _iter = getSystems ().iterator (); 
     146                         
     147                        while (_iter.hasNext ()) 
     148                        { 
     149                                SELinuxSystem sels = (SELinuxSystem)_iter.next (); 
     150                                 
     151                                sels.mlsDefaultChanged (event); 
     152                        } 
     153                } 
     154                 
     155                return; 
    129156        } 
    130157         
     
    148175                        catch (IOException e) 
    149176                        {} 
    150                 } 
     177                }               
    151178        } 
    152179         
     
    243270                 
    244271                resetSupportFiles (); 
     272                 
     273                try 
     274                { 
     275                        this.getMLSSupport (); 
     276                } 
     277                catch (MLSInitializationException mie) 
     278                { 
     279                         
     280                } 
     281                 
     282                return; 
    245283        } 
    246284 
     
    566604                if (null == _mlsConfiguration) 
    567605                { 
    568                         IFile mlsConfigurationFile = this.getSupportFolder ().getFile (MLS_CONFIGURATION_FILE); 
    569                         _mlsConfiguration = new MLSSupport(mlsConfigurationFile.getLocation ().toFile ()); 
     606                        _mlsConfiguration = MLSSupport.getInstance (); 
     607                         
     608                        if (null == _mlsConfiguration) 
     609                        { 
     610                                IFile mlsConfigurationFile = this.getSupportFolder ().getFile (MLS_CONFIGURATION_FILE); 
     611                                _mlsConfiguration = new MLSSupport(mlsConfigurationFile.getLocation ().toFile ()); 
     612                        } 
    570613                } 
    571614                 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java

    r1901 r1953  
    3030import org.eclipse.core.runtime.Path; 
    3131import org.eclipse.core.runtime.PlatformObject; 
     32import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; 
    3233import org.eclipse.jface.resource.ImageDescriptor; 
    3334import org.eclipse.swt.widgets.Display; 
     
    4344import com.tresys.framework.plugin.SEFramework_Plugin; 
    4445import com.tresys.framework.plugin.editor.policy.graphic.GraphicPolicyRefresh; 
     46import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitor; 
     47import com.tresys.framework.plugin.editor.policy.graphic.model.AccessConnection; 
     48import com.tresys.framework.plugin.editor.policy.graphic.model.BaseDomainShape; 
     49import com.tresys.framework.plugin.editor.policy.graphic.model.BaseResourceShape; 
     50import com.tresys.framework.plugin.editor.policy.graphic.model.Connection; 
     51import com.tresys.framework.plugin.editor.policy.graphic.model.ControlResourceShape; 
     52import com.tresys.framework.plugin.editor.policy.graphic.model.DefaultMLSLevelUpdateVisitor; 
     53import com.tresys.framework.plugin.editor.policy.graphic.model.DomainShape; 
     54import com.tresys.framework.plugin.editor.policy.graphic.model.EntryConnection; 
     55import com.tresys.framework.plugin.editor.policy.graphic.model.EntryPointShape; 
    4556import com.tresys.framework.plugin.editor.policy.graphic.model.PolicyDiagram; 
     57import com.tresys.framework.plugin.editor.policy.graphic.model.ResourceShape; 
     58import com.tresys.framework.plugin.editor.policy.graphic.model.UserDomainShape; 
    4659import com.tresys.framework.plugin.preferences.SEFPreferencePage; 
    4760 
     
    691704                } 
    692705        } 
     706         
     707        public void mlsDefinitionChanged(PreferenceChangeEvent event) 
     708        { 
     709                IShapeVisitor isv = new DefaultMLSLevelUpdateVisitor(event); 
     710                this.m_diagram.Accept (isv); 
     711                 
     712                return; 
     713        } 
     714         
     715        public void mlsDefaultChanged(PreferenceChangeEvent event) 
     716        { 
     717                IShapeVisitor isv = new DefaultMLSLevelUpdateVisitor(event); 
     718                this.m_diagram.Accept (isv); 
     719                 
     720                return; 
     721        } 
     722         
     723         
     724//      protected class MLSUpdateVisitor  
     725//              implements IShapeVisitor 
     726//      { 
     727//              public void Visit (DomainShape i_domain) 
     728//              { 
     729//                      i_domain.updateMLS (); 
     730//                       
     731//                      return; 
     732//              } 
     733//               
     734//              public void Visit (BaseDomainShape i_baseDom) 
     735//              { 
     736//                      return; 
     737//              } 
     738//               
     739//              public void Visit (UserDomainShape i_userDom) 
     740//              { 
     741//                      return; 
     742//              } 
     743//               
     744//              public void Visit (ResourceShape i_resource) 
     745//              { 
     746//                      i_resource.updateMLS (); 
     747//                       
     748//                      return; 
     749//              } 
     750//               
     751//              public void Visit (BaseResourceShape i_baseRes) 
     752//              { 
     753//                      return; 
     754//              } 
     755//               
     756//              public void Visit (AccessConnection i_access) 
     757//              { 
     758//                      return; 
     759//              } 
     760//               
     761//              public void Visit (PolicyDiagram i_diagram) 
     762//              { 
     763//                      return; 
     764//              } 
     765//               
     766//              public void Visit (EntryPointShape i_entryPt) 
     767//              { 
     768//                      i_entryPt.updateMLS (); 
     769//                       
     770//                      return; 
     771//              } 
     772//               
     773//              public void Visit (EntryConnection i_enter) 
     774//              { 
     775//                      return; 
     776//              } 
     777//               
     778//              public void Visit (Connection conn) 
     779//              { 
     780//                      return;                  
     781//              } 
     782//               
     783//              public void Visit (ControlResourceShape i_controlResource) 
     784//              { 
     785//                      i_controlResource.updateMLS (); 
     786//                       
     787//                      return; 
     788//              } 
     789//      } 
    693790} 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/PolicyComponentFigure.java

    r1825 r1953  
    1515import org.eclipse.ui.ISharedImages; 
    1616import org.eclipse.ui.PlatformUI; 
    17  
    1817import org.eclipse.draw2d.ColorConstants; 
    1918import org.eclipse.draw2d.Graphics; 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ControlResourceShape.java

    r1825 r1953  
    2626import com.tresys.framework.compiler.dictionary.Dictionary; 
    2727import com.tresys.framework.compiler.dictionary.Rdef; 
     28import com.tresys.framework.compiler.mls.MLSLevel; 
     29import com.tresys.framework.compiler.mls.MLSSupport; 
    2830import com.tresys.framework.compiler.policy.Access; 
    2931import com.tresys.framework.compiler.policy.AccessResource; 
    3032import com.tresys.framework.compiler.policy.Component; 
     33import com.tresys.framework.compiler.policy.ComponentWithDictObjects; 
    3134import com.tresys.framework.compiler.policy.ControlResource; 
    3235import com.tresys.framework.compiler.policy.Domain; 
     
    3740import com.tresys.framework.plugin.builder.SELinuxSystem; 
    3841import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitor; 
     42import com.tresys.framework.plugin.preferences.SEFPreferencePage; 
    3943import com.tresys.framework.plugin.wizards.ControlResourcePropertyWizard; 
    4044 
     
    5357        private String [] m_rdefNames; 
    5458        private int m_nPosition = PositionConstants.NONE; 
     59         
     60        private MLSSupport _levels = null; 
     61        private static final String MLS_LEVEL_PROPERTY_NAME = "MLS Level"; 
     62         
    5563                              
    5664        public ControlResourceShape (SELinuxSystem i_system) 
     
    183191        public IPropertyDescriptor [] getPropertyDescriptors() 
    184192        { 
    185                 final int nStatPropCount = 1
     193                final int nStatPropCount = 2
    186194 
    187195                Policy policy = getPolicy (); 
     
    234242                        myDescriptors[0] = new ComboBoxPropertyDescriptor (RDEF_PROP, Messages.control_resource, m_rdefNames); 
    235243                        myDescriptors[0].setCategory(PROP_SECTION_BASE); 
     244                                                 
     245                        myDescriptors[1] = new PropertyDescriptor(ControlResourceShape.MLS_LEVEL_PROPERTY_NAME,Messages.mls_level); 
     246                        myDescriptors[1].setCategory (PROP_SECTION_BASE); 
    236247                         
    237248                        m_descriptors = new IPropertyDescriptor [parentDescriptors.length + myDescriptors.length];  
     
    259270                } 
    260271                 
     272                if (ControlResourceShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 
     273                {                         
     274                        ComponentWithDictObjects component = (ComponentWithDictObjects) this.m_domain.getComponent ();                   
     275                        return component.getMLSLabel (); 
     276                } 
     277                 
    261278                return super.getPropertyValue(propertyId); 
    262279        } 
     
    278295                        setName (component.getSubName ()); 
    279296                        updateAccess(oldRdef); 
     297                } 
     298                else if (ControlResourceShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 
     299                { 
     300                        ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent(); 
     301                        Integer index = (Integer)value; 
     302                        MLSLevel mls = _levels.getLevelOrderedAt (index.intValue ()); 
     303                         
     304                        component.setMLSLabel (mls.getName ()); 
    280305                } 
    281306                else 
     
    410435                return verbs; 
    411436        } 
     437         
     438//      public void updateMLS() 
     439//      { 
     440//              ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent();  
     441//               
     442//              firePropertyChange(Shape.MLS_PROP, null, component.getMLSLabel ()); 
     443//               
     444//              return; 
     445//      } 
     446//       
     447//      public void updateDefaultMLS() 
     448//      { 
     449//              ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent(); 
     450//               
     451//              firePropertyChange(SEFPreferencePage.DEFAULT_MLS_LEVEL, null, component.getMLSLabel ()); 
     452//               
     453//              return; 
     454//      } 
     455                 
    412456} 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java

    r1936 r1953  
    99package com.tresys.framework.plugin.editor.policy.graphic.model; 
    1010 
     11import java.io.File; 
    1112import java.util.Collection; 
    1213import java.util.Iterator; 
     
    1415import java.util.Vector; 
    1516 
     17import org.eclipse.core.resources.IFile; 
     18import org.eclipse.core.resources.IProject; 
     19import org.eclipse.core.resources.IResource; 
     20import org.eclipse.core.runtime.IPath; 
     21import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; 
    1622import org.eclipse.draw2d.PositionConstants; 
    1723import org.eclipse.draw2d.geometry.Dimension; 
     
    3036import com.tresys.framework.compiler.dictionary.SysResourceState; 
    3137import com.tresys.framework.compiler.linkage.flnkage.Ability; 
     38import com.tresys.framework.compiler.mls.MLSLevel; 
     39import com.tresys.framework.compiler.mls.MLSSupport; 
    3240import com.tresys.framework.compiler.policy.Domain; 
    3341import com.tresys.framework.compiler.policy.EntrypointResource; 
     
    3745import com.tresys.framework.compiler.systemResources.SystemResourceTypes; 
    3846import com.tresys.framework.plugin.FRAMEWORKImageRegistry; 
     47import com.tresys.framework.plugin.builder.FrameworkNature; 
    3948import com.tresys.framework.plugin.builder.SELinuxSystem; 
    4049import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitable; 
     
    4352import com.tresys.framework.plugin.editor.properties.PathPropertyDescriptor; 
    4453import com.tresys.framework.plugin.editor.properties.PathRdefEditContainer; 
     54import com.tresys.framework.plugin.preferences.SEFPreferencePage; 
    4555import com.tresys.framework.plugin.wizards.ShapePropertyWizard; 
    4656 
     
    5363        private IPropertyDescriptor[] m_descriptors; 
    5464         
     65        private MLSSupport _levels = null; 
     66         
    5567        private static final Image DOMAIN_ICON = createImage(FRAMEWORKImageRegistry.DOMAIN_ICON); 
    5668 
     
    6880                Domain dom = new Domain (tok, null, i_system.getPolicy()); 
    6981                 
    70                 setComponent (dom); 
     82                setComponent (dom);             
    7183        } 
    7284         
     
    119131        public IPropertyDescriptor [] getPropertyDescriptors() 
    120132        { 
    121                 if (m_descriptors == null) 
     133                String [] values = null; 
     134                Iterator _iter = null; 
     135                 
     136//              if (m_descriptors == null) 
    122137                { 
    123138                        final int nStatPropCount = 2; 
     
    168183                         
    169184                        // Fetch project to get the current MLS Level configuration definitions 
    170                         String [] values = new String [] { "mls-low", "mls-high"}; 
     185                        this.initializeMLSSupport (); 
     186                         
     187                        values = new String[_levels.size ()]; 
     188                        _iter = _levels.iterator (); 
     189                         
     190                        while (_iter.hasNext ()) 
     191                        { 
     192                                MLSLevel mls = (MLSLevel)_iter.next (); 
     193                                values[mls.getOrder ()] = mls.getName (); 
     194                        } 
     195                         
    171196//                      myDescriptors[1] = new TextPropertyDescriptor(DomainShape.MLS_LEVEL_PROPERTY_NAME, Messages.mls_level); 
    172197                        myDescriptors[1] = new ComboBoxPropertyDescriptor(DomainShape.MLS_LEVEL_PROPERTY_NAME, Messages.mls_level, values); 
    173                         myDescriptors[1].setCategory (PROP_SECTION_BASE); 
    174          
     198                        myDescriptors[1].setCategory (PROP_SECTION_BASE);                
     199                         
     200                         
    175201                        {                
    176202                                Iterator itr = rdefVec.iterator(); 
     
    238264                 
    239265                IPropertyDescriptor [] returnDescriptors = m_descriptors; 
    240                  
     266 
    241267                Domain dom = (Domain) getComponent(); 
    242268                if (dom != null && dom.GetChildren().isEmpty()) 
     
    299325                if (DomainShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 
    300326                { 
    301                         return "mls-low"; 
     327                        Domain dom = (Domain)getComponent (); 
     328                        int index = 0; 
     329                        String name = dom.getMLSLabel (); 
     330                        if (null != name) 
     331                        { 
     332                                index = _levels.orderOf (name); 
     333                                 
     334                                if (-1 == index) 
     335                                { 
     336                                        index = 0; 
     337                                } 
     338                        } 
     339                         
     340                        return new Integer(index); 
    302341                } 
    303342 
     
    328367                        } 
    329368                        else 
     369                        { 
    330370                                dom.ClearRdef ((Rdef) propertyId); 
     371                        } 
    331372                } 
    332373                else if (propertyId instanceof PathRdefEditContainer) 
     
    334375                        ((PathRdefEditContainer) propertyId).setPath((Domain) getComponent(), (String) value); 
    335376                } 
     377                else if (DomainShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 
     378                { 
     379                        Domain dom = (Domain)getComponent (); 
     380                        Integer index = (Integer)value; 
     381                        MLSLevel mls = _levels.getLevelOrderedAt (index.intValue ()); 
     382                         
     383                        String oldName = dom.getMLSLabel (); 
     384                         
     385                        dom.setMLSLabel (mls.getName ()); 
     386                         
     387                        firePropertyChange(Shape.MLS_PROP, oldName, mls.getName ()); 
     388                } 
    336389                else 
     390                { 
    337391                        super.setPropertyValue (propertyId, value); 
     392                } 
     393                 
     394                return; 
    338395        } 
    339396         
     
    361418                return (Domain) getComponent(); 
    362419        } 
     420         
    363421         
    364422        public void setLocation (Point newLocation) 
     
    483541                return m_availableEntrypoints; 
    484542        } 
     543         
     544        protected void initializeMLSSupport() 
     545        { 
     546                // Has Initialization taken place 
     547                if (null == _levels) 
     548                { 
     549                        // Has 'someone' else initialized the MLS Configuration settings  
     550                        _levels = MLSSupport.getInstance (); 
     551                         
     552                        if (null == _levels) 
     553                        { 
     554                                // Prepare to load the MLS Level configuration from the  
     555                                // file system, where it was persisted. 
     556                                IProject ip = ((IResource)this.m_system.getAdapter (IResource.class)).getProject (); 
     557                                FrameworkNature fn = FrameworkNature.getNature (ip); 
     558                                 
     559                                if (null != fn) 
     560                                { 
     561                                        try 
     562                                        { 
     563                                                _levels = fn.getMLSSupport(); 
     564                                        } 
     565                                        catch (Exception e) 
     566                                        { 
     567                                                // Establish a minimal MLS configuration  
     568                                                // if it can't be loaded from the file system. 
     569                                                IFile _if = fn.getSupportFolder ().getFile (FrameworkNature.MLS_CONFIGURATION_FILE); 
     570                                                IPath ipFull = _if.getLocation (); 
     571                                                File file = ipFull.toFile ();   
     572                                                _levels = new MLSSupport(file.getAbsolutePath ()); 
     573                         
     574                                        } 
     575                                } 
     576                        } 
     577                } 
     578 
     579                return; 
     580        } 
     581         
     582//      public void updateMLS() 
     583//      { 
     584//              Domain dom = (Domain)getComponent (); 
     585//               
     586//              firePropertyChange(Shape.MLS_PROP, null, dom.getMLSLabel ()); 
     587//      } 
     588//       
     589//      public void updateDefaultMLS(PreferenceChangeEvent event) 
     590//      { 
     591//              Domain dom = (Domain)getComponent (); 
     592//               
     593//              firePropertyChange(SEFPreferencePage.DEFAULT_MLS_LEVEL, event.getOldValue (), dom.getMLSLabel ()); 
     594//      } 
    485595} 
  • branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/EntryPointShape.java

    r1825