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