2 * Copyright 2005-2010 the original author or authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.wamblee.support.persistence;
19 * Database provider. This database provider represents a particular type of
20 * database such as its capabilities and the ability to create an instance
21 * representing a running database.
23 * Since the {@link DatabaseBuilder} uses a first match algorithm and the order
24 * of databaseproviders is not guaranteed, it is recommended for each database
25 * provider to also provide a unique capability that no other database has.
27 public interface DatabaseProvider {
30 * Capability that all databases that run inmemory have.
32 String CAPABILITY_IN_MEMORY = "INMEMORY";
35 * Capability that all databases that are external have.
37 String CAPABILITY_EXTERNAL = "EXTERNAL";
40 * Determines if the database has all capabilities that are requested.
42 * @param aCapabilities
43 * Capabilities it must ahve
44 * @return True if it has all capabilities.
46 boolean supportsCapabilities(String[] aCapabilities);
49 * Gets the description for the database.
51 * @return Description.
53 DatabaseDescription getDescription();
56 * Creates a database instance that represents a running instance of that