com.mapinfo.midev.dp.tab

## Class NativeDataSource

- java.lang.Object
- - com.mapinfo.midev.dp.tab.NativeDataSource

All Implemented Interfaces:
  ICreatableDataSource, IDataSource, IDataSourceSearchable, Iterable

    public final class NativeDataSource
    extends Object
    implements IDataSource, IDataSourceSearchable, ICreatableDataSource

A data source for the MapInfo Native Table.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes the datasource, closing and/or releasing any resources acquired.
`IDataSourceDefinition` `getDefinition()` Returns the definition for the datasource.
`boolean` `isClosed()` Indicates if the datasource has been closed.
`Iterator` `iterator()`
`IDataSourceTable` `openTable(ITableDefinition definition)` Creates an `IDataSourceTable` given the specified `ITableDefinition`.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Methods inherited from interface com.mapinfo.midev.data.ICreatableDataSource

`createTable`

### Method Detail

#### getDefinition

    public IDataSourceDefinition getDefinition()

Description copied from interface: `IDataSource`
Returns the definition for the datasource.

Identifying a datasource typically involves technology-specific or vendor-specific knowledge. For example, a WFS datasource would require the identification of the web service URL whereas an Oracle datasource would require a JDBC connection string. These differences are encapsulated in the data provider-specific implementations of the `IDataSourceDefinition` interface. Datasource definition objects are used by the data provider to instantiate a datasource instance.

Changes to the definition while the datasource is instantiated may or may not alter the behavior of the datasource. If the definition should not be changed while the datasource is open, then attempted changes should throw and exception. This behavior is implementation specific.

Specified by:
  `getDefinition` in interface `IDataSource`
Returns:
  the definition for the datasource.

#### close

    public void close()

Description copied from interface: `IDataSource`
Closes the datasource, closing and/or releasing any resources acquired.

When close is invoked on a datasource, there are a series of events that are involved with the closing process. The first event raised is a datasourceClosingRequest event. This event is cancellable and if a listener cancels the event, then the datasource will not be closed or altered in any way. While a user may wish to close a datasource, he/she may not realize that it is in use or shouldn't be closed. For example, there may be an ITable that is referencing the datasource that cannot be closed for some reason.

If the close request is not cancelled, then a second event would be raised indicating that the datasource will be closing. During that event, the datasource is still open and available for use. After that event is when the actual closing work would be performed. When complete, a third event is raised indicating that the datasource is closed and should no longer be used.

Any tables, metadata browsers, cursors, command processors, or transient features obtained from the datasource or any table dependent on the datasource should be assumed to be invalid and should not be accessed after the datasource is closed. Tables, cursors, command processors, etc should be closed before the datasource is closed so that they can properly clean up and release resources.

After closing a datasource, no properties or methods may be called except for isClosed and close. Implementations must ensure that calls to close do not penalize a user for closing an already closed datasource. Closing a datasource also will result in all event listeners being automatically unregistered. There is no need for a listener to be removed as part of the closing process.

Specified by:
  `close` in interface `IDataSource`

#### isClosed

    public boolean isClosed()

Description copied from interface: `IDataSource`
Indicates if the datasource has been closed. A datasource that has been closed will throw an exception if any property or method is accessed except for `isClosed` and `close`.

Specified by:
  `isClosed` in interface `IDataSource`
Returns:
  `true` if the datasource is closed; `false` otherwise.

#### openTable

    public IDataSourceTable openTable(ITableDefinition definition)

Description copied from interface: `IDataSource`
Creates an `IDataSourceTable` given the specified `ITableDefinition`.

Specified by:
  `openTable` in interface `IDataSource`
Parameters:
  `definition` - the information that defines the `IDataSourceTable` to instantiate.
Returns:
  the new `IDataSourceTable` object that was opened.

#### iterator

    public Iterator iterator()

Specified by:
  `iterator` in interface `Iterable`