accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Tubbs (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ACCUMULO-1003) what is the point of SecuritySerDe?
Date Sun, 03 Feb 2013 21:52:12 GMT

    [ https://issues.apache.org/jira/browse/ACCUMULO-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13569906#comment-13569906
] 

Christopher Tubbs commented on ACCUMULO-1003:
---------------------------------------------

This is overly complex, and the generic parameters don't provide compile time checks correctly.

For instance, say I want to serialize a UserPassToken:
{code:java}
UserPassToken token = new UserPassToken("user", "password".getBytes());
token.getSerDe().serialize(token);
{code}

Not only does this fail to compile, without casts that obviate the use of generic parameters,
it's confusing to pass token twice.

To support a generic serialization strategy, it would be preferable to have some sort of visitor
pattern like:
{code:java}
public class SecurityToken<T extends SecurityToken<T>> {
    public <S> S serialize(Serializer<? extends T,S> serializer);
}
// with a specific implementation like
public class UserPassToken<UserPassToken> {
    public <S> S serialize(Serializer<? extends UserPassToken,S>);
}
// which could be used like
public class UserPassToBytesSerializer extends Serializer<UserPassToken,byte[]> {...};
byte[] bytes = token.serialize(new UserPassToBytesSerializer());
{code}

But even this, while simple and flexible for users, is a bit complex to maintain. I'd prefer
just a simple Writable, or other "convertToBytes()" / "convertFromBytes()" simple strategy.
                
> what is the point of SecuritySerDe?
> -----------------------------------
>
>                 Key: ACCUMULO-1003
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-1003
>             Project: Accumulo
>          Issue Type: Sub-task
>          Components: master, tserver
>            Reporter: Eric Newton
>            Assignee: John Vines
>             Fix For: 1.5.0
>
>
> What is the point of the factory method getSerDe() (which, BTW is an awful name)?   Why
not just make SecurityToken Writable?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message