[jboss-jira] [JBoss JIRA] Commented: (JGRP-1068) Add programmer assigned default processing to @Property annotations
Richard Achmatowicz (JIRA)
jira-events at lists.jboss.org
Fri Oct 2 10:29:49 EDT 2009
[ https://jira.jboss.org/jira/browse/JGRP-1068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12488246#action_12488246 ]
Richard Achmatowicz commented on JGRP-1068:
-------------------------------------------
I implemented the default processing we have been discussing tonight.
It's pretty simple. I moved sanityCheck out from createProtcols and added a new method:
private Protocol setupProtocolStack(String configuration, ProtocolStack st) throws Exception { Vector<ProtocolConfiguration> protocol_configs=parseConfigurations(configuration);
Vector<Protocol> protocols=createProtocols(protocol_configs, st);
if(protocols == null)
return null;
sanityCheck(protocols);
processDefaultValues(protocol_configs, protocols) ;
return connectProtocols(protocols); }
For each protocol in turn, processDefaultValues simply creates a map of all properties which have no user specified value,
and once the map is created, goes through each entry and if a default value is present, computes the value and assigns it
to the field.
I didn't include the cases for defaultValueIPv4 nor defaultValueIPv6 as they depend on code for the IP version checking.
To incorporate them once the IP version checking stuff is written is really simple, something like:
// get the default value for the field
if (InetAddressInfo.isInetAddressRelated(field)) {
if (assumeIPv4) {
default = property.defaultIPv4() ;
else
default = property.defaultIPv6() ;
}
else {
default = property.default() ;
}
I haven't yet committed the stuff but will tomorrow morning. The testsuite runs OK at present with the code in.
This code is self contained, in the sense that it doesn't depend on any data gathered in the basic @Proeprty processing phasse.
It is the case that the three processing phases
* basic @Proeprty processing
* IP version checking
* default processing
do need similar types of information (e.g. which fields/methods are InetAddress related) and in theory it would be efficient to gather that info
on the first pass and share it on the secodna nd third passes, but it leads to less maintainable code. I'm going to write the three
indepene3nct of each other at first. It can be optimized later if desired.
> Add programmer assigned default processing to @Property annotations
> -------------------------------------------------------------------
>
> Key: JGRP-1068
> URL: https://jira.jboss.org/jira/browse/JGRP-1068
> Project: JGroups
> Issue Type: Feature Request
> Affects Versions: 2.8
> Reporter: Richard Achmatowicz
> Assignee: Richard Achmatowicz
> Priority: Minor
> Fix For: 2.8
>
>
> There is a need to handle in a systematic way the assignment of programmer assigned defaults to properties in JGroups. THis issue concerns incorporating the assignment of progranmmer assigned defaults using the existing @Property mechanism.
> The following comments explain the issue.
>
--
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