当前位置: 首页>>代码示例>>Java>>正文


Java DriverInstance类代码示例

本文整理汇总了Java中org.eclipse.datatools.connectivity.drivers.DriverInstance的典型用法代码示例。如果您正苦于以下问题:Java DriverInstance类的具体用法?Java DriverInstance怎么用?Java DriverInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DriverInstance类属于org.eclipse.datatools.connectivity.drivers包,在下文中一共展示了DriverInstance类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isInvalidDriverDefinition

import org.eclipse.datatools.connectivity.drivers.DriverInstance; //导入依赖的package包/类
/**
 * Checks whether the specified driver definition is invalid.
 * @param driverDefnName    name of a connectivity driver definition instance 
 * @return  true if the specified driver definition exists but invalid;
 *          false otherwise
 */
static boolean isInvalidDriverDefinition( String driverDefnName )
{
    if( driverDefnName == null || driverDefnName.length() == 0 )
        return false;
    DriverInstance driverInstance = 
        DriverManager.getInstance().getDriverInstanceByName( driverDefnName );
    if( driverInstance == null )
        return false;
    
    // check if the driver instance is invalid
    return ! new DriverValidator( driverInstance ).isValid( false );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:ProfileDriverUtil.java

示例2: removeInvalidDriverDefinition

import org.eclipse.datatools.connectivity.drivers.DriverInstance; //导入依赖的package包/类
/**
 * Removes the specified driver definition instance, if invalid.
 * This may be used by a client to clean up its obsolete driver definition,
 * so a new driver instance with the current jar paths will get created  
 * automatically by the connectivity profile management.
 * @param driverDefnName    name of a connectivity driver definition instance
 * @return  true if the specified driver definition is found invalid and 
 *          is successfully removed; false otherwise
 */
static boolean removeInvalidDriverDefinition( String driverDefnName )
{
    if( isInvalidDriverDefinition( driverDefnName ) )
    {
        DriverManager driverMgr = DriverManager.getInstance();
        DriverInstance driverInstance = driverMgr.getDriverInstanceByName( driverDefnName );
        if( driverInstance != null )
            return driverMgr.removeDriverInstance( driverInstance.getId() );
    }
    return false;   // driver definition is valid and not removed
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:ProfileDriverUtil.java

示例3: createPropertiesByVendorVersion

import org.eclipse.datatools.connectivity.drivers.DriverInstance; //导入依赖的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;

	}
 
开发者ID:asupdev,项目名称:asup,代码行数:64,代码来源:BaseCatalogHelper.java

示例4: createPropertiesByVendorVersion

import org.eclipse.datatools.connectivity.drivers.DriverInstance; //导入依赖的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;

	}
 
开发者ID:asupdev,项目名称:asup,代码行数:64,代码来源:ASUPPlugin.java

示例5: getDriverDefinition

import org.eclipse.datatools.connectivity.drivers.DriverInstance; //导入依赖的package包/类
@Override
protected DriverInstance getDriverDefinition() throws Exception {
	// TODO Auto-generated method stub
	return super.getDriverDefinition();
}
 
开发者ID:asupdev,项目名称:asup,代码行数:6,代码来源:ASUPConnection.java


注:本文中的org.eclipse.datatools.connectivity.drivers.DriverInstance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。