code style improvements.
[utils] / test / enterprise / src / main / java / org / wamblee / support / persistence / DatabaseProvider.java
1 /*
2  * Copyright 2005-2010 the original author or authors.
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 org.wamblee.support.persistence;
17
18 /**
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.
22  * 
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.
26  */
27 public interface DatabaseProvider {
28
29     /**
30      * Capability that all databases that run inmemory have.
31      */
32     String CAPABILITY_IN_MEMORY = "INMEMORY";
33
34     /**
35      * Capability that all databases that are external have.
36      */
37     String CAPABILITY_EXTERNAL = "EXTERNAL";
38
39     /**
40      * Determines if the database has all capabilities that are requested.
41      * 
42      * @param aCapabilities
43      *            Capabilities it must ahve
44      * @return True if it has all capabilities.
45      */
46     boolean supportsCapabilities(String[] aCapabilities);
47
48     /**
49      * Gets the description for the database.
50      * 
51      * @return Description.
52      */
53     DatabaseDescription getDescription();
54
55     /**
56      * Creates a database instance that represents a running instance of that
57      * database.
58      * 
59      * @return Database.
60      */
61     Database create();
62 }