ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Shutak (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-2395) Binary marshaller: id mapper must be resolved according to configuration.
Date Fri, 15 Jan 2016 14:59:39 GMT

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

Artem Shutak commented on IGNITE-2395:
--------------------------------------

How to resolve id mapper according configuration (code example)

{code}
    /**
     * @param typeName Type name.
     * @param cfg Binary configuration.
     * @return BinaryIdMapper according to configuration.
     */
    private static BinaryIdMapper resolveIdMapper(String typeName, BinaryConfiguration cfg)
{
        assert typeName != null;

        BinaryIdMapper globalIdMapper = cfg.getIdMapper();

        Collection<BinaryTypeConfiguration> typeCfgs = cfg.getTypeConfigurations();

        if (typeCfgs != null) {
            for (BinaryTypeConfiguration typeCfg : typeCfgs) {
                String clsName = typeCfg.getTypeName();

                if (clsName != null && clsName.endsWith(".*")) {
                    String pkgName = clsName.substring(0, clsName.length() - 2);
                    String typePkgName = typeName.substring(0, typeName.lastIndexOf('.'));

                    if (pkgName.equals(typePkgName)) {
                        BinaryIdMapper idMapper = globalIdMapper;

                        if (typeCfg.getIdMapper() != null)
                            idMapper = typeCfg.getIdMapper();

                        idMapper = resolveIdMapper(idMapper);

                        return idMapper;
                    }
                }
            }
        }

        return resolveIdMapper(globalIdMapper);
    }
{code}

> Binary marshaller: id mapper must be resolved according to configuration.
> -------------------------------------------------------------------------
>
>                 Key: IGNITE-2395
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2395
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Artem Shutak
>            Assignee: Artem Shutak
>            Priority: Critical
>             Fix For: 1.6
>
>
> The following scenario does not works
> - start node with BinaryMarshaller and set BinaryConfiguration with not-default BinaryIdMapper
(see BinarySimpleNameIdMapper)
> - Execute the following code (it fails):
> {code}
>         BinaryObjectBuilder builder = builder("org.my.Class");
>         BinaryObject bo = builder.build();
>         assertEquals("class".hashCode(), bo.type().typeId());
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message