Refine search
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; }
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; }
/** * 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; }
/** * 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; }
/** * @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; }
/** * 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; }
/** * 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; } }
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));
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; }
/** * 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; }
/** * 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; }
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; }
@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; }
@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()); } }
/** * 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 ? }
/** 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)); }
/** 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)); }
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; }
@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; }
/** 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)); }