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 2008/05/15 22:20:57 UTC

[jira] Created: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Dynamic delimiter support for TextLineCodecFactory
--------------------------------------------------

                 Key: DIRMINA-586
                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
             Project: MINA
          Issue Type: Improvement
          Components: Filter
    Affects Versions: 2.0.0-M1
            Reporter: Trustin Lee
            Priority: Minor
             Fix For: 2.0.0-M2


TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:

http://markmail.org/message/loiqoej35evt2yvv

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


Re: [jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by Maarten Bosteels <mb...@gmail.com>.
IIRC, you can change the filterchain of a running session.
So it should be possible to 'dynamically' create a new
TextLineCodecFactorywhenever you want and use it to replace the
current protocol codec.

Or am I missing something ?

Maarten


On Tue, Dec 23, 2008 at 7:17 AM, Ashish Paliwal (JIRA) <ji...@apache.org>wrote:

>
>    [
> https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658768#action_12658768]
>
> Ashish Paliwal commented on DIRMINA-586:
> ----------------------------------------
>
> Hmm... I think I misinterpreted this. I am wondering do we need to have
> this functionality as part of TextLineCodecFactory. If we do, then how do we
> determine, when to switch context?
> Pardon my ignorance, but how many implementation shall need such a
> implementation?
>
>
>
>
> > Dynamic delimiter support for TextLineCodecFactory
> > --------------------------------------------------
> >
> >                 Key: DIRMINA-586
> >                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
> >             Project: MINA
> >          Issue Type: Improvement
> >          Components: Filter
> >    Affects Versions: 2.0.0-M1
> >            Reporter: Trustin Lee
> >            Priority: Minor
> >             Fix For: 2.0.0-RC1
> >
> >
> > TextLineCodecFactory supports static delimiters only.  For some cases,
> users need to switch the delimiter dynamically depending on context.
>  Related discussion is found here:
> > http://markmail.org/message/loiqoej35evt2yvv
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658768#action_12658768 ] 

Ashish Paliwal commented on DIRMINA-586:
----------------------------------------

Hmm... I think I misinterpreted this. I am wondering do we need to have this functionality as part of TextLineCodecFactory. If we do, then how do we determine, when to switch context? 
Pardon my ignorance, but how many implementation shall need such a implementation?




> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658690#action_12658690 ] 

Edouard De Oliveira commented on DIRMINA-586:
---------------------------------------------

In fact, it is not solved 
Being able to specify a custom delimiter at startup is not the same as being able to switch delimiters when context changes

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Matthieu Chase Heimer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660833#action_12660833 ] 

Matthieu Chase Heimer commented on DIRMINA-586:
-----------------------------------------------

I don't think modifying the TextLineEncoder or the TextLineCodecFactory is going to be the right approach. I did a quick glance at some of the code and there are some problems that you'd run into. First, there is only a single instance of the TextLineEncoder returned by the TextLineCodecFactory so even though the encoder is stored in the session you end up with all sessions storing a reference to the same encoder. So if you change the delimiter in one session's encoder you'd be changing it for all of them. You'd have to modify the encoder to read the current delimiter out of the session or modify the codecfactory to return different instances of the encoder per session to start with.

Based on your discussion you need to send messages from the server to the client with and without a linefeed. The "without" part means you want to send text that is not a line. That would seem to be outside the scope of a TextLineEncoder. 
You have a couple of possible solutions.

1) Don't use the TextLineCodecFactory. It looks like TextLineDecoder is the right decoder for you but TextLineEncoder is the wrong one. Just create a basic text pass-through encoder and have your handler write your messages with/without linefeeds as needed.

2) The ProtocolCodecFilter looks like it will skip the encoding of the message being written if it is an instance of an IoBuffer. When you need to leave off the linefeed you could bypass the encoder by writing IoBuffer objects.

3) The ProtocolCodecFilter is pulling the encoder out of the IoSession. On a session by session basis you could swap the TextLineEncoder and a PassThoughEncoder in the session. You could even make a filter that handled the swapping for you so that your handler could write a "next message will use encoder X" type message before sending the text.

4) Use the DemuxingProtocolEncoder along with a LineFeedMessageEncoder and a PlainTextMessageEncoder but this would require that your handler used custom message types instead of just String objects.

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615140#action_12615140 ] 

Mark Webb commented on DIRMINA-586:
-----------------------------------

Please let me know if this is still an issue.  I believe that if we make a change to the current functionality, it might break current implementations.  

This fix may require a special class, instead of changes to the current implementation.

Please let me know what you think.  I am considering closing this issue and marking as "will not fix"



> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M3
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658598#action_12658598 ] 

Mark Webb commented on DIRMINA-586:
-----------------------------------

I vote to close it.  If we have functionality to solve the request, then it should be closed.




> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Updated: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

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

Emmanuel Lecharny updated DIRMINA-586:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M4)
                   2.0.0-RC1

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

-- 
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-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658525#action_12658525 ] 

paliwalashish edited comment on DIRMINA-586 at 12/22/08 4:43 AM:
------------------------------------------------------------------

Not sure if this is still an issue. A custom delimiter can be created using following construct

new LineDelimiter("delimiter") ; and passed onto TextLineCodecFactory

To specify the same in TextLineCodecfactory, following constructors can be used

public TextLineCodecFactory(Charset charset, String encodingDelimiter, String decodingDelimiter)

or

public TextLineCodecFactory(Charset charset, LineDelimiter encodingDelimiter, LineDelimiter decodingDelimiter)


      was (Author: paliwalashish):
    Not sure if this still an issue. A custom delimiter can be created using following construct

new LineDelimiter("delimiter") ; and passed onto TextLineCodecFactory

To specify the same in TextLineCodecfactory, following constructors can be used

public TextLineCodecFactory(Charset charset, String encodingDelimiter, String decodingDelimiter)

or

public TextLineCodecFactory(Charset charset, LineDelimiter encodingDelimiter, LineDelimiter decodingDelimiter)

  
> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658525#action_12658525 ] 

Ashish Paliwal commented on DIRMINA-586:
----------------------------------------

Not sure if this still an issue. A custom delimiter can be created using following construct

new LineDelimiter("delimiter") ; and passed onto TextLineCodecFactory

To specify the same in TextLineCodecfactory, following constructors can be used

public TextLineCodecFactory(Charset charset, String encodingDelimiter, String decodingDelimiter)

or

public TextLineCodecFactory(Charset charset, LineDelimiter encodingDelimiter, LineDelimiter decodingDelimiter)


> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Commented: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

Posted by "Edwin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635939#action_12635939 ] 

Edwin Lee commented on DIRMINA-586:
-----------------------------------

i encountered something similar when i was writing a configurable automated client engine for Telnet (i.e. automatically logs in, sends command, collect output, etc). (Seems like OP is also dealing with a Telnet login.)

IMHO, this isn't exactly just an extension/enhancement of the TextLineCodecFactory (and corresponding TextLineEncoder and TextLineDecoder), though there are overlaps (both are text-based, and both use delimiters, though when dealing with Telnet, you may need more than just delimiters).

IMHO, to fully handle the dynamic-ness of this, it probably requires a custom implementation of ProtocolDecoder's decode method (i.e. even if a DynamicTextLineDecoder is put in, a hook would be required, and the hook would almost cover the decode method), which is almost as good as a whole new ProtocolDecoder implementation, and hence a new ProtocolCodecFactory implementation (though the TextLineEncoder can probably be reused in this case).


> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M4
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Updated: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

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

Julien Vermillard updated DIRMINA-586:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M2)
                   2.0.0-M3

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M3
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Updated: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

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

Julien Vermillard updated DIRMINA-586:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-RC1)
                   3.0.0-M1

moved to 3.0 due to feature freeze for 2.0

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 3.0.0-M1
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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


[jira] Updated: (DIRMINA-586) Dynamic delimiter support for TextLineCodecFactory

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

Julien Vermillard updated DIRMINA-586:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M3)
                   2.0.0-M4

> Dynamic delimiter support for TextLineCodecFactory
> --------------------------------------------------
>
>                 Key: DIRMINA-586
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-586
>             Project: MINA
>          Issue Type: Improvement
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M4
>
>
> TextLineCodecFactory supports static delimiters only.  For some cases, users need to switch the delimiter dynamically depending on context.  Related discussion is found here:
> http://markmail.org/message/loiqoej35evt2yvv

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