View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.properties.impl.config.ds.hsql;
17  
18  import de.smartics.properties.spi.config.ds.DataSourceConnector;
19  import de.smartics.properties.spi.config.ds.DataSourceProxy;
20  import de.smartics.properties.spi.config.ds.JndiDataSourceProxy;
21  
22  /**
23   * Connector to be registered to
24   * {@link de.smartics.properties.impl.config.ds.DataSourceProxyManager}.
25   */
26  public final class HSqlDataSourceConnector implements DataSourceConnector
27  {
28    // ********************************* Fields *********************************
29  
30    // --- constants ------------------------------------------------------------
31  
32    // --- members --------------------------------------------------------------
33  
34    // ****************************** Initializer *******************************
35  
36    // ****************************** Constructors ******************************
37  
38    // ****************************** Inner Classes *****************************
39  
40    // ********************************* Methods ********************************
41  
42    // --- init -----------------------------------------------------------------
43  
44    // --- get&set --------------------------------------------------------------
45  
46    // --- business -------------------------------------------------------------
47  
48    @Override
49    public boolean accepts(final String databaseId)
50    {
51      return databaseId.contains("hsql");
52    }
53  
54    @Override
55    public DataSourceProxy create(final JndiDataSourceProxy dataSource)
56    {
57      return new HSqlJndiDataSourceProxy(dataSource);
58    }
59  
60    @Override
61    public DataSourceProxy create(final String connectionUrl,
62        final String userName, final String password)
63    {
64      return HSqlDataSourceProxy.create(connectionUrl, userName, password);
65    }
66  
67    // --- object basics --------------------------------------------------------
68  
69  }