FileDocCategorySizeDatePackage
ManagedSecurityService.javaAPI DocGlassfish v2 API7412Fri May 04 22:33:56 BST 2007com.sun.enterprise.admin.server.core.mbean.config

ManagedSecurityService

public class ManagedSecurityService extends ConfigMBeanBase implements ConfigAttributeName.SecurityService
This Config MBean represents a SecurityService. It extends ConfigMBeanBase class which provides get/set attribute(s) and getMBeanInfo services according to text descriptions. ObjectName of this MBean is: ias: type=security-service, instance-name=

Fields Summary
private static final String[]
MAPLIST
MAPLIST array defines mapping between "external" name and its location in XML relatively base node
private static final String[]
ATTRIBUTES
ATTRIBUTES array specifies attributes descriptions in format defined for MBeanEasyConfig
private static final String[]
OPERATIONS
OPERATIONS array specifies operations descriptions in format defined for MBeanEasyConfig
private static com.sun.enterprise.util.i18n.StringManager
localStrings
Constructors Summary
public ManagedSecurityService()
Default constructor sets MBean description tables

    
                     
       
    
        this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
    
public ManagedSecurityService(String instanceName)
Constructs Config MBean for Security Service Component.

param
instanceName The server instance name.

        this(); //set description tables
        initialize(ObjectNames.kSecurityServiceType, new String[]{instanceName});
    
Methods Summary
public voidcreateAuthRealm(java.lang.String name, java.lang.String classname)
This operation creates AuthRealm according to attributes and adds(links) it to current SecurityService; If attribute is 'null' then default value will be set.

        AuthRealm authRealm = new AuthRealm();
        if(name!=null)
            authRealm.setName(name);
        if(classname!=null)
            authRealm.setClassname(classname);
        SecurityService securityService = (SecurityService)getConfigBeanByXPath( ServerXPathHelper.getSecurityServiceXpath() );
        securityService.addAuthRealm(authRealm);
        
        getConfigContext().flush();
    
public voiddeleteAuthRealm(java.lang.String id)
This operation deletes AuthRealm according to id if it connected to current SecurityService.

throws
ConfigException in case of failure.

        SecurityService securityService = (SecurityService)getConfigBeanByXPath( ServerXPathHelper.getSecurityServiceXpath() );
        AuthRealm authRealm = securityService.getAuthRealmByName(id);
		if(((String) getAttribute(kDefaultRealm)).equals(id)){
			String msg = localStrings.getString( "admin.server.core.mbean.config.default_realm_cannot_delete", id );
		  throw new ConfigException( msg );
		}
  
        if(authRealm!=null)
            securityService.removeAuthRealm(authRealm);
        getConfigContext().flush();
    
public java.lang.String[]listAuthRealms()
This operation returns list of AuthRealm's ids connected to current SecurityService.

        SecurityService securityService = (SecurityService)getConfigBeanByXPath( ServerXPathHelper.getSecurityServiceXpath() );
        AuthRealm[]     authRealms  = securityService.getAuthRealm();
        String[]        res        = new String[authRealms.length];
        for(int i=0; i<authRealms.length; i++)
        {
            res[i] = authRealms[i].getName();
        }
        return res;