Sample Code Sample Code: External Client Provider


public class CIMClientProvider implements ExternalClientProvider {
    private static String myType = "com.sun.management.viper.client.ExternalClientList.CIMWBEM";

    public Object getExternalClient(
        String xcType,
        String host,
        String user,
        String credential,
        String role,
        String roleCredential,
        Object[] params) throws Exception {

        if (!xcType.equals(myType))
            throw new VException("Unknown xc type");

        // validate parameter array skipped

        CIMNameSpace ns = (CIMNameSpace)params[0];
        SolarisUserPrincipal up = new SolarisUserPrincipal(user, role);
        SolarisPasswordCredential pc = new SolarisPasswordCredential(
                credential, roleCredential);

        return new CIMClient(ns, up, pc);
    }
}