FileDocCategorySizeDatePackage
LoginInfoStoreFactory.javaAPI DocGlassfish v2 API4175Fri May 04 22:30:32 BST 2007com.sun.appserv.management.client.prefs

LoginInfoStoreFactory

public class LoginInfoStoreFactory extends Object
A factory class to create instances of LoginInfoStore.
since
Appserver 9.0

Fields Summary
Constructors Summary
private LoginInfoStoreFactory()
Private constructor.

    
Methods Summary
private static LoginInfoStoregetCustomStore(java.lang.String icn)

        final Class ic  = Class.forName(icn);
        final String in = LoginInfoStore.class.getName();
        if (ic == null || !isStore(ic))
            throw new IllegalArgumentException("Class: " + ic.getName() + " does not implement: " + in);
        final LoginInfoStore store = (LoginInfoStore) ic.newInstance();
        return ( store );
    
private static LoginInfoStoregetDefaultStore()

        return ( new MemoryHashLoginInfoStore() );
    
public static LoginInfoStoregetStore(java.lang.String storeImplClassName)
Returns the store that is represented by given class name. The parameter must implement the {@link LoginInfoStore} interface. If a null is passed, an instance of the default store {@link MemoryHashLoginInfoStore} is returned.

param
storeImplClassName fully qualified name of the class implementing LoginInfoStore. May be null.
return
the instance of LoginInfoStore of your choice
throws
IllegalArgumentException if the parameter does not implement LoginInfoStore
throws
StoreException if the construction of default store results in problems
throws
ClassNotFoundException if the given class could not be loaded

        LoginInfoStore store = null;
        if (storeImplClassName == null)
            store = getDefaultStore();
        else 
            store = getCustomStore(storeImplClassName);
        return ( store );
    
private static booleanisStore(java.lang.Class c)

        final Class[] ifs = c.getInterfaces();
        final Class sc    = LoginInfoStore.class;
        return ( Arrays.asList(ifs).contains(sc) );