Spring Framework JndiTemplate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework JndiTemplate class.

This code example shows how to use the following methods:
	/** 
	 * Construct a new JndiTemplate that will always return given objects 
	 * for given names. To be populated through {@code addObject} calls. 
	 * @see #addObject(String, Object) 
	 */ 
	public ExpectedLookupTemplate() { 
	} 
 
	/** 
	 * Construct a new JndiTemplate that will always return the 
	 * given object, but honour only requests for the given name. 
	 * @param name the name the client is expected to look up 
	 * @param object the object that will be returned 
	 */ 
	public ExpectedLookupTemplate(String name, Object object) {
		addObject(name, object);
	} 
 
 
	/** 
6
CodeRank
This code example shows how to use the following methods:
 * @see JndiRmiProxyFactoryBean 
 * @see javax.rmi.PortableRemoteObject#exportObject 
 */ 
public class JndiRmiServiceExporter extends RmiBasedExporter implements InitializingBean, DisposableBean {
 
	private JndiTemplate jndiTemplate = new JndiTemplate();
 
	private String jndiName;
 
	private Remote exportedObject;
 
 
	/** 
	 * Set the JNDI template to use for JNDI lookups. 
	 * You can also specify JNDI environment settings via "jndiEnvironment". 
	 * @see #setJndiEnvironment 
	 */ 
	public void setJndiTemplate(JndiTemplate jndiTemplate) {
		this.jndiTemplate = (jndiTemplate != null ? jndiTemplate : new JndiTemplate());
	} 
6
CodeRank
This code example shows how to use the following methods:lookup
        this.template = template;
    } 
 
    @Override 
    public <T> T lookup(String name, Class<T> clazz) throws NamingException {
        return template.lookup(name, clazz);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
 
    public ContextLoaderListener() 
    { 
        try 
        { 
            this.enableStartup = (Boolean) new JndiTemplate().lookup(ContextLoaderListener.PROPERTY_ENABLE_STARTUP, 
                    Boolean.class); 
        } 
        catch (Exception e) 
        { 
            this.enableStartup = true; 
        } 
    } 
 
    @Override 
    public void contextInitialized(ServletContextEvent event) 
    { 
        if (this.enableStartup) 
        { 
            super.contextInitialized(event); 
4
CodeRank
This code example shows how to use the following methods:
 *  
 * @author dward 
 */ 
public class JndiPropertiesFactoryBean extends SystemPropertiesFactoryBean 
{ 
    private JndiTemplate jndiTemplate = new JndiTemplate();
 
    @Override 
    protected void resolveMergedProperty(String propertyName, Properties props)
    { 
        try 
        { 
            Object value = this.jndiTemplate.lookup("java:comp/env/properties/" + propertyName);
            if (value != null)
            { 
                String stringValue = value.toString();
                if (stringValue.length() > 0)
                { 
                    // Unfortunately, JBoss 4 wrongly expects every env-entry declared in web.xml to have an 
                    // env-entry-value (even though these are meant to be decided on deployment!). So we treat the empty 
4
CodeRank
This code example shows how to use the following methods:
 *  
 * @author dward 
 */ 
public class JndiPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer
{ 
    private JndiTemplate jndiTemplate = new JndiTemplate();
 
    @Override 
    protected String resolvePlaceholder(String placeholder, Properties props)
    { 
        String result = null;
        try 
        { 
            Object value = this.jndiTemplate.lookup("java:comp/env/properties/" + placeholder);
            if (value != null)
            { 
                result = value.toString();
            } 
        } 
        catch (NamingException e)
5
CodeRank
This code example shows how to use the following methods:
 * @since 2.0.0 
 *  
 */ 
public class JndiAddressProvider extends DefaultAddressProvider implements InitializingBean {
 
    private final JndiTemplate jndiTemplate = new JndiTemplate();
 
    @Getter 
    @Setter 
    private String jndiKey;
 
    public JndiAddressProvider() { 
 
    } 
 
    public JndiAddressProvider(final String jndiKey, final String address) { // NO_UCD
        super(address);
        this.jndiKey = jndiKey;
    } 
 
4
CodeRank
This code example shows how to use the following methods:
 * @since 1.1 
 *  
 * @see JndiObjectLocator 
 */ 
public class JndiLookupTargetRegistry<T> extends JndiLocatorSupport implements TargetRegistry<T> {
 
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
    private String prefix = "";
 
    private String suffix = "";
 
    /** 
     * {@inheritDoc} 
     *  
     * @see #lookup(String) 
     */ 
    @SuppressWarnings("unchecked") 
    public T getTarget(final String context) {
        T target = null;
4
CodeRank
This code example shows how to use the following methods:setEnvironment
				if (jtEnv != null && jtEnv != env) {
					jtEnv.putAll(env);
					env.putAll(jtEnv);
				} 
			} else  { 
				jt = new JndiTemplate();
				jmsConfiguration.setJndiTemplate(jt);
			} 
			jt.setEnvironment(env);
		} 
	} 
 
	private String getProperty(String key) {
		String result = null;
		if (workPrefix != null) {
			result = configuration.getProperty(workPrefix + key);
		} 
		return result == null ? configuration.getProperty(key) : result;
	} 
 
4
CodeRank
This code example shows how to use the following methods:
	 */ 
	public static final String DEFAULT_TRANSACTION_SYNCHRONIZATION_REGISTRY_NAME =
			"java:comp/TransactionSynchronizationRegistry"; 
 
 
	private transient JndiTemplate jndiTemplate = new JndiTemplate();
 
	private transient UserTransaction userTransaction;
 
	private String userTransactionName;
 
	private boolean autodetectUserTransaction = true;
 
	private boolean cacheUserTransaction = true;
 
	private boolean userTransactionObtainedFromJndi = false;
 
	private transient TransactionManager transactionManager;
 
	private String transactionManagerName;
1
CodeRank
See Code Examples for Spring Framework JndiTemplate Methods: