Example usage for javax.naming Reference Reference

List of usage examples for javax.naming Reference Reference

Introduction

In this page you can find the example usage for javax.naming Reference Reference.

Prototype

public Reference(String className, RefAddr addr, String factory, String factoryLocation) 

Source Link

Document

Constructs a new reference for an object with class name 'className', the class name and location of the object's factory, and the address for the object.

Usage

From source file:Bind.java

License:asdf

public Reference getReference() throws NamingException {
    String cName = Car.class.getName();
    StringRefAddr cRef = new StringRefAddr("Car Description", make + ":" + model);
    String cfName = "asdf";
    Reference ref = new Reference(cName, cRef, cfName, null);
    return ref;/*from  ww  w  .j  a  va  2s.  c om*/
}

From source file:net.chrisrichardson.foodToGo.ejb3.facadeWithSpringDI.SpringBeanReferenceInitializer.java

private void bind(InitialContext ctx, String jndiName, Class type, String beanName) throws NamingException {
    Reference reference = new Reference(type.getName(), new StringRefAddr("beanName", beanName),
            SpringObjectFactory.class.getName(), null);
    ctx.bind(jndiName, reference);/*  w ww  .  j  ava  2  s.c o  m*/
    jndiNames.add(jndiName);
    logger.debug("Bound it: " + jndiName);
}

From source file:Rebind.java

public Reference getReference() throws NamingException {

    return new Reference(Fruit.class.getName(), new StringRefAddr("fruit", fruit), FruitFactory.class.getName(),
            null); // factory location
}

From source file:NonSerializableFactory.java

/** A convenience method that simplifies the process of rebinding a
 non-serializable object into a JNDI context.
        /*from  w  ww  . j  ava 2s. c om*/
@param ctx the JNDI context to rebind to.
@param key the key to use in both the NonSerializableFactory map and JNDI. It
must be a valid name for use in ctx.bind().
@param target the non-Serializable object to bind.
@throws NamingException thrown on failure to rebind key into ctx.
*/
public static synchronized void rebind(Context ctx, String key, Object target) throws NamingException {
    NonSerializableFactory.rebind(key, target);
    // Bind a reference to target using NonSerializableFactory as the ObjectFactory
    String className = target.getClass().getName();
    String factory = NonSerializableFactory.class.getName();
    StringRefAddr addr = new StringRefAddr("nns", key);
    Reference memoryRef = new Reference(className, addr, factory, null);
    ctx.rebind(key, memoryRef);
}

From source file:org.hibernate.internal.SessionFactoryImpl.java

public Reference getReference() {
    // from javax.naming.Referenceable
    LOG.debug("Returning a Reference to the SessionFactory");
    return new Reference(SessionFactoryImpl.class.getName(), new StringRefAddr("uuid", uuid),
            SessionFactoryRegistry.ObjectFactoryImpl.class.getName(), null);
}

From source file:org.compass.core.impl.DefaultCompass.java

public Reference getReference() throws NamingException {
    return new Reference(DefaultCompass.class.getName(), new StringRefAddr("uuid", uuid),
            CompassObjectFactory.class.getName(), null);
}