Search in sources :

Example 11 with Referenceable

use of javax.naming.Referenceable in project jackrabbit by apache.

the class RepositoryImpl method getReference.

//------------------------------------------------------< Referenceable >---
/**
     * @see Referenceable#getReference()
     */
public Reference getReference() throws NamingException {
    if (config instanceof Referenceable) {
        Referenceable confref = (Referenceable) config;
        if (reference == null) {
            reference = new Reference(RepositoryImpl.class.getName(), RepositoryImpl.Factory.class.getName(), null);
            // carry over all addresses from referenceable config
            for (Enumeration<RefAddr> en = confref.getReference().getAll(); en.hasMoreElements(); ) {
                reference.add(en.nextElement());
            }
            // also add the information required by factory class
            reference.add(new StringRefAddr(Factory.RCF, confref.getReference().getFactoryClassName()));
            reference.add(new StringRefAddr(Factory.RCC, config.getClass().getName()));
        }
        return reference;
    } else {
        throw new javax.naming.OperationNotSupportedException("Contained RepositoryConfig needs to implement javax.naming.Referenceable");
    }
}
Also used : RefAddr(javax.naming.RefAddr) StringRefAddr(javax.naming.StringRefAddr) Referenceable(javax.naming.Referenceable) StringRefAddr(javax.naming.StringRefAddr) Reference(javax.naming.Reference)

Aggregations

Referenceable (javax.naming.Referenceable)11 Reference (javax.naming.Reference)9 Name (javax.naming.Name)6 NamingException (javax.naming.NamingException)6 Context (javax.naming.Context)5 InitialContext (javax.naming.InitialContext)5 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)5 NameNotFoundException (javax.naming.NameNotFoundException)5 Binding (javax.naming.Binding)4 CompoundName (javax.naming.CompoundName)4 NotContextException (javax.naming.NotContextException)4 OperationNotSupportedException (javax.naming.OperationNotSupportedException)4 IOException (java.io.IOException)2 CompositeName (javax.naming.CompositeName)2 NamingContext (org.eclipse.jetty.jndi.NamingContext)2 ServiceReference (org.osgi.framework.ServiceReference)2 LinkRef (javax.naming.LinkRef)1 RefAddr (javax.naming.RefAddr)1 StringRefAddr (javax.naming.StringRefAddr)1