[jboss-jira] [JBoss JIRA] Commented: (JBJCA-174) Rar deployer handles translation of a wrapper type configuration property to a primitave type on rar implimentations
John Bailey (JIRA)
jira-events at lists.jboss.org
Wed Sep 16 10:00:39 EDT 2009
[ https://jira.jboss.org/jira/browse/JBJCA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12486097#action_12486097 ]
John Bailey commented on JBJCA-174:
-----------------------------------
There was an attached patch that showed a possible solution in CSP ticket. It may have been intentionally left out of the ticket, but I will attach it just in case. Basically just created a handler that will check a set of know primitive alternatives for a given wrapper type. So if the ra.xml or *-ds.xml contains <config-properties> with wrapper types "java.lang.Integer" it will attempt to find the correct setter with the provided type, but will check against the primitive alternatives is the setter for the wrapper type is not found.
Ex.
private static Map<String, Class<?>> PRIMATIVE_TYPE_ALTERNATES = new HashMap<String, Class<?>>();
static
{
PRIMATIVE_TYPE_ALTERNATES.put(Boolean.class.getName(), Boolean.TYPE);
PRIMATIVE_TYPE_ALTERNATES.put(Integer.class.getName(), Integer.TYPE);
PRIMATIVE_TYPE_ALTERNATES.put(Short.class.getName(), Short.TYPE);
PRIMATIVE_TYPE_ALTERNATES.put(Long.class.getName(), Long.TYPE);
}
.....
private Method getMethod(String setterName, Class expectedPropertyType) throws NoSuchMethodException
{
Method method = null;
try
{
// Check to see if the method exists with the expected type
method = configTargetType.getMethod(setterName, new Class[] {expectedPropertyType});
}
catch (NoSuchMethodException nsme)
{
// Check to see if a primitive alternative is available
expectedPropertyType = PRIMATIVE_TYPE_ALTERNATES.get(expectedPropertyType.getName());
if (expectedPropertyType == null)
{
// No alternative to try
throw nsme;
}
// Check to see if a setter with the primitive alternative exists
method = configTargetType.getMethod(setterName, new Class[] {expectedPropertyType});
}
return method;
}
> Rar deployer handles translation of a wrapper type configuration property to a primitave type on rar implimentations
> --------------------------------------------------------------------------------------------------------------------
>
> Key: JBJCA-174
> URL: https://jira.jboss.org/jira/browse/JBJCA-174
> Project: JBoss JCA
> Issue Type: Feature Request
> Reporter: Mike Clark
> Assignee: Jesper Pedersen
>
> Some JCA rar's from third-party vendors implement config-property-type parameters as primitive types. However, in the ra.xml wrapper types are required. Deploying these rar's without modification could be possible if the rar deployer would automatically handle this conversion. Anytime a configuration property has a primitive type on the object implementation, it could allow the wrapper type to be used in the configuration files.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list