Merge branch 'release/4.4.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / 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.datasource.wizard;
12
13 import eu.etaxonomy.cdm.database.CdmDataSource;
14 import eu.etaxonomy.cdm.database.ICdmDataSource;
15
16 /**
17 * <p>CdmDataSourceH2WizardPage class.</p>
18 *
19 * @author n.hoffmann
20 * @created 19.05.2009
21 */
22 public class CdmDataSourceH2WizardPage extends CdmDataSourceCredentialsWizardPage {
23
24 /**
25 * <p>Constructor for CdmDataSourceH2WizardPage.</p>
26 *
27 * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
28 */
29 @Deprecated
30 protected CdmDataSourceH2WizardPage(ICdmDataSource dataSource) {
31 super("H2", dataSource);
32 setTitle("Enter credentials for embedded H2 database");
33 }
34
35 /**
36 * <p>Constructor for CdmDataSourceH2WizardPage.</p>
37 *
38 * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
39 * @param mode a {@link eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard.Mode} enum type.
40 */
41 protected CdmDataSourceH2WizardPage(ICdmDataSource dataSource, CdmDataSourceWizard.Mode mode) {
42 super("H2", dataSource, mode);
43 setTitle("Enter credentials for embedded H2 database");
44 }
45
46 /** {@inheritDoc} */
47 @Override
48 public void createDatabaseForm() {
49 // no more fields needed for embedded H2
50 }
51
52 /** {@inheritDoc} */
53 @Override
54 public void updateLocation() {
55 // nothing to do, no location data provided
56 }
57
58 /** {@inheritDoc} */
59 @Override
60 public void updateDataSource() {
61 ICdmDataSource dataSource = getDataSource();
62
63 if(dataSource == null) {
64 setDataSource(CdmDataSource.NewH2EmbeddedInstance(database,
65 username,
66 password));
67 } else {
68 dataSource.setName(name);
69 dataSource.setDatabase(database);
70 dataSource.setUsername(username);
71 dataSource.setPassword(password);
72 }
73 }
74
75 /** {@inheritDoc} */
76 @Override
77 public void checkPageComplete() {
78 super.checkPageComplete();
79 }
80 }