use of com.sun.jdo.api.persistence.support.SpecialDBOperation in project Payara by payara.
the class DBVendorType method newSpecialDBOperationInstance.
/**
* Returns new instance of class specified by specialDBOpClassName.
* The class is required to implement interface SpecialDBOperation.
* If specialDBOpClassName is null or cannot be loaded, then an instance
* of BaseSpecialDBOperation is returned.
* @param specialDBOpClassName Name of a class that implements
* SpecialDBOperation
* @param databaseMetaData DatabaseMetaData for the connection for which
* this SpecialDBOperation is created
* @param identifier Identifier of pmf used to obtain databaseMetaData.
* This can be null in non managed environment.
* @return An instance of SpecialDBOperation specified by specialDBOpClassName.
*/
private SpecialDBOperation newSpecialDBOperationInstance(final String specialDBOpClassName, DatabaseMetaData databaseMetaData, String identifier) {
SpecialDBOperation retInstance = null;
if (specialDBOpClassName != null) {
final ClassLoader loader = DBVendorType.class.getClassLoader();
Class clz = (Class) java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
public Object run() {
try {
if (loader != null) {
return Class.forName(specialDBOpClassName, true, loader);
} else {
return Class.forName(specialDBOpClassName);
}
} catch (Exception ex) {
if (logger.isLoggable()) {
logger.log(Logger.INFO, // NOI18N
"core.configuration.cantloadclass", specialDBOpClassName);
}
return null;
}
}
});
if (clz != null) {
try {
retInstance = (SpecialDBOperation) clz.newInstance();
retInstance.initialize(databaseMetaData, identifier);
} catch (Exception ex) {
throw new JDOFatalUserException(I18NHelper.getMessage(messages, // NOI18N
"sqlstore.database.dbvendor.cantinstantiateclass", specialDBOpClassName), ex);
}
}
}
return (retInstance != null) ? retInstance : DEFAULT_SPECIAL_DB_OPERATION;
}
Aggregations