|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.dse.tools.workbench.base.DefaultRepository
This class represents a basic shared repository. It has a constructor for connecting to the data source (usually, database) using a repository name, user name and user password
Field Summary | |
protected java.lang.Class |
classDriver
A JDBC driver |
protected java.lang.String |
cnnPwd
The password used for establishing JDBC connection |
protected java.lang.String |
cnnUser
The user name used for establishing JDBC connection |
protected java.sql.Connection |
connection
The JDBC connection |
protected java.lang.String |
DEFAULT_DRIVER
The default JDBC driver |
protected boolean |
modified
Switch indicating if modifications have been done since last commit or rollback |
protected java.lang.String |
password
The application password used for validate in UsersTable |
protected java.util.Hashtable |
tables
The list of tables managed by this repository |
protected java.lang.String |
URLpath
The URL used for establishing JDBC connection |
protected TableRow |
user
The row in UsersTable that represents the user |
protected java.lang.String |
userName
The application user name used for validate in UsersTable |
Fields inherited from interface com.ibm.dse.tools.workbench.base.Repository |
BEGIN_TABLE_TOKEN,
END_TABLE_TOKEN,
EOL |
Constructor Summary | |
protected |
DefaultRepository()
This method constructs a DefaultRepository object |
|
DefaultRepository(java.lang.String URLpath,
java.lang.String user,
java.lang.String password)
This constructor creates a DefaultRepository object, with a given url, user and password. |
Method Summary | |
protected void |
add(AbstractTable table)
This method adds an AbstractTable to the internal list of tables, with it's name as key. |
void |
commit()
This method commits the changes to the database and cleans the data maintained to allow rollback |
void |
connect()
Establish the connection to database and check the application user identification |
java.lang.String[] |
create(java.io.Reader initialDataSetReader)
Creates a repository from an initial data file |
java.lang.String[] |
create(java.lang.String InitialDataSetFileName)
Creates a repository from an initial data file |
protected void |
createTables()
This method creates all the defined tables. |
void |
disconnect()
This method disconnects from the database. |
protected void |
establishSession()
This method creates a connection to the database. |
void |
exportToFile(java.io.Writer w)
Export all the table data to file |
protected boolean |
findUser()
Searches the repository user in the users table to check its identification |
java.lang.String |
getCnnPassword()
This method returns the passsword used for JDBC connection to the repository |
java.lang.String |
getCnnUser()
Returns the user name used for JDBC connection |
java.sql.Connection |
getConnection()
Returns the instance of the JDBC connection |
Table |
getTable(java.lang.String name)
Returns the table that has the specified name. |
Table[] |
getTableList()
Returns the list of tables defined in the repository. |
java.lang.String |
getURLpath()
Returns the url to connect to the repository. |
TableRow |
getUser()
Returns the row in the Users table representing the application user |
java.lang.String |
getUserCode()
Returns the value of the application user code. |
java.lang.String |
getUserName()
Returns the value of the application user name. |
void |
importFromFile(java.io.Reader r)
Imports all the tables data from a file |
boolean |
isModified()
Indicates if modifications have been done since last commit or rollback |
void |
markAsModified()
Marks the repository as modified, so commit or rollback is required |
void |
rollback()
This method undoes the changes made to the rows since the last commit or rollback |
void |
setClassDriver(java.lang.String className)
This method changes the default class driver for the data base connection. |
void |
setConnectData(java.lang.String URLpath,
java.lang.String user,
java.lang.String password)
This method sets the connection data for a DefaultRepository object, with a given url, user and password. |
void |
setUser(java.lang.String userName,
java.lang.String password)
Sets the application user name and password, to be searched at the Users table at connection time |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String cnnUser
protected java.lang.String cnnPwd
protected java.lang.String URLpath
protected java.util.Hashtable tables
protected java.sql.Connection connection
protected TableRow user
protected java.lang.Class classDriver
protected java.lang.String DEFAULT_DRIVER
protected java.lang.String userName
protected java.lang.String password
protected boolean modified
Constructor Detail |
protected DefaultRepository() throws WorkbenchException
public DefaultRepository(java.lang.String URLpath, java.lang.String user, java.lang.String password) throws WorkbenchException
URLpath
- java.lang.Stringuser
- java.lang.Stringpassword
- java.lang.StringMethod Detail |
protected void add(AbstractTable table)
table
- com.ibm.dse.tools.workbench.base.AbstracTablepublic void commit() throws RepositoryException
public void connect() throws RpConnectionException
public java.lang.String[] create(java.io.Reader initialDataSetReader) throws WorkbenchException
initialDataSetReader
- java.io.Reader The reader with the initial data (null if no initial data)public java.lang.String[] create(java.lang.String InitialDataSetFileName) throws WorkbenchException
InitialDataSetFileName
- java.lang.String The name of the file with the initial data (null if no initial data)protected void createTables() throws WorkbenchException
For future extensions, remember create here the new tables.
public void disconnect() throws RpConnectionException
protected void establishSession() throws RpConnectionException
If the driver isn't loaded, then load it.
public void exportToFile(java.io.Writer w) throws WorkbenchException, java.io.IOException
w
- java.io.Writerprotected boolean findUser() throws WorkbenchException
public java.lang.String getCnnPassword()
public java.lang.String getCnnUser()
public java.sql.Connection getConnection()
public Table getTable(java.lang.String name)
public Table[] getTableList()
public java.lang.String getURLpath()
public TableRow getUser()
public java.lang.String getUserCode()
public java.lang.String getUserName()
public void importFromFile(java.io.Reader r) throws WorkbenchException, java.io.IOException
r
- java.io.Readerpublic boolean isModified()
public void markAsModified()
public void rollback() throws RepositoryException
public void setClassDriver(java.lang.String className) throws java.lang.ClassNotFoundException
className
- java.lang.Stringpublic void setConnectData(java.lang.String URLpath, java.lang.String user, java.lang.String password)
URLpath
- java.lang.Stringuser
- java.lang.Stringpassword
- java.lang.Stringpublic void setUser(java.lang.String userName, java.lang.String password)
userName
- java.lang.Stringpassword
- java.lang.String
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |