FileDocCategorySizeDatePackage
MCFConfigParserImpl.javaAPI DocGlassfish v2 API7796Fri May 04 22:34:26 BST 2007com.sun.enterprise.connectors.util

MCFConfigParserImpl

public class MCFConfigParserImpl extends Object implements MCFConfigParser
This is managed connection factory configuration parser. It parses the ra.xml file for the managed connection factory specific configurations like managed connection factory javabean properties .
author
Srikanth P

Fields Summary
static Logger
_logger
Constructors Summary
public MCFConfigParserImpl()
Default constructor.

   
            

      

    
Methods Summary
public java.lang.String[]getConnectionDefinitionNames(ConnectorDescriptor desc)


        if(desc == null) {
            throw new ConnectorRuntimeException("Invalid arguments");
        }

        ConnectionDefDescriptor cdd[] = ddTransformUtil.getConnectionDefs(desc);

        String[] connDefNames = null;
        if(cdd != null) {
            connDefNames = new String[cdd.length];
            for(int i=0;i<cdd.length;++i) {
                connDefNames[i] = cdd[i].getConnectionFactoryIntf();
            }
        }
        return connDefNames;
    
public java.util.PropertiesgetJavaBeanProps(ConnectorDescriptor desc, java.lang.String connectionDefName, java.lang.String rarName)
Parses the ra.xml for the managed connection factory javabean properties. The managed connection factory to be parsed is identified by the moduleDir where ra.xml is present and the connection definition name . Connection definition name will be unique in a given ra.xml. It throws ConnectorRuntimeException if either or both the parameters are null, if corresponding rar is not deployed, if no connection definition name is found in ra.xml. If rar is deployed and connection definition name is present but no properties are present for the corresponding connection definition name, null is returned.

param
desc ConnectorDescriptor pertaining to rar.
param
connectionDefName connection definition name which is unique across all the elements in a given rar.
return
Javabean properties with the propety names and values of propeties. The property values will be the values mentioned in ra.xml if present. Otherwise it will be the default values obtained by introspecting the javabean. In both the case if no value is present, empty String is returned as the value.
throws
ConnectorRuntimeException if either of the parameters are null. If corresponding rar is not deployed i.e moduleDir is invalid. If no connection definition name is found in ra.xml


        if(desc == null || connectionDefName == null) {
            throw new ConnectorRuntimeException("Invalid arguments");
        }
        OutboundResourceAdapter ora = 
                      desc.getOutboundResourceAdapter();
        if(ora == null || ora.getConnectionDefs().size() == 0) {
            return null;
        }
        Set connectionDefs = ora.getConnectionDefs();
        if(connectionDefs== null || connectionDefs.size() == 0) {
            return null;
        }
        Iterator iter = connectionDefs.iterator();
        ConnectionDefDescriptor cdd = null;
        boolean connectionDefFound=false;
        while(iter.hasNext()) {
            cdd = (ConnectionDefDescriptor)iter.next();
            if(connectionDefName.equals(cdd.getConnectionFactoryIntf())) {
                connectionDefFound=true;
                break;
            }
        }

        if(connectionDefFound == false) {
            _logger.log(Level.FINE,
                    "No such connectiondefinition found in ra.xml", 
                    connectionDefName);
            throw new ConnectorRuntimeException(
                  "No such connectiondefinition found in ra.xml : " + 
                  connectionDefName);
        }

        /* ddVals           -> Properties present in ra.xml
        *  introspectedVals -> All properties with values
        *                      obtained by introspection of resource
        *                      adapter javabean
        *  mergedVals       -> merged props of raConfigPros and
        *                      allraConfigPropsWithDefVals
        */

        Properties mergedVals = null;
        Set ddVals = cdd.getConfigProperties();
        String className = cdd.getManagedConnectionFactoryImpl();
        if(className != null && className.length() != 0) {
            Properties introspectedVals = configParserUtil.introspectJavaBean(
                               className,ddVals, true, rarName);
            mergedVals = configParserUtil.mergeProps(ddVals,introspectedVals);
        }
        return mergedVals;