List of usage examples for java.sql DriverPropertyInfo DriverPropertyInfo
public DriverPropertyInfo(String name, String value)
DriverPropertyInfo
object with a given name and value. From source file:com.taobao.tdhs.jdbc.NonRegisteringDriver.java
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { if (info == null) { info = new Properties(); }/* w w w. ja va 2s . c o m*/ if ((url != null) && url.startsWith(URL_PREFIX)) { info = parseURL(url, info); } DriverPropertyInfo hostProp = new DriverPropertyInfo(HOST_PROPERTY_KEY, info.getProperty(HOST_PROPERTY_KEY)); hostProp.required = true; hostProp.description = "Host name"; DriverPropertyInfo portProp = new DriverPropertyInfo(PORT_PROPERTY_KEY, info.getProperty(PORT_PROPERTY_KEY, "9999")); portProp.required = false; portProp.description = "port"; DriverPropertyInfo dbProp = new DriverPropertyInfo(DBNAME_PROPERTY_KEY, info.getProperty(DBNAME_PROPERTY_KEY)); dbProp.required = false; dbProp.description = "Database name"; DriverPropertyInfo readcodeProp = new DriverPropertyInfo(READ_CODE_PROPERTY_KEY, info.getProperty(READ_CODE_PROPERTY_KEY)); readcodeProp.required = false; DriverPropertyInfo writeCodeProp = new DriverPropertyInfo(WRITE_CODE_PROPERTY_KEY, info.getProperty(WRITE_CODE_PROPERTY_KEY)); writeCodeProp.required = false; DriverPropertyInfo[] dpi = new DriverPropertyInfo[5]; dpi[0] = hostProp; dpi[1] = portProp; dpi[2] = dbProp; dpi[3] = readcodeProp; dpi[4] = writeCodeProp; return dpi; }
From source file:org.apache.jena.jdbc.remote.RemoteEndpointDriver.java
@Override protected DriverPropertyInfo[] getPropertyInfo(Properties connProps, List<DriverPropertyInfo> baseDriverProps) { DriverPropertyInfo[] driverProps = new DriverPropertyInfo[10 + baseDriverProps.size()]; this.copyBaseProperties(driverProps, baseDriverProps, 10); // Query Endpoint parameter driverProps[0] = new DriverPropertyInfo(PARAM_QUERY_ENDPOINT, connProps.getProperty(PARAM_QUERY_ENDPOINT)); driverProps[0].required = !connProps.containsKey(PARAM_UPDATE_ENDPOINT); driverProps[0].description = "Sets the SPARQL Query endpoint to use for query operations, if this is specified and " + PARAM_UPDATE_ENDPOINT + " is not then a read-only connection will be created"; // Update Endpoint parameter driverProps[1] = new DriverPropertyInfo(PARAM_UPDATE_ENDPOINT, connProps.getProperty(PARAM_UPDATE_ENDPOINT)); driverProps[1].required = !connProps.containsKey(PARAM_UPDATE_ENDPOINT); driverProps[1].description = "Sets the SPARQL Update endpoint to use for update operations, if this is specified and " + PARAM_QUERY_ENDPOINT + " is not then a write-only connection will be created"; // Default Graph parameter driverProps[2] = new DriverPropertyInfo(PARAM_DEFAULT_GRAPH_URI, null); driverProps[2].required = false;//from w ww.j a va 2 s.c om driverProps[2].description = "Sets the URI for a default graph for queries, may be specified multiple times to specify multiple graphs which should form the default graph"; // Named Graph parameter driverProps[3] = new DriverPropertyInfo(PARAM_NAMED_GRAPH_URI, null); driverProps[3].required = false; driverProps[3].description = "Sets the URI for a named graph for queries, may be specified multiple times to specify multiple named graphs which should be accessible"; // Using Graph parameter driverProps[4] = new DriverPropertyInfo(PARAM_USING_GRAPH_URI, null); driverProps[4].required = false; driverProps[4].description = "Sets the URI for a default graph for updates, may be specified multiple times to specify multiple graphs which should form the default graph"; // Using Named Graph parameter driverProps[5] = new DriverPropertyInfo(PARAM_USING_NAMED_GRAPH_URI, null); driverProps[5].required = false; driverProps[5].description = "Sets the URI for a named graph for updates, may be specified multiple times to specify multiple named graph which should be accessible"; // Results Types driverProps[6] = new DriverPropertyInfo(PARAM_SELECT_RESULTS_TYPE, connProps.getProperty(PARAM_SELECT_RESULTS_TYPE)); driverProps[6].required = false; driverProps[6].description = "Sets the results type for SELECT queries that will be requested from the remote endpoint"; driverProps[7] = new DriverPropertyInfo(PARAM_MODEL_RESULTS_TYPE, connProps.getProperty(PARAM_MODEL_RESULTS_TYPE)); driverProps[7].required = false; driverProps[7].description = "Sets the results type for CONSTRUCT and DESCRIBE queries that will be requested from the remote endpoint"; // User Name parameter driverProps[8] = new DriverPropertyInfo(PARAM_USERNAME, connProps.getProperty(PARAM_USERNAME)); // Password parameter driverProps[9] = new DriverPropertyInfo(PARAM_PASSWORD, connProps.getProperty(PARAM_PASSWORD)); return driverProps; }
From source file:org.kawanfw.sql.api.client.RemoteDriver.java
/** * Build a new DriverPropertyInfo with the passed property * /*from w w w . ja v a 2s . com*/ * @param property * the property to pass as name and value * @param info * the properties * @return a DriverPropertyInfo with the propery name and value */ private DriverPropertyInfo getNewDriverPropertyInfo(String property, Properties info) { return new DriverPropertyInfo(property, info.getProperty(property)); }
From source file:org.kawanfw.sql.api.client.RemoteDriver.java
/** * Gets information about the possible properties for this driver. * <P>//from w w w . j a v a2 s. com * The <code>getPropertyInfo</code> method is intended to allow a generic * GUI tool to discover what properties it should prompt a human for in * order to get enough information to connect to a database. Note that * depending on the values the human has supplied so far, additional values * may become necessary, so it may be necessary to iterate though several * calls to the <code>getPropertyInfo</code> method. * * @param url * the URL of the database to which to connect * @param info * a proposed list of tag/value pairs that will be sent on * connect open * @return an array of <code>DriverPropertyInfo</code> objects describing * possible properties. * @exception SQLException * if a database access error occurs */ @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { List<DriverPropertyInfo> driverPropertyInfoList = new ArrayList<DriverPropertyInfo>(); if (info != null) { info.remove("RemarksReporting"); } DriverPropertyInfo driverPropertyInfo = null; driverPropertyInfo = getNewDriverPropertyInfo("user", info); driverPropertyInfo.description = "Username to connect to the remote database as"; driverPropertyInfo.required = true; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = new DriverPropertyInfo("password", null); driverPropertyInfo.description = "Password to use when authenticating"; driverPropertyInfo.required = true; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("proxyType", info); driverPropertyInfo.description = "Proxy Type to use: HTTP or SOCKS. Defaults to HTTP"; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("proxyHostname", info); driverPropertyInfo.description = "Proxy hostname to use"; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("proxyPort", info); driverPropertyInfo.description = "Proxy Port to use"; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("proxyUsername", info); driverPropertyInfo.description = "Proxy credential username"; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("proxyPassword", info); driverPropertyInfo.description = "Proxy credential password"; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("maxLengthForString", info); driverPropertyInfo.description = "Int for the maximum authorized length for a string for upload or download Should be <= 2097152 (2Mb). Defaults to 2097152."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("encryptionPassword", info); driverPropertyInfo.description = "The password to use to encrypt all request parameter names and values. Defaults to null (no encryption)."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("htmlEncoding", info); driverPropertyInfo.description = "Boolean that says if the upload/download of Clob using character stream or ASCII stream must be html encoded. Defaults to true."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("compression", info); driverPropertyInfo.description = "Boolean to say if the Driver is configured to contact the remote server using http compression. Defaults to true. Defaults to true."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("acceptAllSslCertificates", info); driverPropertyInfo.description = "Boolean thats says if client sides allows HTTPS call with all SSL Certificates, including \"invalid\" or self-signed Certificates. Defaults to false."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("statelessMode", info); driverPropertyInfo.description = "Boolean that says if the Driver is configured to contact the remote server in stateless mode. Defaults to false."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("uploadChunkLength", info); driverPropertyInfo.description = "Long for upload chunk length to be used by FileSession.upload(File, String). Defaults to 10Mb. 0 means files are not chunked."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("downloadChunkLength", info); driverPropertyInfo.description = "Long for download chunk length to be used by FileSession.download(String, File). Defaults to 10Mb. 0 means files are not chunked."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("joinResultSetMetaData", info); driverPropertyInfo.description = "Boolean to say if ResultSet MetaData is to be downloaded along with ResultSet. Defaults to false."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); driverPropertyInfo = getNewDriverPropertyInfo("zipResultSet", info); driverPropertyInfo.description = "Boolean to tell server to GZIP ResultSet before download. Defaults to true."; driverPropertyInfo.required = false; driverPropertyInfoList.add(driverPropertyInfo); DriverPropertyInfo[] arrayOfDriverPropertyInfo = driverPropertyInfoList .toArray(new DriverPropertyInfo[driverPropertyInfoList.size()]); return arrayOfDriverPropertyInfo; }
From source file:org.neo4j.jdbc.Driver.java
private DriverPropertyInfo infoFor(Properties properties, String name) { return new DriverPropertyInfo(name, properties.getProperty(name)); }