Class SecurityManagerFactory
java.lang.Object
com.sun.enterprise.security.factory.SecurityManagerFactory
- Author:
- monzillo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> void
addManagerToApp
(Map<String, Map<String, T>> iD2sMmap, Map<String, ArrayList<String>> app2iDmap, String ctxId, String name, String appName, T manager) In iD2sMmap, maps manager to ctxId and name, and in app2iDmap, includes ctxID in values mapped to appName.<T> String[]
Get (EJB or Web) Policy context identifiers for app.<T> T
find SecurityManager by policy context identifier and name (as secondary key).<T> ArrayList<T>
Get all SecurityManagers associated with a policy context identifier.<T> ArrayList<T>
getManagersForApp
(Map<String, Map<String, T>> iD2sMmap, Map<String, ArrayList<String>> app2iDmap, String appName, boolean remove) Get (Web or EJB) SecurityManagers associated with an application.
-
Constructor Details
-
SecurityManagerFactory
protected SecurityManagerFactory()
-
-
Method Details
-
getManager
public <T> T getManager(Map<String, Map<String, T>> iD2sMmap, String ctxId, String name, boolean remove) find SecurityManager by policy context identifier and name (as secondary key). There is a separate SecurityManager for each EJB of a module; they all share the same policy context identifier, and are differentiated by (ejb) name. There is one SecurityManager per web module/policy context identifier.- Parameters:
iD2sMmap
- maps policy context id (as key) to subordinate map (as value) of (module) name (as key) to SecurityManagers (as value).ctxId
- the policy context identifier (i.e., the primary key of the lookupname
- the name of the component (e.g., the ejb name when looking up an EJBSecurityManager. for WebSecurityManagers this value should be nullremove
- boolean indicating whether the corresponding SecurityManager is to be deleted from the map.- Returns:
- the selected SecurityManager or null.
-
getManagers
public <T> ArrayList<T> getManagers(Map<String, Map<String, T>> iD2sMmap, String ctxId, boolean remove) Get all SecurityManagers associated with a policy context identifier. EJBs from the same jar, all share the same policy context identifier, but each have their own SecurityManager. WebSecurityManager(s) map 1-to-1 to policy context identifier.- Parameters:
iD2sMmap
- maps policy context id (as key) to subordinate map (as value) of (module) name (as key) to SecurityManagers (as value).ctxId
- the policy context identifier (i.e., the lookup key).remove
- boolean indicating whether the corresponding SecurityManager(s) are to be deleted from the map.- Returns:
- a non-empty ArrayList containing the selected managers, or null.
-
getManagersForApp
public <T> ArrayList<T> getManagersForApp(Map<String, Map<String, T>> iD2sMmap, Map<String, ArrayList<String>> app2iDmap, String appName, boolean remove) Get (Web or EJB) SecurityManagers associated with an application. Note that the WebSecurityManager and EJBSecurityManager classes manage separate maps for their respectibe security manager types.- Parameters:
iD2sMmap
- maps policy context id (as key) to subordinate map (as value) of (module) name (as key) to SecurityManagers (as value).app2iDmap
- maps appName (as key) to list of policy context identifiers (as value).appName
- the application name, (i.e., the lookup key)remove
- boolean indicating whether the corresponding mappings are to be removed from the app2iDmap and aiD2sMmap.- Returns:
- a non-empty ArrayList containing the selected managers, or null.
-
getContextsForApp
public <T> String[] getContextsForApp(Map<String, ArrayList<String>> app2iDmap, String appName, boolean remove) Get (EJB or Web) Policy context identifiers for app.- Parameters:
app2iDmap
- maps appName (as key) to list of policy context identifiers (as value).appName
- the application name, (i.e., the lookup key).remove
- boolean indicating whether the corresponding mappings are to be removed from the app2iDmap.- Returns:
- a non-zero length array containing the selected policy context identifiers, or null.
-
addManagerToApp
public <T> void addManagerToApp(Map<String, Map<String, T>> iD2sMmap, Map<String, ArrayList<String>> app2iDmap, String ctxId, String name, String appName, T manager) In iD2sMmap, maps manager to ctxId and name, and in app2iDmap, includes ctxID in values mapped to appName.- Parameters:
iD2sMmap
- maps policy context id (as key) to subordinate map (as value) of (module) name (as key) to SecurityManagers (as value).app2iDmap
- maps appName (as key) to list of policy context identifiers (as value).ctxId
- the policy context identifiername
- the component name (the EJB name or null for web modules)appName
- the application namemanager
- the SecurityManager
-