attempting to fix a problem with the known_monitors map (by removing it)
This commit is contained in:
		
							parent
							
								
									3752e73c2d
								
							
						
					
					
						commit
						f8f83de56b
					
				@ -666,13 +666,14 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
 | 
			
		||||
      sect = loader.configGetSubSection(root_h,"security");
 | 
			
		||||
 | 
			
		||||
      // Load the security monitors.
 | 
			
		||||
      HashMap known_monitors = new HashMap();
 | 
			
		||||
      NodeList nl = sect.getChildNodes();
 | 
			
		||||
      for (i=0; i<nl.getLength(); i++)
 | 
			
		||||
      { // scan through and find security monitors to initialize
 | 
			
		||||
	Node n = nl.item(i);
 | 
			
		||||
	if ((n.getNodeType()==Node.ELEMENT_NODE) && (n.getNodeName().equals("security-definition")))
 | 
			
		||||
	{ // load one of the initial security definitions
 | 
			
		||||
	  SecurityMonitor sm = new StaticSecurityMonitor((Element)n);
 | 
			
		||||
	  SecurityMonitor sm = new StaticSecurityMonitor((Element)n,known_monitors);
 | 
			
		||||
	  if (sm.getID().equals("Global"))
 | 
			
		||||
	    global_security = sm;
 | 
			
		||||
	  else if (sm.getID().equals("Community"))
 | 
			
		||||
@ -758,6 +759,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
 | 
			
		||||
      // Now done with the sidebox config...
 | 
			
		||||
      // Load the services config file.
 | 
			
		||||
      subdoc = loader.loadConfigDocument(services_config);
 | 
			
		||||
      // TODO: following needs to use the known_monitors mapping
 | 
			
		||||
      scmgr = new ServiceControlManager(subdoc,global_security,community_security);
 | 
			
		||||
 | 
			
		||||
    } // end try
 | 
			
		||||
 | 
			
		||||
@ -82,7 +82,6 @@ public class StaticSecurityMonitor implements SecurityMonitor
 | 
			
		||||
  private static Category logger = Category.getInstance(StaticSecurityMonitor.class);
 | 
			
		||||
 | 
			
		||||
  private static SecurityMonitor root_monitor = null;
 | 
			
		||||
  private static Map known_monitors = Collections.synchronizedMap(new HashMap());
 | 
			
		||||
 | 
			
		||||
  private static int DEFAULT_SCOPE_OFFSET = 3;
 | 
			
		||||
 | 
			
		||||
@ -111,10 +110,12 @@ public class StaticSecurityMonitor implements SecurityMonitor
 | 
			
		||||
   *
 | 
			
		||||
   * @param cfg The root element of the security monitor configuration, which must be a
 | 
			
		||||
   *            <CODE><security-definition/></CODE> element.
 | 
			
		||||
   * @param previous A mapping of all previously-known security monitors.  This one will be added to
 | 
			
		||||
   *                 it on success.
 | 
			
		||||
   * @exception com.silverwrist.venice.except.ConfigException The XML configuration data was incorrect in
 | 
			
		||||
   *            some fashion.
 | 
			
		||||
   */
 | 
			
		||||
  public StaticSecurityMonitor(Element cfg) throws ConfigException
 | 
			
		||||
  public StaticSecurityMonitor(Element cfg, Map previous) throws ConfigException
 | 
			
		||||
  {
 | 
			
		||||
    boolean set_root_monitor = false;
 | 
			
		||||
 | 
			
		||||
@ -138,7 +139,7 @@ public class StaticSecurityMonitor implements SecurityMonitor
 | 
			
		||||
    if (logger.isDebugEnabled())
 | 
			
		||||
      logger.debug("defining new StaticSecurityMonitor with id=" + id);
 | 
			
		||||
 | 
			
		||||
    if (known_monitors.containsKey(id))
 | 
			
		||||
    if (previous.containsKey(id))
 | 
			
		||||
    { // the monitor with this ID has already been defined!
 | 
			
		||||
      logger.fatal("security monitor with id=" + id + " is already defined!");
 | 
			
		||||
      throw new ConfigException("security monitor id=" + id + " is already defined!");
 | 
			
		||||
@ -148,7 +149,7 @@ public class StaticSecurityMonitor implements SecurityMonitor
 | 
			
		||||
    if (root_h.hasAttribute("parent"))
 | 
			
		||||
    { // find our parent
 | 
			
		||||
      String parent_id = cfg.getAttribute("parent");
 | 
			
		||||
      parent = (SecurityMonitor)(known_monitors.get(parent_id));
 | 
			
		||||
      parent = (SecurityMonitor)(previous.get(parent_id));
 | 
			
		||||
      if (parent==null)
 | 
			
		||||
      { // no parent!  that's bogus!
 | 
			
		||||
	logger.fatal("parent security monitor with id=" + parent_id + " does not exist!");
 | 
			
		||||
@ -344,7 +345,7 @@ public class StaticSecurityMonitor implements SecurityMonitor
 | 
			
		||||
      dynamic_permissions = Collections.EMPTY_SET;
 | 
			
		||||
 | 
			
		||||
    // Finish up by adding ourselves to the known monitors list.
 | 
			
		||||
    known_monitors.put(id,this);
 | 
			
		||||
    previous.put(id,this);
 | 
			
		||||
    if (set_root_monitor)
 | 
			
		||||
      root_monitor = this;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user