Expresso 5-6

com.jcorporate.expresso.core.misc
Class SchemaIterator

java.lang.Object
  extended bycom.jcorporate.expresso.core.misc.SchemaIterator
All Implemented Interfaces:
Iterator

public class SchemaIterator
extends Object
implements Iterator

This class is constructed and used to iterate over top level schemas. It can be used instead of iterating over the previous SchemaList table. This iterator currently only iterates over top level Schemas, not schemas nested within other schemas.

Example Usage:
  for (SchemaIterator it = new SchemaIterator("default","default"); it.hasNext();) {
     Schema oneSchema = (Schema)it.next();
     System.out.println("Schema Description: " + oneSchema.getDefaultDescription());
  }

Since:
Expresso 5.1
Author:
Michael Rimov
See Also:
DataContextIterator

Constructor Summary
SchemaIterator()
          Default constructor that creates a schema for default data context, default runtime.
SchemaIterator(DataContext iteratingContext)
          Constructor that iterates over all schemas inside a context.
SchemaIterator(String runtime, String contextName)
          Constructor that specifies the Expresso Runtime as well as the data context name to iterate.
 
Method Summary
 boolean hasNext()
          Checks if another object exists.
 Object next()
          Retrieve the Next Schema in the sequence.
 Schema nextContext()
          Retrieve the Next Schema in the sequence.
 void remove()
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaIterator

public SchemaIterator()
Default constructor that creates a schema for default data context, default runtime.

Throws:
IllegalStateException - if no runtime exists or if there is no default data context in the system. or if the component named 'default' is not a DataContext.

SchemaIterator

public SchemaIterator(String runtime,
                      String contextName)
Constructor that specifies the Expresso Runtime as well as the data context name to iterate.

Parameters:
runtime - the name of the runtime ('default' for typical usage)
contextName - the name of the data context to iterate ('default' for example)

SchemaIterator

public SchemaIterator(DataContext iteratingContext)
Constructor that iterates over all schemas inside a context. Since there are unique instances of contexts, the Runtime is implied with the context.

Parameters:
iteratingContext - the DataContext instance to iterate.
Method Detail

hasNext

public boolean hasNext()
Checks if another object exists.

Specified by:
hasNext in interface Iterator
Returns:
true if there is another data context to iterate.
See Also:
Iterator.hasNext()

next

public Object next()
Retrieve the Next Schema in the sequence.

Specified by:
next in interface Iterator
Returns:
an Object that is of type com.jcorporate.expresso.core.dbobj.Schema
Throws:
ArrayIndexOutOfBoundsException - if we iterate past the end.

nextContext

public Schema nextContext()
Retrieve the Next Schema in the sequence. The only difference between this and next() is that this function doesn't require a downcast.

Returns:
an Object that is of type com.jcorporate.expresso.core.dbobj.Schema
Throws:
ArrayIndexOutOfBoundsException - if we iterate past the end.

remove

public void remove()
Not implemented. Do not use.

Specified by:
remove in interface Iterator

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.