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) 

Source Link

Document

Constructs a new reference for an object with class name 'className' and an address.

Usage

From source file:org.jahia.services.content.JCRStoreProvider.java

protected Repository getRepositoryByRMI() {
    Repository instance = null;//from  ww  w . j a  v  a 2 s  . c o m
    try {
        Class<? extends ObjectFactory> factoryClass = Class.forName(factory).asSubclass(ObjectFactory.class);
        ObjectFactory factory = (ObjectFactory) factoryClass.newInstance();
        instance = (Repository) factory.getObjectInstance(
                new Reference(Repository.class.getName(), new StringRefAddr("url", url)), null, null, null);
        logger.info("Repository {} acquired via RMI", getKey());
    } catch (Exception e) {
        logger.error("Cannot get by RMI", e);
    }
    return instance;
}