FileDocCategorySizeDatePackage
ConnectorDescriptorInfo.javaAPI DocGlassfish v2 API15565Tue Jul 31 04:33:34 BST 2007com.sun.enterprise.connectors

ConnectorDescriptorInfo

public final class ConnectorDescriptorInfo extends Object implements Serializable
This class abstract the ra.xml values pertaining to the connection management. It contains various config properties of MCF, Resource adapter, Connection and also their respective classes and interfaces.
author
Srikanth P

Fields Summary
protected String
rarName_
protected String
resourceAdapterClass_
protected String
connectionDefinitionName_
protected String
managedConnectionFactoryClass_
protected String
connectionFactoryClass_
protected String
connectionFactoryInterface_
protected String
connectionClass_
protected String
connectionInterface_
protected Set
mcfConfigProperties_
protected Set
resourceAdapterConfigProperties_
private static final Logger
_logger
Constructors Summary
public ConnectorDescriptorInfo()
Default constructor


            

      

        mcfConfigProperties_ = new HashSet();
        resourceAdapterConfigProperties_ = new HashSet();
    
public ConnectorDescriptorInfo(com.sun.enterprise.deployment.EnvironmentProperty[] mcfConfigProperties, com.sun.enterprise.deployment.EnvironmentProperty[] resourceAdapterConfigProperties)
Constructor

param
mcfConfigProperties Array of MCF config properties
resourceAdapterConfigProperties
Array of Resource adapter config props

        mcfConfigProperties_ = new HashSet();
        resourceAdapterConfigProperties_ = new HashSet();
        if(mcfConfigProperties != null) {
            for(int i=0; i<mcfConfigProperties.length; ++i) {
                mcfConfigProperties_.add(mcfConfigProperties[i]);
            }
        }
        if(resourceAdapterConfigProperties != null) {
            for(int i=0; i<mcfConfigProperties.length; ++i) {
                resourceAdapterConfigProperties_.add(mcfConfigProperties[i]);
            }
        }
    
Methods Summary
public voidaddMCFConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)
Adds an MCF config property to the existing array/Set of MCF config properties.

configProperty
Config property to be added.

        if(configProperty != null) {
            mcfConfigProperties_.add(configProperty);
        }
    
public voidaddResourceAdapterConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)
Adds a Resource Adapter config property to the existing array/Set of Resource Adapter config properties.

configProperty
Config property to be added.

        if(configProperty != null) {
            resourceAdapterConfigProperties_.add(configProperty);
        }
    
public com.sun.enterprise.connectors.util.ConnectionPoolReconfigHelper.ReconfigActioncompareMCFConfigProperties(com.sun.enterprise.connectors.ConnectorDescriptorInfo cdi)
Compare the MCF Config properties in this object with the passed ones

param
cdi - The ConnDescInfo object whose MCF config props are to to be comapred against our props
return
true - if the config properties are the same false otherwise

        return compareMCFConfigProperties( cdi, new HashSet() );
    
public com.sun.enterprise.connectors.util.ConnectionPoolReconfigHelper.ReconfigActioncompareMCFConfigProperties(com.sun.enterprise.connectors.ConnectorDescriptorInfo cdi, java.util.Set excluded)
Compare the MCF Config properties in this object with the passed ones. The properties in the Set of excluded properties are not compared against

param
cdi - The ConnDescInfo object whose MCF config props are to to be comapred against our props
return
true - if the config properties are the same false otherwise

        Set mcfConfigProps = cdi.getMCFConfigProperties();

        if (mcfConfigProps.size() != mcfConfigProperties_.size() ) {
            //return false;
	    //Cannot determine anything due to size disparity - assume restart
	    return ReconfigAction.RECREATE_POOL;
        }
    
        boolean same = false;
        Iterator iter = mcfConfigProps.iterator();
    
        while( iter.hasNext() ) {
            EnvironmentProperty prop = (EnvironmentProperty)iter.next();
            //see if this property is in our list of excludes
            if (excluded.contains( prop.getName()) ) {
                //_logger.finest("mcfProp ignored : " + prop.getName() );
                continue;
            }
	    
            Iterator iter2 = mcfConfigProperties_.iterator();
            while( iter2.hasNext() ) {
                if(isEnvPropEqual(prop,(EnvironmentProperty)iter2.next())){
                    //we have a match
                    same = true;
                    //_logger.finest("mcfprop matched : " + prop.getName());
                    break;
                }
            }
            if (! same ) {
                //_logger.finest("mcfprop not matched : " + prop.getName() );
                //return false;
		return ReconfigAction.RECREATE_POOL;
            }
            same = false;
        }

        return ReconfigAction.NO_OP;
    
public com.sun.enterprise.connectors.ConnectorDescriptorInfodoClone()
Clone method

return
ConnectorDescriptorInfo instance


        ConnectorDescriptorInfo cdi = new ConnectorDescriptorInfo();
        cdi.setMCFConfigProperties(mcfConfigProperties_);
        cdi.setResourceAdapterConfigProperties(
                       resourceAdapterConfigProperties_);
        cdi.setRarName(rarName_);
        cdi.setResourceAdapterClassName(resourceAdapterClass_);
        cdi.setConnectionDefinitionName(connectionDefinitionName_);
        cdi.setManagedConnectionFactoryClass(managedConnectionFactoryClass_);
        cdi.setConnectionFactoryClass(connectionFactoryClass_);
        cdi.setConnectionFactoryInterface(connectionFactoryInterface_);
        cdi.setConnectionClass(connectionClass_);
        cdi.setConnectionInterface(connectionInterface_);
        return cdi;
    
public java.lang.StringgetConnectionClass()
Getter method for ConnectionClass property

return
connection class

        return connectionClass_;
    
public java.lang.StringgetConnectionDefinitionName()
Getter method for ConnectionDefinitionName property

return
connection definition name

        return connectionDefinitionName_;
    
public java.lang.StringgetConnectionFactoryClass()
Getter method for ConnectionFactoryClass property

return
connection factory class

        return connectionFactoryClass_;
    
public java.lang.StringgetConnectionFactoryInterface()
Getter method for ConnectionFactoryInterface property

return
connection factory interface class

        return connectionFactoryInterface_;
    
public java.lang.StringgetConnectionInterface()
Getter method for ConnectionInterface property

return
connectionInterface class

        return connectionInterface_;
    
public java.util.SetgetMCFConfigProperties()
Getter method for MCFConfigProperties property

return
Set of managed connection factory config properties

        return mcfConfigProperties_;
    
public java.lang.StringgetManagedConnectionFactoryClass()
Getter method for ManagedConnectionFactoryClass property

return
managed connection factory class

        return managedConnectionFactoryClass_;
    
public java.lang.StringgetRarName()
Getter method for RarName property

return
rarName

        return rarName_;
    
public java.lang.StringgetResourceAdapterClassName()
Getter method for ResourceAdapterClassName property

return
Resource adapter class name

        return resourceAdapterClass_;
    
public java.util.SetgetResourceAdapterConfigProperties()
Getter method for ResourceAdapterConfigProperties property

return
Set of resource adapter config properties

        return resourceAdapterConfigProperties_;
    
private booleanisEnvPropEqual(com.sun.enterprise.deployment.EnvironmentProperty e1, com.sun.enterprise.deployment.EnvironmentProperty e2)
The EnvironmentProperty::equals method only checks for name equality So we need to write a custom equals

        if (e1 != null && e2 != null &&
	    e1.getName() != null && e2.getName() != null &&
	    e1.getName().equals( e2.getName())) {
            if (e1.getValue() != null && e2.getValue() != null &&
                       e1.getValue().equals( e2.getValue() ) ) {
                return true;
            }
        } 
        /* 
        _logger.finest("isEnvPropEqual:: " + e1.getName()+"+"+e1.getValue()+
        " -- "+e2.getName() + "+"+e2.getValue());
	*/
             
        return false;
    
public voidremoveMCFConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)
Removes an config property from the existing array/Set of MCF config properties

param
configProperty Config property to be removed.

        if(configProperty != null) {
            mcfConfigProperties_.remove(configProperty);
        }
    
public voidremoveResourceAdapterConfigProperty(com.sun.enterprise.deployment.EnvironmentProperty configProperty)
Removes a Resource Adapter config property to the existing array/Set of Resource Adapter config properties.

configProperty
Config property to be removed.

        if(configProperty != null) {
            resourceAdapterConfigProperties_.remove(configProperty);
        }
    
public voidsetConnectionClass(java.lang.String connectionClass)
Setter method for ConnectionClass property

param
connectionClass connection Class

        connectionClass_ = connectionClass;
    
public voidsetConnectionDefinitionName(java.lang.String connectionDefinitionName)
Setter method for ConnectionDefinitionName property

param
connectionDefinitionName connection definition name

        connectionDefinitionName_ = connectionDefinitionName;
    
public voidsetConnectionFactoryClass(java.lang.String connectionFactoryClass)
Setter method for ConnectionFactoryClass property

param
connectionFactoryClass connection factory class

        connectionFactoryClass_ = connectionFactoryClass;
    
public voidsetConnectionFactoryInterface(java.lang.String connectionFactoryInterface)
Setter method for ConnectionFactoryInterface property

param
connectionFactoryInterface connection factory interface class

        connectionFactoryInterface_ =  connectionFactoryInterface;
    
public voidsetConnectionInterface(java.lang.String connectionInterface)
Setter method for ConnectionInterface property

param
connectionInterface connection interface class

        connectionInterface_ = connectionInterface;
    
public voidsetMCFConfigProperties(java.util.Set configProperties)
Setter method for MCFConfigProperties property.

param
configProperties Set MCF config properties

        mcfConfigProperties_ = configProperties;
    
public voidsetMCFConfigProperties(com.sun.enterprise.deployment.EnvironmentProperty[] configProperties)
Setter method for MCFConfigProperties property.

param
configProperties Array of MCF config properties

        if(configProperties != null) {
            for(int i=0; i<configProperties.length; ++i) {
                mcfConfigProperties_.add(configProperties[i]);
            }
        }
    
public voidsetManagedConnectionFactoryClass(java.lang.String managedConnectionFactoryClass)
Setter method for ManagedConnectionFactoryClass property

param
managedConnectionFactoryClass managed connection factory class

        managedConnectionFactoryClass_ = managedConnectionFactoryClass;
    
public voidsetRarName(java.lang.String rarName)
Setter method for RarName property

param
rarName rar name

        rarName_ = rarName;
    
public voidsetResourceAdapterClassName(java.lang.String resourceAdapterClass)
Setter method for ResourceAdapterClassName property

param
resourceAdapterClass Resource adapter class name

        resourceAdapterClass_ = resourceAdapterClass;
    
public voidsetResourceAdapterConfigProperties(java.util.Set configProperties)
Setter method for ResourceAdapterConfigProperties property.

param
configProperties Set ResourceAdapter config properties

        resourceAdapterConfigProperties_ = configProperties;
    
public voidsetResourceAdapterConfigProperties(com.sun.enterprise.deployment.EnvironmentProperty[] configProperties)
Setter method for ResourceAdapterConfigProperties property.

param
configProperties Array ResourceAdapter config properties

        if(configProperties != null) {
            for(int i=0; i<configProperties.length; ++i) {
                resourceAdapterConfigProperties_.add(configProperties[i]);
            }
        }