Merge branch 'release/5.17.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / datasource / wizard / CdmDataSourceH2WizardPage.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.datasource.wizard;
11
12 import eu.etaxonomy.cdm.database.CdmDataSource;
13 import eu.etaxonomy.cdm.database.ICdmDataSource;
14
15 /**
16 * <p>CdmDataSourceH2WizardPage class.</p>
17 *
18 * @author n.hoffmann
19 * @created 19.05.2009
20 */
21 public class CdmDataSourceH2WizardPage extends CdmDataSourceCredentialsWizardPage {
22
23 /**
24 * <p>Constructor for CdmDataSourceH2WizardPage.</p>
25 *
26 * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
27 */
28 @Deprecated
29 protected CdmDataSourceH2WizardPage(ICdmDataSource dataSource) {
30 super("H2", dataSource);
31 setTitle("Enter credentials for embedded H2 database");
32 }
33
34 /**
35 * <p>Constructor for CdmDataSourceH2WizardPage.</p>
36 *
37 * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
38 * @param mode a {@link eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard.Mode} enum type.
39 */
40 protected CdmDataSourceH2WizardPage(ICdmDataSource dataSource, CdmDataSourceWizard.Mode mode) {
41 super("H2", dataSource, mode);
42 setTitle("Enter credentials for embedded H2 database");
43 }
44
45 /** {@inheritDoc} */
46 @Override
47 public void createDatabaseForm() {
48 // no more fields needed for embedded H2
49 }
50
51 /** {@inheritDoc} */
52 @Override
53 public void updateLocation() {
54 // nothing to do, no location data provided
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public void updateDataSource() {
60 ICdmDataSource dataSource = getDataSource();
61
62 if(dataSource == null) {
63 setDataSource(CdmDataSource.NewH2EmbeddedInstance(database,
64 username,
65 password));
66 } else {
67 dataSource.setName(name);
68 dataSource.setDatabase(database);
69 dataSource.setUsername(username);
70 dataSource.setPassword(password);
71 }
72 }
73
74 /** {@inheritDoc} */
75 @Override
76 public void checkPageComplete() {
77 super.checkPageComplete();
78 }
79 }