FileDocCategorySizeDatePackage
ConnectorConfigurationParserServiceImpl.javaAPI DocGlassfish v2 API15125Fri May 04 22:34:24 BST 2007com.sun.enterprise.connectors

ConnectorConfigurationParserServiceImpl

public class ConnectorConfigurationParserServiceImpl extends ConnectorServiceImpl
This is configuration parser service. Retrieves various configuration information from ra.xml
author
Srikanth P

Fields Summary
Constructors Summary
public ConnectorConfigurationParserServiceImpl()
Default constructor

         super();
     
Methods Summary
public java.lang.StringgetActivationSpecClass(java.lang.String rarName, java.lang.String messageListenerType)
Return the ActivationSpecClass name for given rar and messageListenerType

param
moduleDir The directory where rar is exploded.
param
messageListenerType MessageListener type
throws
ConnectorRuntimeException If moduleDir is null. If corresponding rar is not deployed.

        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            MessageListenerConfigParser messagelistenerConfigParser =
                 (MessageListenerConfigParser) 
                 ConnectorConfigParserFactory.getParser(
                 ConnectorConfigParser.MSL);
            return messagelistenerConfigParser.getActivationSpecClass(
                       desc,messageListenerType);
        } else {
            return null;
        }
    
public java.util.PropertiesgetAdminObjectConfigProps(java.lang.String rarName, java.lang.String adminObjectIntf)
Retrieves the admin object javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned.

param
rarName rar module name
return
admin object javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        return getConnectorConfigJavaBeans(
               rarName,adminObjectIntf,ConnectorConfigParser.AOR);
    
public java.lang.String[]getAdminObjectInterfaceNames(java.lang.String rarName)
Obtains all the Connection definition names of a rar

param
rarName rar moduleName
return
Array of connection definition names.


        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            AdminObjectConfigParser adminObjectConfigParser = 
                 (AdminObjectConfigParser) 
                 ConnectorConfigParserFactory.getParser(
                 ConnectorConfigParser.AOR);
            return adminObjectConfigParser.getAdminObjectInterfaceNames(desc);
        } else {
            return null;
        }
    
public java.lang.String[]getConnectionDefinitionNames(java.lang.String rarName)
Obtains all the Connection definition names of a rar

param
rarName rar moduleName
return
Array of connection definition names.


        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            MCFConfigParser mcfConfigParser = (MCFConfigParser) 
              ConnectorConfigParserFactory.getParser(ConnectorConfigParser.MCF);
            return mcfConfigParser.getConnectionDefinitionNames(desc);
        } else {
            return null;
        } 
    
public java.util.PropertiesgetConnectorConfigJavaBeans(java.lang.String rarName, java.lang.String connectionDefName, java.lang.String type)
Retrieves the XXX javabean properties with default values. The javabean to introspect/retrieve is specified by the type. The default values will be the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned.

param
rarName rar module name
return
admin object javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.


        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            ConnectorConfigParser ccParser = 
                     ConnectorConfigParserFactory.getParser(type);
            return ccParser.getJavaBeanProps(desc,connectionDefName, rarName);
        } else {
            return null;
        }
    
public java.util.PropertiesgetMCFConfigProps(java.lang.String rarName, java.lang.String connectionDefName)
Retrieves the MCF javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned.

param
rarName rar module name
return
managed connection factory javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        Properties props = getConnectorConfigJavaBeans(
               rarName,connectionDefName,ConnectorConfigParser.MCF);
	if (rarName.equals(ConnectorConstants.DEFAULT_JMS_ADAPTER)) {
            props.remove(ActiveJmsResourceAdapter.ADDRESSLIST);
	}
        return props;
    
public java.util.PropertiesgetMessageListenerConfigPropTypes(java.lang.String rarName, java.lang.String messageListenerType)
Returns the Properties object consisting of propertyname as the key and datatype as the value.

param
rarName name of the rar module.
param
messageListenerType message listener type.It is uniqie across all sub-elements in element in a given rar.
return
Properties object with the property names(key) and datatype of property(as value).
throws
ConnectorRuntimeException if either of the parameters are null. If corresponding rar is not deployed i.e moduleDir is invalid. If messagelistener type is not found in ra.xml

        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            MessageListenerConfigParser messagelistenerConfigParser =
                (MessageListenerConfigParser) 
                ConnectorConfigParserFactory.getParser(
                ConnectorConfigParser.MSL);
            return messagelistenerConfigParser.getJavaBeanReturnTypes(
                    desc, messageListenerType);
        } else {
            return null;
        }
    
public java.util.PropertiesgetMessageListenerConfigProps(java.lang.String rarName, java.lang.String messageListenerType)
Parses the ra.xml for the ActivationSpec javabean properties. The ActivationSpec to be parsed is identified by the moduleDir where ra.xml is present and the message listener type. message listener type 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 message listener type mentioned as parameter is not found in ra.xml. If rar is deployed and message listener (type mentioned) is present but no properties are present for the corresponding message listener, null is returned.

param
rarName name of the rar module.
param
messageListenerType message listener type.It is uniqie across all sub-elements in element in a given rar.
return
Javabean properties with the property names and values of properties. 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 messagelistener type is not found in ra.xml

        return getConnectorConfigJavaBeans(
               rarName,messageListenerType,ConnectorConfigParser.MSL);
    
public java.lang.String[]getMessageListenerTypes(java.lang.String rarName)

        ConnectorDescriptor desc = getConnectorDescriptor(rarName);
        if(desc != null) {
            MessageListenerConfigParser messagelistenerConfigParser =
                (MessageListenerConfigParser) 
                ConnectorConfigParserFactory.getParser(
                ConnectorConfigParser.MSL);
            return messagelistenerConfigParser.getMessageListenerTypes(desc);
        } else {
            return null;
        }
    
public java.util.MapgetRABeanProperties(java.lang.String pathToDeployableUnit)
Finds the properties of a RA JavaBean bundled in a RAR without exploding the RAR

param
pathToDeployableUnit a physical,accessible location of the connector module. [either a RAR for RAR-based deployments or a directory for Directory based deployments]
return
A Map that is of An empty map is returned in the case of a 1.0 RAR

        return RARUtils.getRABeanProperties(pathToDeployableUnit);
    
public java.util.PropertiesgetResourceAdapterConfigProps(java.lang.String rarName)
Retrieves the Resource adapter javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned.

param
rarName rar module name
return
Resource adapter javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        return getConnectorConfigJavaBeans(
               rarName,null,ConnectorConfigParser.RA);
    
public java.lang.StringgetSecurityPermissionSpec(java.lang.String moduleName)
Obtains the Permission string that needs to be added to the to the security policy files. These are the security permissions needed by the resource adapter implementation classes. These strings are obtained by parsing the ra.xml

param
moduleName rar module Name
ConnectorRuntimeException
If rar.xml parsing fails.


        if(moduleName == null) {
            return null;
        }
        ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(
                                 moduleName);
        Set securityPermissions = connectorDescriptor.getSecurityPermissions();
        Iterator it = securityPermissions.iterator();
        String policyString = null;
        SecurityPermission secPerm = null; 
        String permissionString=null;
        while(it.hasNext()){
            secPerm = (SecurityPermission) it.next();
            permissionString = secPerm.getPermission();
            if(permissionString != null) {
                policyString = policyString+"\n \n"+permissionString;
            }
        }
        if(policyString != null) {
            policyString= CAUTION_MESSAGE+policyString;
        } 
        return policyString;