use of javax.naming.StringRefAddr in project wildfly by wildfly.
the class ObjectFactoryBuilder method lookForURLs.
static ObjectFactory lookForURLs(Reference ref, Hashtable environment) throws NamingException {
for (int i = 0; i < ref.size(); i++) {
RefAddr addr = ref.get(i);
if (addr instanceof StringRefAddr && addr.getType().equalsIgnoreCase("URL")) {
String url = (String) addr.getContent();
ObjectFactory answer = processURL(url, environment);
if (answer != null) {
return answer;
}
}
}
return null;
}
use of javax.naming.StringRefAddr in project wildfly by wildfly.
the class NamingContextTestCase method bindListWithContinuations.
private void bindListWithContinuations() throws NamingException {
final Name name = new CompositeName("test/test");
final Object object = new Object();
namingStore.bind(name, object);
final Name nameTwo = new CompositeName("test/testTwo");
final Object objectTwo = new Object();
namingStore.bind(nameTwo, objectTwo);
final Name nameThree = new CompositeName("test/testThree");
final Object objectThree = new Object();
namingStore.bind(nameThree, objectThree);
final Reference reference = new Reference(String.class.getName(), new StringRefAddr("nns", "test"), TestObjectFactoryWithNameResolution.class.getName(), null);
namingStore.bind(new CompositeName("comp"), reference);
}
use of javax.naming.StringRefAddr in project wildfly by wildfly.
the class NamingContextTestCase method testLookupWithContinuation.
@Test
public void testLookupWithContinuation() throws Exception {
namingStore.bind(new CompositeName("comp/nested"), "test");
final Reference reference = new Reference(String.class.getName(), new StringRefAddr("nns", "comp"), TestObjectFactoryWithNameResolution.class.getName(), null);
namingStore.bind(new CompositeName("test"), reference);
Object result = namingContext.lookup(new CompositeName("test/nested"));
assertEquals("test", result);
//the same with security permissions
result = testActionPermission(JndiPermission.ACTION_LOOKUP, Arrays.asList(new JndiPermission("comp/nested", "lookup")), namingContext, "test/nested");
assertEquals("test", result);
}
use of javax.naming.StringRefAddr in project datanucleus-rdbms by datanucleus.
the class SharedPoolDataSource method getReference.
/**
* Returns a <code>SharedPoolDataSource</code> {@link Reference}.
*/
@Override
public Reference getReference() throws NamingException {
Reference ref = new Reference(getClass().getName(), SharedPoolDataSourceFactory.class.getName(), null);
ref.add(new StringRefAddr("instanceKey", getInstanceKey()));
return ref;
}
use of javax.naming.StringRefAddr in project datanucleus-rdbms by datanucleus.
the class DriverAdapterCPDS method getReference.
// ----------------------------------------------------------------------
// Referenceable implementation
/**
* <CODE>Referenceable</CODE> implementation.
*/
@Override
public Reference getReference() throws NamingException {
// this class implements its own factory
String factory = getClass().getName();
Reference ref = new Reference(getClass().getName(), factory, null);
ref.add(new StringRefAddr("description", getDescription()));
ref.add(new StringRefAddr("driver", getDriver()));
ref.add(new StringRefAddr("loginTimeout", String.valueOf(getLoginTimeout())));
ref.add(new StringRefAddr("password", getPassword()));
ref.add(new StringRefAddr("user", getUser()));
ref.add(new StringRefAddr("url", getUrl()));
ref.add(new StringRefAddr("poolPreparedStatements", String.valueOf(isPoolPreparedStatements())));
ref.add(new StringRefAddr("maxIdle", String.valueOf(getMaxIdle())));
ref.add(new StringRefAddr("timeBetweenEvictionRunsMillis", String.valueOf(getTimeBetweenEvictionRunsMillis())));
ref.add(new StringRefAddr("numTestsPerEvictionRun", String.valueOf(getNumTestsPerEvictionRun())));
ref.add(new StringRefAddr("minEvictableIdleTimeMillis", String.valueOf(getMinEvictableIdleTimeMillis())));
ref.add(new StringRefAddr("maxPreparedStatements", String.valueOf(getMaxPreparedStatements())));
return ref;
}
Aggregations