|
org.netbeans.modules.db/0 1.20.0 4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.db.explorer.ConnectionManager
public final class ConnectionManager
Provides access to the list of connections in the Database Explorer.
The list of connections can be retrieved using the getConnections()
method. A connection can be also retrieved by name using the
getConnection(java.lang.String)
method.
New connections can be added to the Connection Manager using the
addConnection(org.netbeans.api.db.explorer.DatabaseConnection)
method (new connections can be created using the
DatabaseConnection.create(org.netbeans.api.db.explorer.JDBCDriver, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
method.
It is also possible to display the New Database Connection dialog to let the
user create a new database connection using the showAddConnectionDialog(org.netbeans.api.db.explorer.JDBCDriver)
.
Connections can be realized using the showConnectionDialog(org.netbeans.api.db.explorer.DatabaseConnection)
method.
Clients can be informed of changes to the ConnectionManager by registering
a ConnectionListener
using the addConnectionListener(org.netbeans.api.db.explorer.ConnectionListener)
method.
DatabaseConnection
Constructor Summary | |
---|---|
ConnectionManager()
|
Method Summary | |
---|---|
void |
addConnection(DatabaseConnection dbconn)
Adds a new connection to Database Explorer. |
void |
addConnectionListener(ConnectionListener listener)
Registers a ConnectionListener. |
void |
disconnect(DatabaseConnection dbconn)
Disconnects this connection from the database. |
DatabaseConnection |
getConnection(String name)
Returns the connection with the specified name. |
DatabaseConnection[] |
getConnections()
Returns the list of connections in the Database Explorer. |
static ConnectionManager |
getDefault()
Gets the ConnectionManager singleton instance. |
void |
removeConnectionListener(ConnectionListener listener)
Unregisters the specified connection listener. |
void |
selectConnectionInExplorer(DatabaseConnection dbconn)
Selects the node corresponding to the specified connection in the Runtime tab. |
void |
showAddConnectionDialog(JDBCDriver driver)
Shows the dialog for adding a new connection. |
void |
showAddConnectionDialog(JDBCDriver driver,
String databaseUrl)
Shows the dialog for adding a new connection with the specified database URL. |
void |
showAddConnectionDialog(JDBCDriver driver,
String databaseUrl,
String user,
String password)
Shows the dialog for adding a new connection with the specified database URL, user and password The specified driver be filled as the single element of the Driver combo box of the New Database Connection dialog box. |
DatabaseConnection |
showAddConnectionDialogFromEventThread(JDBCDriver driver)
The counterpart of showAddConnectionDialog(JDBCDriver) which returns
the newly created database connection, but must be called from the event dispatching
thread. |
DatabaseConnection |
showAddConnectionDialogFromEventThread(JDBCDriver driver,
String databaseUrl)
The counterpart of showAddConnectionDialog(JDBCDriver, String) which returns
the newly created database connection, but must be called from the event dispatching
thread. |
DatabaseConnection |
showAddConnectionDialogFromEventThread(JDBCDriver driver,
String databaseUrl,
String user,
String password)
The counterpart of showAddConnectionDialog(JDBCDriver, String, String, String)
which returns the newly created database connection, but must be called
from the event dispatching thread. |
void |
showConnectionDialog(DatabaseConnection dbconn)
Shows the Connect dialog for the specified connection if not all data needed to connect, such as the user name or password, are known), or displays a modal progress dialog and attempts to connect to the database immediately. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionManager()
Method Detail |
---|
public static ConnectionManager getDefault()
public DatabaseConnection[] getConnections()
public DatabaseConnection getConnection(String name)
name
- the connection name
NullPointerException
- if the specified database name is null.public void addConnection(DatabaseConnection dbconn) throws DatabaseException
dbconn
- the connection to be added; must not be null.
NullPointerException
- if dbconn is null.
DatabaseException
- if an error occurs while adding the connection.public void showAddConnectionDialog(JDBCDriver driver)
driver
- the JDBC driver; can be null.public void showAddConnectionDialog(JDBCDriver driver, String databaseUrl)
driver
- the JDBC driver; can be null.databaseUrl
- the database URL; can be null.public void showAddConnectionDialog(JDBCDriver driver, String databaseUrl, String user, String password)
driver
- the JDBC driver; can be null.databaseUrl
- the database URL; can be null.user
- the database user; can be null.password
- user's password; can be null.public DatabaseConnection showAddConnectionDialogFromEventThread(JDBCDriver driver)
showAddConnectionDialog(JDBCDriver)
which returns
the newly created database connection, but must be called from the event dispatching
thread.
driver
- the JDBC driver; can be null.
IllegalStateException
- if the calling thread is not the event
dispatching thread.public DatabaseConnection showAddConnectionDialogFromEventThread(JDBCDriver driver, String databaseUrl)
showAddConnectionDialog(JDBCDriver, String)
which returns
the newly created database connection, but must be called from the event dispatching
thread.
driver
- the JDBC driver; can be null.databaseUrl
- the database URL; can be null.
IllegalStateException
- if the calling thread is not the event
dispatching thread.public DatabaseConnection showAddConnectionDialogFromEventThread(JDBCDriver driver, String databaseUrl, String user, String password)
showAddConnectionDialog(JDBCDriver, String, String, String)
which returns the newly created database connection, but must be called
from the event dispatching thread.
driver
- the JDBC driver; can be null.databaseUrl
- the database URL; can be null.user
- the database user; can be null.password
- user's password; can be null.
IllegalStateException
- if the calling thread is not the event
dispatching thread.public void showConnectionDialog(DatabaseConnection dbconn)
dbconn
- the database connection to be connected
NullPointerException
- if the dbconn parameter is null
IllegalStateException
- if this connection is not added to the
ConnectionManager.public void disconnect(DatabaseConnection dbconn)
dbconn
- the database connection to be connected
NullPointerException
- if the dbconn parameter is null
IllegalStateException
- if this connection is not added to the
ConnectionManager.public void selectConnectionInExplorer(DatabaseConnection dbconn)
dbconn
- the connection to select
NullPointerException
- if the dbconn parameter is null
IllegalStateException
- if this connection is not added to the
ConnectionManager.public void addConnectionListener(ConnectionListener listener)
public void removeConnectionListener(ConnectionListener listener)
|
org.netbeans.modules.db/0 1.20.0 4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |