本文整理汇总了Java中org.eclipse.datatools.connectivity.ConnectionProfileConstants类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionProfileConstants类的具体用法?Java ConnectionProfileConstants怎么用?Java ConnectionProfileConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionProfileConstants类属于org.eclipse.datatools.connectivity包,在下文中一共展示了ConnectionProfileConstants类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTransientSampleDbProfile
import org.eclipse.datatools.connectivity.ConnectionProfileConstants; //导入依赖的package包/类
private static boolean isTransientSampleDbProfile( Properties dbProfileProps )
{
String profileName =
dbProfileProps.getProperty( ConnectionProfileProperty.PROFILE_NAME_PROP_KEY );
if( profileName != null && profileName.length() > 0 ) // has profile name
return false; // not for a transient profile
// check if the transient profile properties contain reference of
// the default SampleDb driver definition instance
String driverDefnId = dbProfileProps.getProperty(
ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, null );
if( driverDefnId == null ||
! ( driverDefnId.equalsIgnoreCase( SampleDbFactory.SAMPLEDB_DEFAULT_DRIVER_DEFN_ID ) ||
driverDefnId.equalsIgnoreCase( SampleDbFactory.getLocalizedDriverDefinitionId() ) ))
return false;
String dbUrl = dbProfileProps.getProperty( IJDBCConnectionProfileConstants.URL_PROP_ID, null );
if( dbUrl == null ||
dbUrl.replace( '\\', '/' ).indexOf( SampleDbFactory.SAMPLEDB_URL_RELATIVE_SUFFIX ) == -1 )
return false;
return true;
}
示例2: createPropertiesByVendorVersion
import org.eclipse.datatools.connectivity.ConnectionProfileConstants; //导入依赖的package包/类
public static Properties createPropertiesByVendorVersion(String vendor, String version) {
Properties properties = new Properties();
for (TemplateDescriptor templateDescriptor : TemplateDescriptor.getDriverTemplateDescriptors()) {
String templateVendor = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID);
String templateVersion = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID);
if (templateVendor != null && templateVendor.equals(vendor) && templateVersion != null && templateVersion.equals(version)) {
if (!templateDescriptor.getId().endsWith(QCatalogContainer.TEMPLATE_SUFFIX))
continue;
properties.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, templateVendor);
properties.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, templateVersion);
// System.out.println(templateDescriptor.getId());
DriverInstance driverInstances[] = DriverManager.getInstance().getDriverInstancesByTemplate(templateDescriptor.getId());
if (driverInstances.length > 0)
properties.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, driverInstances[0].getId());
String driverClass = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID);
if (driverClass != null)
properties.setProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driverClass);
// platform dependent jar list
StringBuffer jarList = new StringBuffer();
try {
Bundle bundle = Platform.getBundle(templateDescriptor.getElement().getDeclaringExtension().getNamespaceIdentifier());
String paths[] = templateDescriptor.getJarList().split(";");
for (int i = 0; i < paths.length; i++) {
if (i > 0)
jarList.append(System.getProperty("path.separator"));
URL pathURL = bundle.getEntry(paths[i].trim());
jarList.append(new Path(FileLocator.toFileURL(pathURL).getFile()).toOSString());
}
} catch (IOException e) {
throw new FrameworkCoreRuntimeException(e);
}
properties.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, jarList.toString());
String driverUrl = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.URL_PROP_ID);
if (driverUrl != null)
properties.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID, driverUrl);
String user = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID);
if (user != null)
properties.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID, user);
String password = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID);
if (password != null)
properties.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID, password);
properties.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, Boolean.FALSE.toString());
break;
}
}
return properties;
}
示例3: createPropertiesByVendorVersion
import org.eclipse.datatools.connectivity.ConnectionProfileConstants; //导入依赖的package包/类
public Properties createPropertiesByVendorVersion(String vendor, String version) {
Properties properties = new Properties();
for (TemplateDescriptor templateDescriptor : TemplateDescriptor.getDriverTemplateDescriptors()) {
String templateVendor = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID);
String templateVersion = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID);
if (templateVendor != null && templateVendor.equals(vendor) && templateVersion != null && templateVersion.equals(version)) {
if (!templateDescriptor.getId().endsWith(QCatalogContainer.TEMPLATE_SUFFIX))
continue;
properties.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, templateVendor);
properties.setProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, templateVersion);
// System.out.println(templateDescriptor.getId());
DriverInstance driverInstances[] = DriverManager.getInstance().getDriverInstancesByTemplate(templateDescriptor.getId());
if (driverInstances.length > 0)
properties.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, driverInstances[0].getId());
String driverClass = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID);
if (driverClass != null)
properties.setProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driverClass);
// platform dependent jar list
StringBuffer jarList = new StringBuffer();
try {
Bundle bundle = Platform.getBundle(templateDescriptor.getElement().getDeclaringExtension().getNamespaceIdentifier());
String paths[] = templateDescriptor.getJarList().split(";");
for (int i = 0; i < paths.length; i++) {
if (i > 0)
jarList.append(System.getProperty("path.separator"));
URL pathURL = bundle.getEntry(paths[i].trim());
jarList.append(new Path(FileLocator.toFileURL(pathURL).getFile()).toOSString());
}
} catch (IOException e) {
throw new FrameworkCoreRuntimeException(e);
}
properties.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, jarList.toString());
String driverUrl = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.URL_PROP_ID);
if (driverUrl != null)
properties.setProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID, driverUrl);
String user = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID);
if (user != null)
properties.setProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID, user);
String password = templateDescriptor.getPropertyValueFromId(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID);
if (password != null)
properties.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID, password);
properties.setProperty(IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, Boolean.FALSE.toString());
break;
}
}
return properties;
}