break;
}
// needed in various states:
XNameAccess xObjectCollection = null;
XColumnsSupplier xSupplyColumns = null;
try
{
// go!
while ((DONE != eState) && (FAILED != eState))
{
switch (eState)
{
case HANDLE_TABLE:
{
// initial state for handling the tables
// get the table objects
final XTablesSupplier xSupplyTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
if (xSupplyTables != null)
{
xObjectCollection = xSupplyTables.getTables();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
eState = RETRIEVE_OBJECT;
}
break;
case HANDLE_QUERY:
{
// initial state for handling the tables
// get the table objects
final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
if (xSupplyQueries != null)
{
xObjectCollection = xSupplyQueries.getQueries();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
eState = RETRIEVE_OBJECT;
}
break;
case RETRIEVE_OBJECT:
// here we should have an object (aka query or table) collection, and are going
// to retrieve the desired object
// next state: default to FAILED
eState = FAILED;
if (xObjectCollection != null && xObjectCollection.hasByName(command))
{
xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xObjectCollection.getByName(command));
// next: go for the columns
eState = RETRIEVE_COLUMNS;
}
break;
case RETRIEVE_COLUMNS:
// next state: default to FAILED
eState = FAILED;
if (xSupplyColumns != null)
{
xFields = xSupplyColumns.getColumns();
// that's it
eState = DONE;
}
break;