本文整理了Java中javax.naming.Reference.add
方法的一些代码示例,展示了Reference.add
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.add
方法的具体详情如下:
包路径:javax.naming.Reference
类名称:Reference
方法名:add
暂无
代码示例来源:origin: alibaba/druid
public Reference getReference() throws NamingException {
final String className = getClass().getName();
final String factoryName = className + "Factory"; // XXX: not robust
Reference ref = new Reference(className, factoryName, null);
ref.add(new StringRefAddr("instanceKey", instanceKey));
ref.add(new StringRefAddr("url", this.getUrl()));
ref.add(new StringRefAddr("username", this.getUsername()));
ref.add(new StringRefAddr("password", this.getPassword()));
// TODO ADD OTHER PROPERTIES
return ref;
}
代码示例来源:origin: NLPchina/elasticsearch-sql
public Reference getReference() throws NamingException {
final String className = getClass().getName();
final String factoryName = className + "Factory"; // XXX: not robust
Reference ref = new Reference(className, factoryName, null);
ref.add(new StringRefAddr("instanceKey", instanceKey));
ref.add(new StringRefAddr("url", this.getUrl()));
ref.add(new StringRefAddr("username", this.getUsername()));
ref.add(new StringRefAddr("password", this.getPassword()));
// TODO ADD OTHER PROPERTIES
return ref;
}
代码示例来源:origin: com.h2database/h2
/**
* Get a new reference for this object, using the current settings.
*
* @return the new reference
*/
@Override
public Reference getReference() {
debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName();
Reference ref = new Reference(getClass().getName(), factoryClassName, null);
ref.add(new StringRefAddr("url", url));
ref.add(new StringRefAddr("user", userName));
ref.add(new StringRefAddr("password", convertToString(passwordChars)));
ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
ref.add(new StringRefAddr("description", description));
return ref;
}
代码示例来源:origin: org.postgresql/postgresql
/**
* Adds custom properties for this DataSource to the properties defined in the superclass.
*/
public Reference getReference() throws NamingException {
Reference ref = super.getReference();
ref.add(new StringRefAddr("dataSourceName", dataSourceName));
if (initialConnections > 0) {
ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections)));
}
if (maxConnections > 0) {
ref.add(new StringRefAddr("maxConnections", Integer.toString(maxConnections)));
}
return ref;
}
代码示例来源:origin: internetarchive/heritrix3
/**
* @param on ObjectName instance to work with.
* @return A simple reference based on passed <code>on</code>
*/
public static Reference getReference(final ObjectName on) {
Reference r = new Reference(String.class.getName());
Hashtable<String,String> ht = on.getKeyPropertyList();
r.add(new StringRefAddr("host", (String)ht.get("host")));
r.add(new StringRefAddr("name", (String)ht.get("name")));
// Put in a value to serve as a unique 'key'.
r.add(new StringRefAddr("key",
on.getCanonicalKeyPropertyListString()));
return r;
}
代码示例来源:origin: lealone/Lealone
/**
* Get a new reference for this object, using the current settings.
*
* @return the new reference
*/
@Override
public Reference getReference() {
debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName();
Reference ref = new Reference(getClass().getName(), factoryClassName, null);
ref.add(new StringRefAddr("url", url));
ref.add(new StringRefAddr("user", userName));
ref.add(new StringRefAddr("password", convertToString(passwordChars)));
ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
ref.add(new StringRefAddr("description", description));
return ref;
}
代码示例来源:origin: postgresql/postgresql
/**
* Adds custom properties for this DataSource to the properties defined in
* the superclass.
*/
public Reference getReference() throws NamingException
{
Reference ref = super.getReference();
ref.add(new StringRefAddr("dataSourceName", dataSourceName));
if (initialConnections > 0)
{
ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections)));
}
if (maxConnections > 0)
{
ref.add(new StringRefAddr("maxConnections", Integer.toString(maxConnections)));
}
return ref;
}
}
代码示例来源:origin: postgresql/postgresql
ref.add(new StringRefAddr("serverName", serverName));
if (portNumber != 0)
ref.add(new StringRefAddr("portNumber", Integer.toString(portNumber)));
ref.add(new StringRefAddr("databaseName", databaseName));
if (user != null)
ref.add(new StringRefAddr("user", user));
ref.add(new StringRefAddr("password", password));
ref.add(new StringRefAddr("prepareThreshold", Integer.toString(prepareThreshold)));
ref.add(new StringRefAddr("unknownLength", Integer.toString(unknownLength)));
ref.add(new StringRefAddr("loginTimeout", Integer.toString(loginTimeout)));
ref.add(new StringRefAddr("socketTimeout", Integer.toString(socketTimeout)));
ref.add(new StringRefAddr("ssl", Boolean.toString(ssl)));
ref.add(new StringRefAddr("sslfactory", sslfactory));
ref.add(new StringRefAddr("tcpKeepAlive", Boolean.toString(tcpKeepAlive)));
if (compatible != null)
ref.add(new StringRefAddr("compatible", compatible));
ref.add(new StringRefAddr("logLevel", Integer.toString(logLevel)));
ref.add(new StringRefAddr("protocolVersion", Integer.toString(protocolVersion)));
ref.add(new StringRefAddr("ApplicationName", applicationName));
代码示例来源:origin: org.postgresql/postgresql
public Reference getReference() throws NamingException {
Reference ref = createReference();
ref.add(new StringRefAddr("serverName", serverName));
if (portNumber != 0) {
ref.add(new StringRefAddr("portNumber", Integer.toString(portNumber)));
}
ref.add(new StringRefAddr("databaseName", databaseName));
if (user != null) {
ref.add(new StringRefAddr("user", user));
}
if (password != null) {
ref.add(new StringRefAddr("password", password));
}
for (PGProperty property : PGProperty.values()) {
if (property.isPresent(properties)) {
ref.add(new StringRefAddr(property.getName(), property.get(properties)));
}
}
return ref;
}
代码示例来源:origin: wildfly/wildfly
/**
* Create a Reference instance from a JNDIStorable object
*
* @param instanceClassName
* The name of the class that is being created.
* @param po
* The properties object to use when configuring the new instance.
*
* @return Reference
*
* @throws NamingException if an error occurs while creating the new instance.
*/
public static Reference createReference(String instanceClassName, JNDIStorable po) throws NamingException {
Reference result = new Reference(instanceClassName, JNDIReferenceFactory.class.getName(), null);
try {
Properties props = po.getProperties();
for (Enumeration iter = props.propertyNames(); iter.hasMoreElements();) {
String key = (String)iter.nextElement();
result.add(new StringRefAddr(key, props.getProperty(key)));
}
} catch (Exception e) {
throw new NamingException(e.getMessage());
}
return result;
}
代码示例来源:origin: apache/activemq
/**
* Create a Reference instance from a JNDIStorable object
*
* @param instanceClassName
* @param po
* @return
* @throws NamingException
*/
public static Reference createReference(String instanceClassName, JNDIStorableInterface po) throws NamingException {
if (log.isTraceEnabled()) {
log.trace("Creating reference: " + instanceClassName + "," + po);
}
Reference result = new Reference(instanceClassName, JNDIReferenceFactory.class.getName(), null);
try {
Properties props = po.getProperties();
for (Enumeration iter = props.propertyNames(); iter.hasMoreElements();) {
String key = (String)iter.nextElement();
String value = props.getProperty(key);
javax.naming.StringRefAddr addr = new javax.naming.StringRefAddr(key, value);
result.add(addr);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new NamingException(e.getMessage());
}
return result;
}
代码示例来源:origin: com.alibaba/druid
public Reference getReference() throws NamingException {
final String className = getClass().getName();
final String factoryName = className + "Factory"; // XXX: not robust
Reference ref = new Reference(className, factoryName, null);
ref.add(new StringRefAddr("instanceKey", instanceKey));
ref.add(new StringRefAddr("url", this.getUrl()));
ref.add(new StringRefAddr("username", this.getUsername()));
ref.add(new StringRefAddr("password", this.getPassword()));
// TODO ADD OTHER PROPERTIES
return ref;
}
代码示例来源:origin: p6spy/p6spy
@Override
public Reference getReference() throws NamingException {
final Reference reference = new Reference(getClass().getName(), P6DataSourceFactory.class.getName(), null);
reference.add(new StringRefAddr("dataSourceName", getRealDataSource()));
return reference;
}
代码示例来源:origin: hector-client/hector
@Test
public void getObjectInstance() throws Exception {
Reference resource = new Reference("CassandraClientFactory");
resource.add(new StringRefAddr("hosts", cassandraUrl));
resource.add(new StringRefAddr("clusterName", clusterName));
resource.add(new StringRefAddr("keyspace", "Keyspace1"));
resource.add(new StringRefAddr("autoDiscoverHosts", "true"));
Name jndiName = mock(Name.class);
Context context = new InitialContext();
Hashtable<String, String> environment = new Hashtable<String, String>();
Keyspace keyspace = (Keyspace) factory.getObjectInstance(resource, jndiName, context, environment);
assertNotNull(keyspace);
assertEquals("Keyspace1",keyspace.getKeyspaceName());
}
}
代码示例来源:origin: org.ow2.jonas/jonas-commons
/**
* Insert a key/value String/String couple in the given Reference as a StringRefAddr.
* @param ref Reference to be modified
* @param key Address' key
* @param value Address' value
*/
public static void insertInto(final Reference ref, final String key, final String value) {
if (value != null) {
RefAddr addr = new StringRefAddr(key, value);
ref.add(addr);
} // else, print a debug message ?
}
代码示例来源:origin: org.ow2.joram/joram-client-jms
/** Sets the naming reference of a connection factory. */
public void toReference(Reference ref) throws NamingException {
ref.add(new StringRefAddr("user.name", name));
ref.add(new StringRefAddr("user.id", proxyId));
}
代码示例来源:origin: org.ow2.joram/joram-client-jms
/** Sets the naming reference of a connection factory. */
public void toReference(Reference ref) throws NamingException {
ref.add(new StringRefAddr("dest.agentId", agentId));
ref.add(new StringRefAddr("dest.adminName", adminName));
}
代码示例来源:origin: com.bbossgroups/bboss-persistent
public Reference getReference() {
Reference ref = new Reference("com.frameworkset.common.poolman.sql.PoolManDataSource", "com.frameworkset.common.poolman.sql.PoolManDataSource", null);
ref.add(new StringRefAddr("dbname", this.poolName));
ref.add(new StringRefAddr("jndiname", this.jndiName));
return ref;
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-base
@Override
public Reference getReference() throws NamingException {
final Reference reference = new Reference(DataSourceProxy.class.getName(), ReferenceableDataSourceSpyFactory.class.getName(), null);
reference.add(new StringRefAddr(ReferenceableDataSourceSpyFactory.DATA_SOURCE_ID, dataSourceId));
return reference;
}
代码示例来源:origin: org.ow2.joram/joram-client-jms
/** Sets the clustered naming reference of a connection factory. */
public void toReference(Reference ref, String prefix) {
if (prefix == null) prefix = "cf";
params.toReference(ref, prefix);
ref.add(new StringRefAddr(prefix + ".reliableClass", reliableClass));
ref.add(new StringRefAddr(prefix + ".identityClassName", identityClassName));
}
内容来源于网络,如有侵权,请联系作者删除!