[seam-issues] [JBoss JIRA] Issue Comment Edited: (SEAMINTL-7) Rewrite Messages API along the lines of JBoss Logging 3

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue Nov 9 23:37:01 EST 2010


    [ https://jira.jboss.org/browse/SEAMINTL-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562378#action_12562378 ] 

Dan Allen edited comment on SEAMINTL-7 at 11/9/10 11:36 PM:
------------------------------------------------------------

I forgot about the fact that status messages may need to have a target (i.e., the input to which it applies). This can be solved in three ways.

Assume we have the following status reporter definition:

@StatusReporter
public interface RegistrationStatusReporter
{
   @Message(level = WARN, value = "Username taken!") @ReportStatus
   void duplicateUsername(String username);
}

1. Add target to message definition

@Message(level = WARN, value = "Username taken!") @ReportStatus(target = "username")
void duplicateUsername(String username); 

2. Qualify the reporter at the injection point (much like selecting a locale)

@Inject @StatusReporter @ForTarget("username") RegistrationStatusReporter usernameStatus; 
...
usernameStatus.duplicateUsername(username);

3. Using a selector (when the target is dynamic) 

@Inject @Any @StatusReporter Instance<RegistrationStatusReporter> status;
...
status.select(new ForTargetLiteral(clientId)).get().duplicateUsername(username);

      was (Author: dan.j.allen):
    I forgot about the fact that status messages may need to have a target (i.e., the input to which it applies). This can be solved in three ways:

1. Defined in message

@Message(level = WARN, value = "Username taken!") @ReportStatus(target = "username")
void duplicateUsername(String username); 

2. Qualify the reporter at the injection point (much like selecting a locale)

@Inject @StatusReporter @ForTarget("username") RegistrationStatusReporter usernameStatus; 
...
usernameStatus.duplicateUsername(username);

3. Using a selector (when the target is dynamic) 

@Inject @Any @StatusReporter Instance<RegistrationStatusReporter> status;
...
status.select(new ForTargetLiteral(clientId)).get().duplicateUsername(username);
  
> Rewrite Messages API along the lines of JBoss Logging 3
> -------------------------------------------------------
>
>                 Key: SEAMINTL-7
>                 URL: https://jira.jboss.org/browse/SEAMINTL-7
>             Project: Seam i18n
>          Issue Type: Feature Request
>          Components: Messages
>    Affects Versions: 3.0.0.Alpha1
>            Reporter: Ken Finnigan
>            Assignee: Pete Muir
>             Fix For: 3.0.0.Beta1
>
>
> Rewrite messages API along the lines of JBoss Logging 3 to be consistent with the logging approach once the switch from slf4j is made to JBoss Logging 3.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list