editor now updatable via updateSite
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / store / datasource / wizard / CdmDataSourceH2WizardPage.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.store.datasource.wizard;
12
13 import org.eclipse.jface.dialogs.MessageDialog;
14
15 import eu.etaxonomy.cdm.database.CdmDataSource;
16 import eu.etaxonomy.cdm.database.ICdmDataSource;
17
18 /**
19 * @author n.hoffmann
20 * @created 19.05.2009
21 * @version 1.0
22 */
23 public class CdmDataSourceH2WizardPage extends CdmDataSourceCredentialsWizardPage {
24
25 /**
26 * @param pageName
27 */
28 protected CdmDataSourceH2WizardPage(ICdmDataSource dataSource) {
29 super("H2");
30 setTitle("Enter credentials for embedded H2 database");
31 this.dataSource = dataSource;
32
33 }
34
35 /* (non-Javadoc)
36 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#createDatabaseForm()
37 */
38 @Override
39 public void createDatabaseForm() {
40 // no more fields needed for embedded H2
41 }
42
43
44 /* (non-Javadoc)
45 * @see eu.etaxonomy.taxeditor.store.datasource.ICdmDataSourceCredentialsWizardPage#testDbConfiguration()
46 */
47 public void testDbConfiguration() {
48 CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance(
49 getWizard().getDatabase(),
50 getWizard().getUsername(),
51 getWizard().getPassword()
52 );
53
54 if (dataSource.testConnection()) {
55 MessageDialog.openConfirm(parent.getShell(), "Test successful", "Test successful");
56 } else {
57 MessageDialog.openWarning(parent.getShell(), "Test unsuccessful", "Test unsuccessful");
58 }
59 }
60
61 /* (non-Javadoc)
62 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#updateLocation()
63 */
64 @Override
65 public void updateLocation() {
66 // nothing to do, no location data provided
67 }
68 }