Refine search
protected String getProperty(Reference ref, String s) { RefAddr addr = ref.get(s); if (addr == null) { return null; } return (String) addr.getContent(); }
@Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { // We only know how to deal with <code>javax.naming.Reference</code>s // that specify a class name of "javax.sql.DataSource" if ((obj == null) || !(obj instanceof Reference)) { return null; } Reference ref = (Reference) obj; if ((!"javax.sql.DataSource".equals(ref.getClassName())) // && (!"com.alibaba.druid.pool.DruidDataSource".equals(ref.getClassName())) // ) { return null; } Properties properties = new Properties(); for (int i = 0; i < ALL_PROPERTIES.length; i++) { String propertyName = ALL_PROPERTIES[i]; RefAddr ra = ref.get(propertyName); if (ra != null) { String propertyValue = ra.getContent().toString(); properties.setProperty(propertyName, propertyValue); } } return createDataSourceInternal(properties); }
private static String getReferenceProperty(Reference ref, String propertyName) { RefAddr addr = ref.get(propertyName); if (addr == null) { return null; } return (String) addr.getContent(); }
if (ref.getClassName().equals(JdbcDataSource.class.getName())) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL((String) ref.get("url").getContent()); dataSource.setUser((String) ref.get("user").getContent()); dataSource.setPassword((String) ref.get("password").getContent()); dataSource.setDescription((String) ref.get("description").getContent()); String s = (String) ref.get("loginTimeout").getContent(); dataSource.setLoginTimeout(Integer.parseInt(s)); return dataSource;
protected String getProperty(Reference ref, String s) { RefAddr addr = ref.get(s); if (addr == null) { return null; } return (String)addr.getContent(); }
if (ref.getClassName().equals(JdbcDataSource.class.getName())) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL((String) ref.get("url").getContent()); dataSource.setUser((String) ref.get("user").getContent()); dataSource.setPassword((String) ref.get("password").getContent()); dataSource.setDescription((String) ref.get("description").getContent()); String s = (String) ref.get("loginTimeout").getContent(); dataSource.setLoginTimeout(Integer.parseInt(s)); return dataSource;
@Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { Reference ref = (Reference) obj; RefAddr addr = ref.get("configPath"); return buildClient(addr.getContent().toString()); }
@Override public Object getObjectInstance(Object refObj, Name nm, Context ctx, Hashtable<?,?> env) throws Exception { final Reference ref = (Reference) refObj; final String className = ref.getClassName(); if (className != null && className.equals(DATASOURCE_CLASS_NAME)) { P6DataSource dataSource; try { dataSource = (P6DataSource) Class.forName(className).newInstance(); } catch (Exception ex) { throw new RuntimeException("Unable to create DataSource of " + "class '" + className + "': " + ex.toString()); } // name of the real datasource dataSource.setRealDataSource((String) ref.get("dataSourceName").getContent()); return dataSource; } else { // Who's class is this anyway, I ask ya! return null; } } }
@Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { Reference ref = (Reference) obj; RefAddr addr = ref.get("configPath"); return buildClient(addr.getContent().toString()); }
@Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { // We only know how to deal with <code>javax.naming.Reference</code>s // that specify a class name of "javax.sql.DataSource" if ((obj == null) || !(obj instanceof Reference)) { return null; } Reference ref = (Reference) obj; if ((!"javax.sql.DataSource".equals(ref.getClassName())) // && (!"com.alibaba.druid.pool.DruidDataSource".equals(ref.getClassName())) // ) { return null; } Properties properties = new Properties(); for (int i = 0; i < ALL_PROPERTIES.length; i++) { String propertyName = ALL_PROPERTIES[i]; RefAddr ra = ref.get(propertyName); if (ra != null) { String propertyValue = ra.getContent().toString(); properties.setProperty(propertyName, propertyValue); } } return createDataSourceInternal(properties); }
@Override public Object getObjectInstance(Object reference, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { LOG.debugf( "JNDI lookup: %s", name ); final String uuid = (String) ( (Reference) reference ).get( 0 ).getContent(); LOG.tracef( "Resolved to UUID = %s", uuid ); return INSTANCE.getSessionFactory( uuid ); } }
for (int i = 0; i < ALL_PROPERTIES.length; i++) { String propertyName = ALL_PROPERTIES[i]; RefAddr ra = ref.get(propertyName); if (ra != null) { String propertyValue = ra.getContent().toString(); properties.setProperty(propertyName, propertyValue);
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; }
private static javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { Reference ref = (Reference) resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { NamingException ne = IIOPLogger.ROOT_LOGGER.noReferenceFound(); ne.setRootCause(cpe.getRootCause()); throw ne; } } throw e; } }
protected String getProperty( final Reference ref, final String propName, final String defValue) { final RefAddr addr = ref.get(propName); if (addr == null) { return defValue; } return (String) addr.getContent(); } }
private void configure(Reference resourceRef) throws Exception { RefAddr maxActiveRefAddr = resourceRef.get("maxActive"); RefAddr retryDownedHostDelayInSeconds = resourceRef.get("retryDownedHostDelayInSeconds"); if ( hostsRefAddr == null || hostsRefAddr.getContent() == null) { throw new Exception("A url and port on which Cassandra is installed and listening " + "on must be provided as a ResourceParams in the context.xml"); cassandraHostConfigurator = new CassandraHostConfigurator((String)hostsRefAddr.getContent()); if ( autoDiscoverHosts != null ) { cassandraHostConfigurator.setAutoDiscoverHosts(Boolean.parseBoolean((String)autoDiscoverHosts.getContent())); if ( runAutoDiscoverAtStartup != null ) cassandraHostConfigurator.setRunAutoDiscoveryAtStartup(Boolean.parseBoolean((String)autoDiscoverHosts.getContent())); int retryDelay = Integer.parseInt((String)retryDownedHostDelayInSeconds.getContent()); cassandraHostConfigurator.setMaxActive(Integer.parseInt((String)maxActiveRefAddr.getContent())); if ( maxWaitTimeWhenExhausted != null ) cassandraHostConfigurator.setMaxWaitTimeWhenExhausted(Integer.parseInt((String)maxWaitTimeWhenExhausted.getContent())); if (maxExhaustedTimeBeforeMarkingAsDown != null) { cassandraHostConfigurator.setMaxExhaustedTimeBeforeMarkingAsDown(Integer.parseInt((String) maxExhaustedTimeBeforeMarkingAsDown.getContent())); log.debug("JNDI resource created with CassandraHostConfiguration: {}", cassandraHostConfigurator.getAutoDiscoverHosts()); cluster = HFactory.getOrCreateCluster((String)clusterNameRef.getContent(), cassandraHostConfigurator); keyspace = HFactory.createKeyspace((String)keyspaceNameRef.getContent(), cluster);
/** Restores the administered object from a naming reference. */ public void fromReference(Reference ref) throws NamingException { agentId = (String) ref.get("dest.agentId").getContent(); adminName = (String) ref.get("dest.adminName").getContent(); }
public static String getProperty(Reference ref, String name) { RefAddr addr = ref.get(name); if (addr == null) return null; Object value = addr.getContent(); return (String) value; }
public static String getProperty(Reference ref, String name) { RefAddr addr = ref.get(name); if (addr == null) return null; Object value = addr.getContent(); return (String) value; }
public static String getProperty(Reference ref, String name) { RefAddr addr = ref.get(name); if (addr == null) return null; Object value = addr.getContent(); return (String) value; }