You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/10/29 04:27:50 UTC

[jira] Created: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Find the best way to specify both MINA and non-MINA events.
-----------------------------------------------------------

                 Key: DIRMINA-463
                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
             Project: MINA
          Issue Type: Task
          Components: Statemachine
            Reporter: Trustin Lee
            Priority: Minor
             Fix For: 2.0.0-M1


As discussed here: http://tinyurl.com/2omrl9

For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:

* Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")

Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540469 ] 

Niklas Therning commented on DIRMINA-463:
-----------------------------------------

I've removed the MINA specific versions of StateMachineFactory and implemented the getInstance() method instead as described previously. In the call to getInstance() the user has to specify the @Transition equivalent used for this particular state machine the factory will be used to create. WDYT?

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540330 ] 

Trustin Lee commented on DIRMINA-463:
-------------------------------------

A few comments:

1) We are now tightly-coupled with mina-core.  Are you sure about this?
2) WDYT about removing FILTER_ prefix to get aligned with org.apache.mina.common.IoEventType?

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Therning reassigned DIRMINA-463:
---------------------------------------

    Assignee: Niklas Therning

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540349 ] 

Niklas Therning commented on DIRMINA-463:
-----------------------------------------

1) Just checked in a fix for this. There are now MINA specific versions of StateMachineFactory.
2) Fixed!

I'm not sure I like how 1) turned out. There are lots of code duplication there. Maybe if we changed StateMachineFactory so that it isn't all static like now and to obtain one you would always have to specifiy the annotations to be used like so:

StateMachineFactory.getInstance(IoHandlerTransition.class).create(...)

We need a way to couple IoHandlerTransition and IoHandlerTransitions together. I think we can use a special annotation for that:

@TransitionsCombiner(IoHandlerTransitions.class)
public interface @IoHandlerTransition {
...
}

That way you won't have to specifiy both IoHandlerTransition and IoHandlerTransitions in the call to getInstance(...).

WDYT?

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540330 ] 

trustin edited comment on DIRMINA-463 at 11/5/07 8:44 PM:
--------------------------------------------------------------

Excellent!  and a few tiny comments... :)

1) We are now tightly-coupled with mina-core.  Are you sure about this?
2) WDYT about removing FILTER_ prefix to get aligned with org.apache.mina.common.IoEventType?

      was (Author: trustin):
    A few comments:

1) We are now tightly-coupled with mina-core.  Are you sure about this?
2) WDYT about removing FILTER_ prefix to get aligned with org.apache.mina.common.IoEventType?
  
> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540353 ] 

Trustin Lee commented on DIRMINA-463:
-------------------------------------

> We need a way to couple IoHandlerTransition and IoHandlerTransitions together. I think we can use a special annotation for that:
>
> @TransitionsCombiner(IoHandlerTransitions.class)
> public interface @IoHandlerTransition {
> ...
> } 

Does this mean we apply the same technique to IoFilterTransition(s) and Transition(s)?  Then it sounds great to me.  Probably we could allow user to specify either annotation class:

StateMachineFactory.getInstance(IoHandlerTransition.class).create(...) = StateMachineFactory.getInstance(IoHandlerTransitions.class).create(...)

Does it make a sense?

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Niklas Therning (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Therning resolved DIRMINA-463.
-------------------------------------

    Resolution: Fixed

I've introduced IoHandlerEvents and IoFilterEvents which enumerate the possible events for the IoHandler and IoFilter interfaces. I've also added IoHandlerTransition and IoFilterTransition annotations. When used the events for the on annotation parameter aren't strings but instead come from either IoHandlerEvents or IoFilterEvents. StateMachine.createForIoHandler() should be used to create a StateMachine which uses the IoHandlerTransition annotation. See the TapeDeck example for a demonstration.

PS: Annotations in Java are extremely limited. For example you cannot have null as a default value for a parameter. This is why I found it impossible to use IoEventType from mina-core and had to introduce IoHandlerEvents (my first idea was to use null for the wildcard event). Furthermore enums cannot be extended which is why IoFilterEvents redefines all the events which are also in IoHandlerEvents. In don't like code duplication but I didn't have a choice this time. :-(

> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-463) Find the best way to specify both MINA and non-MINA events.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRMINA-463.
-------------------------------------


> Find the best way to specify both MINA and non-MINA events.
> -----------------------------------------------------------
>
>                 Key: DIRMINA-463
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-463
>             Project: MINA
>          Issue Type: Task
>          Components: Statemachine
>            Reporter: Trustin Lee
>            Assignee: Niklas Therning
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> As discussed here: http://tinyurl.com/2omrl9
> For now, we use String to identify event types, which is somewhat unsafe.  Using an enum might be useful, but there are a few disadvantages:
> * Wildcard event type cannot be used, which could be extended further (e.g. "message*" or "session(Opened|Closed)")
> Probably sticking to String might be the best solution? :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.