本文整理了Java中org.codehaus.cargo.container.configuration.entry.DataSource.getJndiLocation()
方法的一些代码示例,展示了DataSource.getJndiLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataSource.getJndiLocation()
方法的具体详情如下:
包路径:org.codehaus.cargo.container.configuration.entry.DataSource
类名称:DataSource
方法名:getJndiLocation
[英]The JNDI location that this datasource should be bound do (in the config file). Note that many application servers may prepend a context (typically java:comp/env
) to this context.
[中]此数据源应绑定到的JNDI位置(在配置文件中)。请注意,许多应用程序服务器可能会将上下文(通常为java:comp/env
)前置到此上下文。
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* adds the DataSource the application will use to make connections to an XADataSource.
*/
private void addCMTDataSourceAndLinkToXa()
{
buffer.append(" class='com.evermind.sql.OrionCMTDataSource' \n ");
buffer.append(" xa-source-location='").append(ds.getJndiLocation()).append("Provided")
.append("' \n");
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* adds the DataSource the application will use to make connections to an XADataSource.
*/
private void addCMTDataSourceAndLinkToXa()
{
buffer.append(" class='com.evermind.sql.OrionCMTDataSource' \n ");
buffer.append(" xa-source-location='").append(ds.getJndiLocation()).append("Provided")
.append("' \n");
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* sets the name and location of the datasource.
*/
private void addIdAndJndiLocationAttributes()
{
buffer.append(" name='").append(ds.getId()).append("' \n");
buffer.append(" location='").append(ds.getJndiLocation()).append("' \n");
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* @param ds DataSource.
* @return JNDI name corresponding to this DataSource.
*/
protected String getDataSourceJndi(DataSource ds)
{
String jndiName = ds.getJndiLocation();
return sanitizeJndiName(jndiName);
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-wildfly
/**
* @param ds DataSource.
* @return JNDI name corresponding to this DataSource.
*/
protected String getDataSourceJndi(DataSource ds)
{
String jndiName = ds.getJndiLocation();
return sanitizeJndiName(jndiName);
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* sets the name and location of the datasource.
*/
private void addIdAndJndiLocationAttributes()
{
buffer.append(" name='").append(ds.getId()).append("' \n");
buffer.append(" location='").append(ds.getJndiLocation()).append("' \n");
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* adds details necessary to create the vendor's DataSource or XADataSource object.
*
* @param className - the class implementing DataSource, XADataSource, etc.
* @param suffix - what to append to the id and jndi location
*/
private void setImplementationClassAndJndiContext(String className, String suffix)
{
buffer.append(" name='").append(ds.getId()).append(suffix).append("' \n");
buffer.append(" connection-driver='" + className + "'\n");
buffer.append(" class='" + className + "'\n");
buffer.append(" location='").append(ds.getJndiLocation()).append(suffix)
.append("' \n");
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* adds details necessary to create the vendor's DataSource or XADataSource object.
*
* @param className - the class implementing DataSource, XADataSource, etc.
* @param suffix - what to append to the id and jndi location
*/
private void setImplementationClassAndJndiContext(String className, String suffix)
{
buffer.append(" name='").append(ds.getId()).append(suffix).append("' \n");
buffer.append(" connection-driver='" + className + "'\n");
buffer.append(" class='" + className + "'\n");
buffer.append(" location='").append(ds.getJndiLocation()).append(suffix)
.append("' \n");
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation(), ds.getJndiLocation() + "local", ds
.getJndiLocation()
+ "xa");
addVendorConnectionDataAndCloseTag();
return buffer.toString();
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation() + "notx", ds.getJndiLocation(), ds
.getJndiLocation()
+ "xa");
addVendorConnectionDataAndCloseTag();
return buffer.toString();
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-container-orion
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation() + "notx", ds.getJndiLocation()
+ "local", ds.getJndiLocation());
addVendorConnectionDataAndCloseTag();
return buffer.toString();
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation() + "notx", ds.getJndiLocation()
+ "local", ds.getJndiLocation());
addVendorConnectionDataAndCloseTag();
return buffer.toString();
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation(), ds.getJndiLocation() + "local", ds
.getJndiLocation()
+ "xa");
addVendorConnectionDataAndCloseTag();
return buffer.toString();
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* {@inheritDoc}
*/
@Override
public String buildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)
{
this.ds = ds;
this.buffer = new StringBuffer();
startDataSourceTag();
addDriverAttributes();
addIdAndExtraLocationAttributes(ds.getJndiLocation() + "notx", ds.getJndiLocation(), ds
.getJndiLocation()
+ "xa");
addVendorConnectionDataAndCloseTag();
return buffer.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.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-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
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!