本文整理了Java中org.codehaus.cargo.container.configuration.entry.DataSource.getPassword()
方法的一些代码示例,展示了DataSource.getPassword()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataSource.getPassword()
方法的具体详情如下:
包路径:org.codehaus.cargo.container.configuration.entry.DataSource
类名称:DataSource
方法名:getPassword
[英]The password to use when connecting to the database.
[中]连接到数据库时要使用的密码。
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* adds common details such as username, password, and url. used by both XA and non-XA
* connections.
*/
private void addCommonConnectionAttributes()
{
buffer.append(" username='").append(ds.getUsername()).append("' \n");
buffer.append(" password='").append(ds.getPassword()).append("' \n");
if (ds.getUrl() != null)
{
buffer.append(" url='" + ds.getUrl()).append("' \n");
}
buffer.append(" inactivity-timeout='30'");
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* adds common details such as username, password, and url. used by both XA and non-XA
* connections.
*/
private void addCommonConnectionAttributes()
{
buffer.append(" username='").append(ds.getUsername()).append("' \n");
buffer.append(" password='").append(ds.getPassword()).append("' \n");
if (ds.getUrl() != null)
{
buffer.append(" url='" + ds.getUrl()).append("' \n");
}
buffer.append(" inactivity-timeout='30'");
}
代码示例来源:origin: codehaus-cargo/cargo
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
propertiesMap.put("cargo.datasource.id", ds.getId());
propertiesMap.put("cargo.datasource.driver", ds.getDriverClass());
propertiesMap.put("cargo.datasource.url", ds.getUrl());
propertiesMap.put("cargo.datasource.username", ds.getUsername());
propertiesMap.put("cargo.datasource.password", ds.getPassword());
propertiesMap.put("cargo.datasource.jndi", ds.getJndiLocation());
propertiesMap.put("cargo.datasource.driver.classpath", getDataSourceClasspath());
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-weblogic
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
propertiesMap.put("cargo.datasource.id", ds.getId());
propertiesMap.put("cargo.datasource.driver", ds.getDriverClass());
propertiesMap.put("cargo.datasource.url", ds.getUrl());
propertiesMap.put("cargo.datasource.username", ds.getUsername());
propertiesMap.put("cargo.datasource.password", ds.getPassword());
propertiesMap.put("cargo.datasource.jndi", ds.getJndiLocation());
propertiesMap.put("cargo.datasource.type", ds.getConnectionType());
propertiesMap.put("cargo.datasource.transactionsupport", ds.getTransactionSupport().
toString());
}
}
代码示例来源:origin: codehaus-cargo/cargo
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
propertiesMap.put("cargo.datasource.id", ds.getId());
propertiesMap.put("cargo.datasource.driver", ds.getDriverClass());
propertiesMap.put("cargo.datasource.url", ds.getUrl());
propertiesMap.put("cargo.datasource.username", ds.getUsername());
propertiesMap.put("cargo.datasource.password", ds.getPassword());
propertiesMap.put("cargo.datasource.jndi", ds.getJndiLocation());
propertiesMap.put("cargo.datasource.type", ds.getConnectionType());
propertiesMap.put("cargo.datasource.transactionsupport", ds.getTransactionSupport().
toString());
}
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-wildfly
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
Map<String, String> datasourceProperties = new HashMap<String, String>();
datasourceProperties.put("name", ds.getId());
datasourceProperties.put("jndi-name", getDataSourceJndi(ds));
datasourceProperties.put("driver-name", ds.getDriverClass());
datasourceProperties.put("user-name", ds.getUsername());
datasourceProperties.put("password", ds.getPassword());
char delimiter = ',';
Map<String, String> conProperties = PropertyUtils.toMap(ds.getConnectionProperties());
String customProperties = PropertyUtils.joinOnDelimiter(conProperties, delimiter);
datasourceProperties.put("xa-datasource-properties", customProperties);
String dsProps = mapResourceProperties(datasourceProperties);
propertiesMap.put("cargo.datasource.properties", dsProps);
}
}
代码示例来源:origin: codehaus-cargo/cargo
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
Map<String, String> datasourceProperties = new HashMap<String, String>();
datasourceProperties.put("name", ds.getId());
datasourceProperties.put("jndi-name", getDataSourceJndi(ds));
datasourceProperties.put("driver-name", ds.getDriverClass());
datasourceProperties.put("user-name", ds.getUsername());
datasourceProperties.put("password", ds.getPassword());
char delimiter = ',';
Map<String, String> conProperties = PropertyUtils.toMap(ds.getConnectionProperties());
String customProperties = PropertyUtils.joinOnDelimiter(conProperties, delimiter);
datasourceProperties.put("xa-datasource-properties", customProperties);
String dsProps = mapResourceProperties(datasourceProperties);
propertiesMap.put("cargo.datasource.properties", dsProps);
}
}
代码示例来源:origin: codehaus-cargo/cargo
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
Map<String, String> datasourceProperties = new HashMap<String, String>();
datasourceProperties.put("name", ds.getId());
datasourceProperties.put("jndi-name", getDataSourceJndi(ds));
datasourceProperties.put("driver-name", ds.getDriverClass());
datasourceProperties.put("connection-url", ds.getUrl());
datasourceProperties.put("user-name", ds.getUsername());
datasourceProperties.put("password", ds.getPassword());
if (TransactionSupport.NO_TRANSACTION.equals(ds.getTransactionSupport()))
{
datasourceProperties.put("jta", "false");
}
else
{
datasourceProperties.put("jta", "true");
}
String dsProps = mapResourceProperties(datasourceProperties);
propertiesMap.put("cargo.datasource.properties", dsProps);
}
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-wildfly
@Override
protected void addConfigurationScriptProperties(Map<String, String> propertiesMap)
{
Map<String, String> datasourceProperties = new HashMap<String, String>();
datasourceProperties.put("name", ds.getId());
datasourceProperties.put("jndi-name", getDataSourceJndi(ds));
datasourceProperties.put("driver-name", ds.getDriverClass());
datasourceProperties.put("connection-url", ds.getUrl());
datasourceProperties.put("user-name", ds.getUsername());
datasourceProperties.put("password", ds.getPassword());
if (TransactionSupport.NO_TRANSACTION.equals(ds.getTransactionSupport()))
{
datasourceProperties.put("jta", "false");
}
else
{
datasourceProperties.put("jta", "true");
}
String dsProps = mapResourceProperties(datasourceProperties);
propertiesMap.put("cargo.datasource.properties", dsProps);
}
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test the driver properties when the password is set on datasource.
*/
public void testDatabaseDriverPropertiesPasswordPropertySetsPasswordOnDataSource()
{
String driverPropertyString = "password=egg;CreateDatabase=create";
String propertyString =
DatasourcePropertySet.CONNECTION_PROPERTIES + "=" + driverPropertyString;
DataSource ds = dataSourceConverter.fromPropertyString(propertyString);
assertEquals("egg", ds.getPassword());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test the driver properties when an empty password is set on datasource.
*/
public void testDatabaseDriverPropertiesEmptyPasswordPropertySetsPasswordOnDataSource()
{
String driverPropertyString = "password=;CreateDatabase=create";
String propertyString =
DatasourcePropertySet.CONNECTION_PROPERTIES + "=" + driverPropertyString;
DataSource ds = dataSourceConverter.fromPropertyString(propertyString);
assertEquals("", ds.getPassword());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test the driver properties when the username and the password is set on datasource.
*/
public void testDatabaseDriverPropertiesUserAndPasswordPropertyOverrideDSUserAndPassword()
{
String driverPropertyString = "user=APP;password=egg;CreateDatabase=create";
Properties props = new Properties();
props.setProperty(DatasourcePropertySet.USERNAME, "sa");
props.setProperty(DatasourcePropertySet.PASSWORD, "");
props.setProperty(DatasourcePropertySet.CONNECTION_PROPERTIES, driverPropertyString);
DataSource ds = dataSourceConverter.fromProperties(props);
assertEquals("APP", ds.getUsername());
assertEquals("egg", ds.getPassword());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test the {@link Properties} constructor.
*/
public void testPropertiesConstructor()
{
Properties props = new Properties();
props.setProperty(DatasourcePropertySet.ID, "rudolf");
props.setProperty(DatasourcePropertySet.TRANSACTION_SUPPORT,
TransactionSupport.NO_TRANSACTION.toString());
props.setProperty(DatasourcePropertySet.JNDI_LOCATION, "jdbc/JiraDS");
props
.setProperty(DatasourcePropertySet.CONNECTION_TYPE, ConfigurationEntryType.JDBC_DRIVER);
props.setProperty(DatasourcePropertySet.DRIVER_CLASS, "org.hsqldb.jdbcDriver");
props.setProperty(DatasourcePropertySet.URL, "postresql:localhost:jirads");
props.setProperty(DatasourcePropertySet.USERNAME, "sa");
props.setProperty(DatasourcePropertySet.PASSWORD, "");
DataSource ds = dataSourceConverter.fromProperties(props);
assertEquals(0, ds.getConnectionProperties().size());
assertEquals("", ds.getPassword());
assertEquals(props, dataSourceConverter.toProperties(ds));
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat
/**
* This method converts the DataSource to a Resource used in Tomcat.
*
* @return a Resource that can be used in Tomcat.
* @param ds the DataSource we are configuring.
*/
protected Resource convertToResource(DataSource ds)
{
Properties parameters = new Properties();
PropertyUtils.setPropertyIfNotNull(parameters, "url", ds.getUrl());
PropertyUtils.setPropertyIfNotNull(parameters, "username", ds.getUsername());
PropertyUtils.setPropertyIfNotNull(parameters, "password", ds.getPassword());
parameters.putAll(ds.getConnectionProperties());
Resource resource = new Resource(ds.getJndiLocation(), ConfigurationEntryType.DATASOURCE);
PropertyUtils.setPropertyIfNotNull(parameters, "driverClassName", ds.getDriverClass());
resource.setParameters(PropertyUtils.toMap(parameters));
return resource;
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* This method converts the DataSource to a Resource used in Tomcat.
*
* @return a Resource that can be used in Tomcat.
* @param ds the DataSource we are configuring.
*/
protected Resource convertToResource(DataSource ds)
{
Properties parameters = new Properties();
PropertyUtils.setPropertyIfNotNull(parameters, "url", ds.getUrl());
PropertyUtils.setPropertyIfNotNull(parameters, "username", ds.getUsername());
PropertyUtils.setPropertyIfNotNull(parameters, "password", ds.getPassword());
parameters.putAll(ds.getConnectionProperties());
Resource resource = new Resource(ds.getJndiLocation(), ConfigurationEntryType.DATASOURCE);
PropertyUtils.setPropertyIfNotNull(parameters, "driverClassName", ds.getDriverClass());
resource.setParameters(PropertyUtils.toMap(parameters));
return resource;
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Test the driver properties when the username and the password is set on datasource.
*/
public void testDatabaseDriverPropertiesUserAndPasswordPropertySetsDataSourceUserAndPassword()
{
String driverPropertyString = "user=APP;password=egg;CreateDatabase=create";
String propertyString =
DatasourcePropertySet.CONNECTION_PROPERTIES + "=" + driverPropertyString;
DataSource ds = dataSourceConverter.fromPropertyString(propertyString);
assertEquals("APP", ds.getUsername());
assertEquals("egg", ds.getPassword());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* This method converts the DataSource to a Resource.
*
* @param ds DataSource to convert to a resource.
* @param resourceType the type of the Resource to convert to. ex.
* <code>javax.sql.DataSource</code>
* @param driverParameter the name of the parameter to store {@link DataSource#getDriverClass()
* driverClass}.
* @return a Resource representing the assignable fields of the DataSource.
*/
public Resource convertToResource(DataSource ds, String resourceType, String driverParameter)
{
Properties parameters = new Properties();
if (ds.getUrl() != null)
{
PropertyUtils.setPropertyIfNotNull(parameters, "url", ds.getUrl());
}
PropertyUtils.setPropertyIfNotNull(parameters, "user", ds.getUsername());
PropertyUtils.setPropertyIfNotNull(parameters, "password", ds.getPassword());
PropertyUtils.setPropertyIfNotNull(parameters, driverParameter, ds.getDriverClass());
parameters.putAll(ds.getConnectionProperties());
Resource resource = new Resource(ds.getJndiLocation(), resourceType);
resource.setParameters(PropertyUtils.toMap(parameters));
return resource;
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Get a properties object containing all of the members of this datasource object. Note that
* driver properties will be nested and delimited by a semicolon.
*
* @param data DataSource to serialize into properties.
* @return a properties object corresponding to this datasource
*/
public Properties toProperties(DataSource data)
{
Properties properties = new Properties();
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.JNDI_LOCATION, data
.getJndiLocation());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.CONNECTION_TYPE,
data.getConnectionType());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.TRANSACTION_SUPPORT,
data.getTransactionSupport());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.DRIVER_CLASS, data
.getDriverClass());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.URL, data.getUrl());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.USERNAME, data
.getUsername());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.PASSWORD, data
.getPassword());
PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.ID, data.getId());
PropertyUtils.setPropertyIfNotNull(properties,
DatasourcePropertySet.CONNECTION_PROPERTIES,
getConnectionPropertiesAsASemicolonDelimitedString(data));
return properties;
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jrun
createTextContentChild(datasourceElement, "url", ds.getUrl());
createTextContentChild(datasourceElement, "username", ds.getUsername());
createTextContentChild(datasourceElement, "password", ds.getPassword());
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jboss
getAntUtils().addTokenToFilterChain(filterChain, "driverClass", ds.getDriverClass());
getAntUtils().addTokenToFilterChain(filterChain, "username", ds.getUsername());
getAntUtils().addTokenToFilterChain(filterChain, "password", ds.getPassword());
内容来源于网络,如有侵权,请联系作者删除!