FileDocCategorySizeDatePackage
AdministeredObjectResource.javaAPI DocGlassfish v2 API6489Fri May 04 22:34:22 BST 2007com.sun.enterprise.connectors

AdministeredObjectResource

public class AdministeredObjectResource extends com.sun.enterprise.repository.J2EEResourceBase implements Serializable
Resource infor for Connector administered objects
author
Qingqing Ouyang

Fields Summary
private String
resadapter_
private String
adminObjectClass_
private String
adminObjectType_
private Set
configProperties_
Constructors Summary
public AdministeredObjectResource(String name)

        super(name);
    
Methods Summary
public voidaddConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)

        this.configProperties_.add(configProperty);
    
public javax.naming.ReferencecreateAdminObjectReference()

        Reference ref = 
            new Reference(getAdminObjectType(),
                    new SerializableObjectRefAddr("jndiName", this),
                    ConnectorConstants.ADMINISTERED_OBJECT_FACTORY, null);
        
        return ref;
    
public java.lang.ObjectcreateAdministeredObject(java.lang.ClassLoader jcl)


        try {
            if (jcl == null) {
                // use context class loader
                jcl = (ClassLoader) AccessController.doPrivileged
                    (new PrivilegedAction() { 
                            public Object run() {
                                return 
                                    Thread.currentThread().getContextClassLoader();
                            }
                        });
            }
                
            
            Object adminObject = 
                jcl.loadClass(adminObjectClass_).newInstance();
            
            AccessController.doPrivileged
                (new SetMethodAction(adminObject, configProperties_));
            return adminObject;
        } catch (PrivilegedActionException ex) {
            throw (PoolingException) (new PoolingException().initCause(ex));
        } catch (Exception ex) {
            throw (PoolingException) (new PoolingException().initCause(ex));
        }

    
protected com.sun.enterprise.repository.J2EEResourcedoClone(java.lang.String name)

        AdministeredObjectResource clone = 
            new AdministeredObjectResource(name);
        clone.setResourceAdapter(getResourceAdapter());
        clone.setAdminObjectType(getAdminObjectType());
        return clone;
    
public java.lang.StringgetAdminObjectClass()

        return this.adminObjectClass_;
    
public java.lang.StringgetAdminObjectType()

        return adminObjectType_;
    
public java.lang.StringgetResourceAdapter()

        return resadapter_;
    
public intgetType()

        // FIX ME 
        return 0;
        //return J2EEResource.ADMINISTERED_OBJECT;
    
public voidinitialize(com.sun.enterprise.deployment.AdminObject desc)

        configProperties_ = new HashSet();
        adminObjectClass_ = desc.getAdminObjectClass();
        adminObjectType_ = desc.getAdminObjectInterface();
    
public voidremoveConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)
Add a configProperty to the set

        this.configProperties_.remove(configProperty);
    
public voidsetAdminObjectClass(java.lang.String name)

        this.adminObjectClass_ = name;
    
public voidsetAdminObjectType(java.lang.String adminObjectType)

        this.adminObjectType_ = adminObjectType;
    
public voidsetResourceAdapter(java.lang.String resadapter)

        resadapter_ = resadapter;
    
public java.lang.StringtoString()

        return "< Administered Object : " + getName() + 
            " , " + getResourceAdapter() +
            " , " + getAdminObjectType() + " >";