Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean acceptsURL(String url) throws SQLException {
- if (!App.checkForExistence(url)) {
- throw new SQLException();
- } else if (url.equals("jdbc:xmldb://localhost")) {
- return true;
- } else if (url.equals("jdbc:altdb://localhost")) {
- return true;
- } else {
- return false;
- }
- }
- @Override
- public Connection connect(String url, Properties info) throws SQLException {
- try {
- if (!acceptsURL(url)) {
- return null;
- }
- } catch (SQLException e) {
- throw new SQLException();
- }
- String username = info.getProperty("username", null);
- String password = info.getProperty("password", null);
- try {
- if (!canLogIn(username, password)) {
- // return null;
- }
- } catch (Exception e) {
- }
- File appDir = (File) info.get("path");
- try {
- String writerType = url.substring(url.indexOf(':') + 1, url.lastIndexOf(':'));
- if (appDir.exists()) {
- return new eg.edu.alexu.csd.oop.DBMS.plugins.jdbc.Connection(appDir.getPath(),
- BackEndWriterFactory.getBackEndWriter(writerType));
- }
- appDir.mkdirs();
- return new eg.edu.alexu.csd.oop.DBMS.plugins.jdbc.Connection(appDir.getPath(),
- BackEndWriterFactory.getBackEndWriter(writerType));
- } catch (Exception e) {
- throw new SQLException();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement