venice-main-classic/src/com/silverwrist/venice/svc/SecurityMonitorEnvironment.java
Eric J. Bowersox 48266c4f73 moved security monitor initialization from VeniceEngineImpl down to
GlobalSiteImpl, removed env_getSecurityMonitor from envEngine
2002-05-27 04:09:38 +00:00

90 lines
2.6 KiB
Java

/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.svc;
import java.util.*;
import com.silverwrist.venice.security.SecurityMonitor;
public final class SecurityMonitorEnvironment
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private HashMap map = new HashMap();
private SecurityMonitor root = null;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SecurityMonitorEnvironment()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public final boolean isMonitorDefined(String id)
{
return map.containsKey(id);
} // end isMonitorDefined
public final boolean isRootMonitorDefined()
{
return (root!=null);
} // end isRootMonitorDefined
public final SecurityMonitor getMonitor(String id)
{
return (SecurityMonitor)(map.get(id));
} // end getMonitor
public final void storeMonitor(SecurityMonitor sm, boolean set_root)
{
if (map.put(sm.getID(),sm)!=null)
throw new RuntimeException("SecurityMonitorEnvironment: double monitor defininition!");
if (set_root)
{ // set the root monitor as well
if (root==null)
root = sm;
else
throw new RuntimeException("SecurityMonitorEnvironment: double root definition!");
} // end if
} // end storeMonitor
public final void shutdown()
{
map.clear();
map = null;
root = null;
} // end shutdown
} // end class SecurityMonitorEnvironment