You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ps...@apache.org on 2004/06/17 02:14:46 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw ApplicationPreferenceModelPanel.java ApplicationPreferenceModel.java

psmith      2004/06/16 17:14:46

  Modified:    src/java/org/apache/log4j/chainsaw
                        ApplicationPreferenceModelPanel.java
                        ApplicationPreferenceModel.java
  Log:
  User is now required to authorise that it's ok to remove the SecurityManager.
  
  Revision  Changes    Path
  1.15      +39 -2     logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
  
  Index: ApplicationPreferenceModelPanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ApplicationPreferenceModelPanel.java	17 May 2004 06:17:59 -0000	1.14
  +++ ApplicationPreferenceModelPanel.java	17 Jun 2004 00:14:46 -0000	1.15
  @@ -35,6 +35,7 @@
   import javax.swing.JComponent;
   import javax.swing.JFrame;
   import javax.swing.JLabel;
  +import javax.swing.JOptionPane;
   import javax.swing.JPanel;
   import javax.swing.JRadioButton;
   import javax.swing.JSlider;
  @@ -362,6 +363,8 @@
         new JSlider(JSlider.HORIZONTAL, 1, 4, 2);
       private final JCheckBox confirmExit = new JCheckBox("Confirm Exit");
       Dictionary sliderLabelMap = new Hashtable();
  +    
  +    private final JCheckBox okToRemoveSecurityManager = new JCheckBox("Ok to remove SecurityManager");
   
       /**
        * @param title
  @@ -384,7 +387,7 @@
         p.add(Box.createHorizontalGlue());
   
         confirmExit.setToolTipText("Is set, you will be prompted to confirm the exit Chainsaw");
  -      
  +      okToRemoveSecurityManager.setToolTipText("You will need to tick this to be able to load Receivers/Plugins that require external dependancies.");
         setupInitialValues();
         setupListeners();
   
  @@ -406,10 +409,15 @@
         Box p3 = new Box(BoxLayout.X_AXIS);
         p3.add(showSplash);
         p3.add(Box.createHorizontalGlue());
  +
  +      Box ok4 = new Box(BoxLayout.X_AXIS);
  +      ok4.add(okToRemoveSecurityManager);
  +      ok4.add(Box.createHorizontalGlue());
         
         add(p2);
         add(p3);
  -
  +      add(ok4);
  +      
         JPanel p4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
   
         p4.add(new JLabel("ToolTip Display (millis)"));
  @@ -486,6 +494,19 @@
             showSplash.setSelected(value);
           }});
         
  +      uncommittedPreferenceModel.addPropertyChangeListener("okToRemoveSecurityManager", new PropertyChangeListener() {
  +
  +		public void propertyChange(PropertyChangeEvent evt) {
  +            boolean newValue = ((Boolean) evt.getNewValue()).booleanValue();
  +            if(newValue) {
  +            okToRemoveSecurityManager.setSelected(newValue);
  +            }else {
  +                okToRemoveSecurityManager.setSelected(false);
  +            }
  +            
  +		}});
  +      
  +      
         uncommittedPreferenceModel.addPropertyChangeListener(
           "identifierExpression",
           new PropertyChangeListener() {
  @@ -541,6 +562,22 @@
           public void actionPerformed(ActionEvent e) {
             uncommittedPreferenceModel.setShowSplash(showSplash.isSelected());
           }});
  +      
  +      okToRemoveSecurityManager.addActionListener(new ActionListener() {
  +
  +        public void actionPerformed(ActionEvent e) {
  +            
  +          if(okToRemoveSecurityManager.isSelected() && JOptionPane.showConfirmDialog(okToRemoveSecurityManager, "By ticking this option, you are authorizing Chainsaw to remove Java's Security Manager.\n\n" +
  +                    "This is required under Java Web Start so that it can access Jars/classes locally.  Without this, Receivers like JMSReceiver + DBReceiver that require" +
  +                    " specific driver jars will NOT be able to be run.  \n\n" +
  +                    "By ticking this, you are saying that this is ok.", "Please Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
  +          	uncommittedPreferenceModel.setOkToRemoveSecurityManager(true);
  +          }else {
  +            uncommittedPreferenceModel.setOkToRemoveSecurityManager(false);
  +          }
  +                
  +        }});
  +      
         
         responsiveSlider.getModel().addChangeListener(
           new ChangeListener() {
  
  
  
  1.20      +19 -0     logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
  
  Index: ApplicationPreferenceModel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ApplicationPreferenceModel.java	17 May 2004 06:17:59 -0000	1.19
  +++ ApplicationPreferenceModel.java	17 Jun 2004 00:14:46 -0000	1.20
  @@ -54,6 +54,7 @@
        * If not 'empty', this property will be used as the URL to load log4j configuration at startup
        */
       private String configurationURL="";
  +	private boolean okToRemoveSecurityManager;
   
       /**
        * @param listener
  @@ -181,6 +182,7 @@
          setCyclicBufferSize(event.asInt("cyclicBufferSize"));
          setConfigurationURL(event.getSetting("configurationURL"));
          setLastUsedVersion(event.getSetting("lastUsedVersion"));
  +       setOkToRemoveSecurityManager(event.asBoolean("okToRemoveSecurityManager"));
       }
   
       /* (non-Javadoc)
  @@ -201,6 +203,7 @@
           event.saveSetting("cyclicBufferSize", getCyclicBufferSize());
           event.saveSetting("configurationURL", getConfigurationURL());
           event.saveSetting("lastUsedVersion", getLastUsedVersion());
  +        event.saveSetting("okToRemoveSecurityManager", isOkToRemoveSecurityManager());
       }
   
       /**
  @@ -223,6 +226,7 @@
         setCyclicBufferSize(model.getCyclicBufferSize());
         setConfigurationURL(model.getConfigurationURL());
         setLastUsedVersion(model.getLastUsedVersion());
  +      setOkToRemoveSecurityManager(model.isOkToRemoveSecurityManager());
       }
       
       /**
  @@ -388,4 +392,19 @@
           this.lastUsedVersion = lastUsedVersion;
           firePropertyChange("lastUsedVersion", oldValue, this.lastUsedVersion);
       }
  +
  +	/**
  +	 * @return
  +	 */
  +	public final boolean isOkToRemoveSecurityManager() {
  +		return this.okToRemoveSecurityManager;
  +	}
  +	/**
  +	 * @param okToRemoveSecurityManager The okToRemoveSecurityManager to set.
  +	 */
  +	public final void setOkToRemoveSecurityManager(boolean okToRemoveSecurityManager) {
  +		boolean oldValue = this.okToRemoveSecurityManager;
  +        this.okToRemoveSecurityManager = okToRemoveSecurityManager;
  +        firePropertyChange("okToRemoveSecurityManager", oldValue, this.okToRemoveSecurityManager);
  +	}
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org