FileDocCategorySizeDatePackage
AuthRealmSupport.javaAPI DocGlassfish v2 API5259Fri May 04 22:23:40 BST 2007com.sun.enterprise.management.offline

AuthRealmSupport

public final class AuthRealmSupport extends Object
Support for working with our default file realm.

Fields Summary
private final AuthRealmMBeanX
mAuthRealmMBean
private final AuthRealmConfigBeanHelper
mHelper
public final String
PREFIX
Constructors Summary
public AuthRealmSupport(AuthRealmConfigBeanHelper helper)

        
        
         
    
        mHelper = helper;
        
        String  file    = helper.getFile();
        
        if ( file.startsWith( PREFIX ) )
        {
            throw new IllegalArgumentException(
                "AuthRealm does not yet support ${...} values for the filename" );
        }
        
        mAuthRealmMBean = new AuthRealmMBeanX( file );
    
Methods Summary
public voidaddUser(java.lang.String user, java.lang.String password, java.lang.String[] groupList)

        try
        {
            mAuthRealmMBean.addUser( user, password, groupList );
        }
        catch( MBeanConfigException e )
        {
            throw new RuntimeException( "" + e );
        }
    
public java.lang.String[]getGroupNames()

        try
        {
            return mAuthRealmMBean.getGroupNames();
        }
        catch( MBeanConfigException e )
        {
            throw new RuntimeException( "" + e );
        }
    
private java.lang.StringgetRealmName()

	    try
	    {
	        return (String)mHelper.getAttribute( "Name" );
	    }
	    catch( Exception e )
	    {
	        return null;
	    }
	
public java.lang.String[]getUserGroupNames(java.lang.String user)

        try
        {
            return mAuthRealmMBean.getUserGroupNames( user );
        }
        catch( MBeanConfigException e )
        {
            throw new RuntimeException( "" + e );
        }
    
public java.lang.String[]getUserNames()

        //sdebug( "AuthRealmSupport.getUserNames(): " + getRealmName() );
        
        try
        {
            final String[]  userNames   = mAuthRealmMBean.getUserNames();
            
            //sdebug( "AuthRealmSupport.getUserNames(): " + 
                //getRealmName() + ": " + StringUtil.toString( userNames ) );
            return userNames;
        }
        catch( MBeanConfigException e )
        {
            //sdebug( e.getMessage() );
            //e.printStackTrace();
            throw new RuntimeException( "" + e );
        }
    
public voidremoveUser(java.lang.String user)

        try
        {
            mAuthRealmMBean.removeUser( user );
        }
        catch( MBeanConfigException e )
        {
            throw new RuntimeException( "" + e );
        }
    
protected voidsdebug(java.lang.Object o)

	    System.out.println( "" + o );
	
public voidupdateUser(java.lang.String user, java.lang.String password, java.lang.String[] groupList)

        try
        {
            mAuthRealmMBean.updateUser( user, password, groupList );
        }
        catch( MBeanConfigException e )
        {
            throw new RuntimeException( "" + e );
        }