本文整理了Java中javax.naming.Reference.<init>
方法的一些代码示例,展示了Reference.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.<init>
方法的具体详情如下:
包路径:javax.naming.Reference
类名称:Reference
方法名:<init>
暂无
代码示例来源:origin: ehcache/ehcache3
@Override
public Reference getReference() {
return new Reference(Ehcache3XAResourceProducer.class.getName(),
new StringRefAddr("uniqueName", getUniqueName()),
ResourceObjectFactory.class.getName(), null);
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public Reference getReference() {
// from javax.naming.Referenceable
LOG.debug( "Returning a Reference to the SessionFactory" );
return new Reference(
SessionFactoryImpl.class.getName(),
new StringRefAddr("uuid", getUuid()),
SessionFactoryRegistry.ObjectFactoryImpl.class.getName(),
null
);
}
代码示例来源: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: 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: 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: 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.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: 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: 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: 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: 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.codehaus.btm/btm
public Reference getReference() throws NamingException {
return new Reference(
BitronixTransactionManager.class.getName(),
new StringRefAddr("TransactionSynchronizationRegistry", "BitronixTransactionSynchronizationRegistry"),
BitronixTransactionSynchronizationRegistryObjectFactory.class.getName(),
null
);
}
代码示例来源:origin: hibernate/hibernate
/**
* @see javax.naming.Referenceable#getReference()
*/
public Reference getReference() throws NamingException {
return new Reference(
SessionFactoryStub.class.getName(),
new StringRefAddr("uuid", uuid),
SessionFactoryObjectFactory.class.getName(),
null
);
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
/**
* @see javax.naming.Referenceable#getReference()
*/
public Reference getReference() throws NamingException {
return new Reference(
SessionFactoryStub.class.getName(),
new StringRefAddr("uuid", uuid),
SessionFactoryObjectFactory.class.getName(),
null
);
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
/**
* @see javax.naming.Referenceable#getReference()
*/
@Override
public Reference getReference() throws NamingException {
return new Reference(
SessionFactoryStub.class.getName(),
new StringRefAddr("uuid", uuid),
SessionFactoryRegistry.ObjectFactoryImpl.class.getName(),
null
);
}
代码示例来源:origin: bitronix/btm
@Override
public Reference getReference() throws NamingException {
return new Reference(
BitronixTransactionManager.class.getName(),
new StringRefAddr("TransactionSynchronizationRegistry", "BitronixTransactionSynchronizationRegistry"),
BitronixTransactionSynchronizationRegistryObjectFactory.class.getName(),
null
);
}
代码示例来源:origin: com.github.marcus-nl.btm/btm
@Override
public Reference getReference() throws NamingException {
return new Reference(
BitronixTransactionManager.class.getName(),
new StringRefAddr("TransactionSynchronizationRegistry", "BitronixTransactionSynchronizationRegistry"),
BitronixTransactionSynchronizationRegistryObjectFactory.class.getName(),
null
);
}
代码示例来源:origin: com.atomikos/transactions-jta
/**
* @see javax.naming.Referenceable#getReference()
*/
public Reference getReference () throws NamingException
{
return new Reference ( getClass ().getName (), new StringRefAddr (
"name", "TransactionManager" ), TransactionManagerFactory.class
.getName (), null );
}
代码示例来源:origin: bitronix/btm
/**
* {@inheritDoc}
*/
@Override
public Reference getReference() throws NamingException {
return new Reference(EhCacheXAResourceProducer.class.getName(),
new StringRefAddr("uniqueName", getUniqueName()),
ResourceObjectFactory.class.getName(), null);
}
内容来源于网络,如有侵权,请联系作者删除!