/* Generated by Together */

package cobalt.deployment.descriptor.dist;

import java.util.Properties;

import cobalt.deployment.descriptor.EjbDescriptor;
import cobalt.deployment.descriptor.ResourceReferenceDescriptor;

/**
 * Title:        J2EE resource reference descriptor
 * Description:  Represents J2EE-specific resource reference descriptor for standard resource reference
 * Copyright:    Copyright (c) 2001
 * Company:      ETRI
 * @author Yeon Jun Choi
 * @version 1.0
 */

public class J2eeResourceReferenceDescriptor {
    public J2eeResourceReferenceDescriptor(EjbDescriptor ejb, ResourceReferenceDescriptor res) {
		this.ejb = ejb;
        this.resource = res;
        values = new Properties();
    }

    public String getResourceName() {
        return resource.getName();
    }

    public ResourceReferenceDescriptor getResource(){ return resource; }

    public void setResource(ResourceReferenceDescriptor resource){ this.resource = resource; }

    public String getJndiName(){ return resource.getJndiName();/*jndiName;*/ }

    public void setJndiName(String jndiName){ resource.setJndiName(jndiName);/*this.jndiName = jndiName;*/ }

    public String getName(){ return values.getProperty("name"); }

    public void setName(String name){ values.setProperty("name", name); }

    public String getPassword(){ return values.getProperty("password"); }

    public void setPassword(String password){ values.setProperty("password", password); }

    public String getMailFrom(){ return values.getProperty("mail-from"); }

    public void setMailFrom(String mailFrom){ values.setProperty("mail-from", mailFrom); }

    public String getMailHost(){ return values.getProperty("mail-host"); }

    public void setMailHost(String mailHost){ values.setProperty("mail-host", mailHost); }

    public String get(String obj) {
        return values.getProperty(obj);
    }

    public void set(String obj, String value) {
        values.setProperty(obj, value);
    }

    public EjbDescriptor getEjb(){
            return ejb;
        }

    public void setEjb(EjbDescriptor ejb){
            this.ejb = ejb;
        }

	public String getEjbName() {
        return ejb.getEjbName();
    }

    public String getResourceType() {
        return resource.getType();
    }

    private ResourceReferenceDescriptor resource;
    //private String jndiName;
    private Properties values; // default_principal_name, password,
                               // mail-name, mail-from, mail-to

    private EjbDescriptor ejb;
}
