FileDocCategorySizeDatePackage
ResourceRef.javaAPI DocGlassfish v2 API5891Fri May 04 22:33:00 BST 2007org.apache.naming

ResourceRef

public class ResourceRef extends Reference
Represents a reference address to a resource.
author
Remy Maucherat
version
$Revision: 1.3 $ $Date: 2007/05/05 05:32:59 $

Fields Summary
public static final String
DEFAULT_FACTORY
Default factory for this reference.
public static final String
DESCRIPTION
Description address type.
public static final String
SCOPE
Scope address type.
public static final String
AUTH
Auth address type.
Constructors Summary
public ResourceRef(String resourceClass, String description, String scope, String auth)
Resource Reference.

param
resourceClass Resource class
param
scope Resource scope
param
auth Resource authetication



    // ----------------------------------------------------------- Constructors


                        
         
                           
        this(resourceClass, description, scope, auth, null, null);
    
public ResourceRef(String resourceClass, String description, String scope, String auth, String factory, String factoryLocation)
Resource Reference.

param
resourceClass Resource class
param
scope Resource scope
param
auth Resource authetication

        super(resourceClass, factory, factoryLocation);
        StringRefAddr refAddr = null;
        if (description != null) {
            refAddr = new StringRefAddr(DESCRIPTION, description);
            add(refAddr);
        }
        if (scope != null) {
            refAddr = new StringRefAddr(SCOPE, scope);
            add(refAddr);
        }
        if (auth != null) {
            refAddr = new StringRefAddr(AUTH, auth);
            add(refAddr);
        }
    
Methods Summary
public java.lang.StringgetFactoryClassName()
Retrieves the class name of the factory of the object to which this reference refers.

        String factory = super.getFactoryClassName();
        if (factory != null) {
            return factory;
        } else {
            factory = System.getProperty(Context.OBJECT_FACTORIES);
            if (factory != null) {
                return null;
            } else {
                return DEFAULT_FACTORY;
            }
        }
    
public java.lang.StringtoString()
Return a String rendering of this object.


        StringBuffer sb = new StringBuffer("ResourceRef[");
        sb.append("className=");
        sb.append(getClassName());
        sb.append(",factoryClassLocation=");
        sb.append(getFactoryClassLocation());
        sb.append(",factoryClassName=");
        sb.append(getFactoryClassName());
        Enumeration refAddrs = getAll();
        while (refAddrs.hasMoreElements()) {
            RefAddr refAddr = (RefAddr) refAddrs.nextElement();
            sb.append(",{type=");
            sb.append(refAddr.getType());
            sb.append(",content=");
            sb.append(refAddr.getContent());
            sb.append("}");
        }
        sb.append("]");
        return (sb.toString());