[jira] Created: (NET-310) FTPCommand conversion to use enum

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org
FTPCommand conversion to use enum
---------------------------------

                 Key: NET-310
                 URL: https://issues.apache.org/jira/browse/NET-310
             Project: Commons Net
          Issue Type: Improvement
            Reporter: Sebb
         Attachments: FTPCommandEnum.patch

Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.

I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.

If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.

See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.

Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.

Comments? Suggestions?

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/NET-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-310:
---------------------

    Attachment: FTPCommandEnum.patch

> FTPCommand conversion to use enum
> ---------------------------------
>
>                 Key: NET-310
>                 URL: https://issues.apache.org/jira/browse/NET-310
>             Project: Commons Net
>          Issue Type: Improvement
>            Reporter: Sebb
>         Attachments: FTPCommandEnum.patch
>
>
> Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.
> I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.
> If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.
> See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.
> Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.
> Comments? Suggestions?

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/NET-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rory Winston updated NET-310:
-----------------------------

    Priority: Minor  (was: Major)

> FTPCommand conversion to use enum
> ---------------------------------
>
>                 Key: NET-310
>                 URL: https://issues.apache.org/jira/browse/NET-310
>             Project: Commons Net
>          Issue Type: Improvement
>            Reporter: Sebb
>            Priority: Minor
>         Attachments: FTPCommandEnum.patch
>
>
> Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.
> I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.
> If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.
> See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.
> Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.
> Comments? Suggestions?

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/NET-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853104#action_12853104 ]

Rory Winston commented on NET-310:
----------------------------------

I dont like the approach of using the ordinals, its too fragile and can lead to the same problems as using the current integer-based constants. If we are going to use enums, I would do it in a 3.0 release and ditch the integer-based command ordinal compatability.

> FTPCommand conversion to use enum
> ---------------------------------
>
>                 Key: NET-310
>                 URL: https://issues.apache.org/jira/browse/NET-310
>             Project: Commons Net
>          Issue Type: Improvement
>            Reporter: Sebb
>            Priority: Minor
>         Attachments: FTPCommandEnum.patch
>
>
> Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.
> I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.
> If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.
> See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.
> Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.
> Comments? Suggestions?

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/NET-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859804#action_12859804 ]

Sebb commented on NET-310:
--------------------------

I agree that the integer-based approach should be ditched.  However that will break the API.

To allow existing users of the API to migrate to the enum API, I think the approach should be:

* Create the enum class and add enum-based API.
* Deprecate the integer-based API and FTPCommand class
* Deleted the integer-based API in the next major release.

As to using ordinals in the existing FTPCommand class, that's not essential.
Simpler to keep the existing code.

> FTPCommand conversion to use enum
> ---------------------------------
>
>                 Key: NET-310
>                 URL: https://issues.apache.org/jira/browse/NET-310
>             Project: Commons Net
>          Issue Type: Improvement
>            Reporter: Sebb
>            Priority: Minor
>         Attachments: FTPCommandEnum.patch
>
>
> Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.
> I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.
> If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.
> See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.
> Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.
> Comments? Suggestions?

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (NET-310) FTPCommand conversion to use enum

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/NET-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-310:
---------------------

    Component/s: FTP

> FTPCommand conversion to use enum
> ---------------------------------
>
>                 Key: NET-310
>                 URL: https://issues.apache.org/jira/browse/NET-310
>             Project: Commons Net
>          Issue Type: Improvement
>          Components: FTP
>            Reporter: Sebb
>            Priority: Minor
>         Attachments: FTPCommandEnum.patch
>
>
> Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.
> I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.
> If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.
> See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.
> Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.
> Comments? Suggestions?

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