Top Fields Constructors Methods
org.eclipse.persistence.internal.helper

public Class DBPlatformHelper

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, java.util.ArrayList, .Iterator, .List, java.util.regex.Pattern, .PatternSyntaxException, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.logging.SessionLog

Author
Mitesh Meswani This class is responsible to translate given database name to a DatabasePlatform.

Field Summary

Modifier and TypeField and Description
private static List<String[]>
_nameToVendorPlatform

Holds mapping between possible vendor names to internal platforms defined above.

private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

Database platform that corresponds to vendorName. If vendorName does not match any of predefined vendor names, DEFAULTPLATFORM is returned.
getDBPlatform
(String
Input vendor name. Typically this is obtained by querying DatabaseMetaData.
vendorName
,
String minorVersion, String majorVersion, SessionLog
The logger.
logger
)

Get Database Platform from vendor name.

private static List<String[]>
initializeNameToVendorPlatform(SessionLog logger)

Allocate and initialize nameToVendorPlatform if not already done.

private static void
load(List<String[]>
Properties object to load
properties
,
final String
Name of resource. If loadFromFile is true, this is fully qualified path name to a file. param classLoader is ignored. If loadFromFile is false,this is resource name.
resourceName
)

Loads properties list from the specified resource into specified Properties object.

private static void
loadFromResource(List<String[]> properties, String resourceName)

private static boolean

Returns:

false if there is error compiling regExp or target does not match regExp. true if regExp matches pattern.
matchPattern
(String
The regular expression.
regExp
,
String
The target against which we are trying to match regExp.
target
,
SessionLog logger)

Matches target to pattern specified regExp.

private static String
matchVendorNameInProperties(String vendorName, List<String[]> nameToVendorPlatform, SessionLog logger)

Match vendorName in properties specified by _nameToVendorPlatform.

private static InputStream
openResourceInputStream(final String resourceName)

Open resourceName as input stream inside doPriviledged block

private static String[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_nameToVendorPlatformback to summary
private static List<String[]> _nameToVendorPlatform

Holds mapping between possible vendor names to internal platforms defined above. vendor names are treated as regular expressions.

DEFAULTPLATFORMback to summary
private static final String DEFAULTPLATFORM
PROPERTY_PATHback to summary
private static final String PROPERTY_PATH
VENDOR_NAME_TO_PLATFORM_RESOURCE_NAMEback to summary
private static final String VENDOR_NAME_TO_PLATFORM_RESOURCE_NAME

Constructor Detail

DBPlatformHelperback to summary
public DBPlatformHelper()

Method Detail

getDBPlatformback to summary
public static String getDBPlatform(String vendorName, String minorVersion, String majorVersion, SessionLog logger)

Get Database Platform from vendor name.

Parameters
vendorName:String

Input vendor name. Typically this is obtained by querying DatabaseMetaData.

logger:SessionLog

The logger.

Returns:String

Database platform that corresponds to vendorName. If vendorName does not match any of predefined vendor names, DEFAULTPLATFORM is returned.

initializeNameToVendorPlatformback to summary
private static List<String[]> initializeNameToVendorPlatform(SessionLog logger)

Allocate and initialize nameToVendorPlatform if not already done.

loadback to summary
private static void load(List<String[]> properties, final String resourceName) throws IOException

Loads properties list from the specified resource into specified Properties object.

Parameters
properties:List<String[]>

Properties object to load

resourceName:String

Name of resource. If loadFromFile is true, this is fully qualified path name to a file. param classLoader is ignored. If loadFromFile is false,this is resource name.

loadFromResourceback to summary
private static void loadFromResource(List<String[]> properties, String resourceName) throws IOException
matchPatternback to summary
private static boolean matchPattern(String regExp, String target, SessionLog logger)

Matches target to pattern specified regExp. Returns false if there is any error compiling regExp.

Parameters
regExp:String

The regular expression.

target:String

The target against which we are trying to match regExp.

Returns:boolean

false if there is error compiling regExp or target does not match regExp. true if regExp matches pattern.

matchVendorNameInPropertiesback to summary
private static String matchVendorNameInProperties(String vendorName, List<String[]> nameToVendorPlatform, SessionLog logger)

Match vendorName in properties specified by _nameToVendorPlatform.

openResourceInputStreamback to summary
private static InputStream openResourceInputStream(final String resourceName) throws IOException

Open resourceName as input stream inside doPriviledged block

validateLineForReturnAsKeyValueArrayback to summary
private static String[] validateLineForReturnAsKeyValueArray(String line)