Skip to main content
summaryrefslogtreecommitdiffstats
blob: b3dff3915fbae789b60ec95f40f311b6aad876e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*******************************************************************************
 * Copyright (c) 2009 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.db.internal.vendor;

import java.util.List;

import org.eclipse.datatools.modelbase.sql.schema.Catalog;
import org.eclipse.datatools.modelbase.sql.schema.Database;
import org.eclipse.datatools.modelbase.sql.schema.Schema;

/**
 * Delegate vendor-specific behavior to implementations of this interface:<ul>
 *   <li>catalog support
 *   <li>default catalog and schema
 *   <li>converting names to identifiers and vice-versa
 * </ul>
 * <strong>NB:</strong><br>
 * We use "name" when dealing with the unmodified name of a database object
 * as supplied by the database itself (i.e. it is not delimited and it is always
 * case-sensitive).
 * <br>
 * We use "identifier" when dealing with a string representation of a database
 * object name (i.e. it may be delimited and, depending on the vendor, it may
 * be case-insensitive).
 */
public interface Vendor {

	/**
	 * This must match the DTP vendor name.
	 * @see org.eclipse.datatools.modelbase.sql.schema.Database#getVendor()
	 */
	String getDTPVendorName();

	/**
	 * Return whether the vendor supports "real" catalogs (e.g. Sybase).
	 */
	boolean supportsCatalogs(Database database);

	/**
	 * Return the specified database's catalogs.
	 */
	List<Catalog> getCatalogs(Database database);

	/**
	 * Return the specified database's default catalog identifiers for the
	 * specified user.
	 */
	List<String> getDefaultCatalogIdentifiers(Database database, String userName);

	/**
	 * Return the specified database's schemas.
	 */
	List<Schema> getSchemas(Database database);

	/**
	 * Return the specified database's default schema identifiers for the
	 * specified user.
	 */
	List<String> getDefaultSchemaIdentifiers(Database database, String userName);

	/**
	 * Convert the specified database object name to a vendor identifier.
	 * Return <code>null</code> if the identifier matches the specified default name.
	 */
	String convertNameToIdentifier(String name, String defaultName);

	/**
	 * Convert the specified database object name to a vendor identifier.
	 */
	String convertNameToIdentifier(String name);

	/**
	 * Convert the specified database object identifier to a vendor name.
	 */
	String convertIdentifierToName(String identifier);

}

Back to the top