com.waveset.adapter
Class SQLServerResourceAdapter.SQLServerAccountIterator

java.lang.Object
  extended bycom.waveset.adapter.SQLServerResourceAdapter.SQLServerAccountIterator
All Implemented Interfaces:
AccountIterator
Enclosing class:
SQLServerResourceAdapter

public static class SQLServerResourceAdapter.SQLServerAccountIterator
extends java.lang.Object
implements AccountIterator

The implementation of the AccountIterator returned by getAccountIterator. This implementation iterates over the results of the sp_helplogins procedure, which performs a convenient join over the syslogins and sysusers tables. Sigh, it returns two result sets, the first one has just the logins, and seemingly only those in the master database. Columns are: LoginName, SID, DefDbName, DefLangName, AUser, ARemote The rowcount seems to be the same as the sys * The second result set has what we need to associate the accounts and roles with each login. Columns are: LoginName, DBName, UserName, UserorAlias UserOrAlias is "User" if this represents a user account or "MemberOf" if this is a group membership row. Punting right now and just createing users for each login.


Field Summary
 
Fields inherited from interface com.waveset.adapter.AccountIterator
code_id
 
Constructor Summary
SQLServerResourceAdapter.SQLServerAccountIterator(java.sql.Connection con, SQLServerResourceAdapter adapter)
          Construct the iterator, run the query, and load the first user.
 
Method Summary
 void close()
          Release resources required for the iteration.
 boolean hasNext()
          Return true if there are more users.
 WSUser loadUser()
          Returns the next user object.
 WSUser next()
          Returns the next user object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLServerResourceAdapter.SQLServerAccountIterator

public SQLServerResourceAdapter.SQLServerAccountIterator(java.sql.Connection con,
                                                         SQLServerResourceAdapter adapter)
                                                  throws WavesetException
Construct the iterator, run the query, and load the first user.

If we hit an error, auto-close so the caller doesn't have to worry about it.

Method Detail

close

public void close()
Release resources required for the iteration.

Specified by:
close in interface AccountIterator

hasNext

public boolean hasNext()
                throws WavesetException
Return true if there are more users.

Specified by:
hasNext in interface AccountIterator
Throws:
WavesetException

next

public WSUser next()
            throws java.util.NoSuchElementException
Returns the next user object.

Specified by:
next in interface AccountIterator
Returns:
the next account

Throws:
java.util.NoSuchElementException

loadUser

public WSUser loadUser()
                throws WavesetException
Returns the next user object. We expect to be positioned at the first row for this user in the first result set. Columns are: LoginName, SID, DefDbName, DefLangName, AUser, ARemote

Throws:
WavesetException