[jira] Created: (HIVEMIND-210) Problem contributing to EagerLoad with annotation module

View: New views
1 Messages — Rating Filter:   Alert me  

[jira] Created: (HIVEMIND-210) Problem contributing to EagerLoad with annotation module

by JIRA hivemind-dev@jakarta.apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Problem contributing to EagerLoad with annotation module
--------------------------------------------------------

                 Key: HIVEMIND-210
                 URL: https://issues.apache.org/jira/browse/HIVEMIND-210
             Project: HiveMind
          Issue Type: Bug
          Components: annotations
    Affects Versions: 2.0-alpha-1
            Reporter: Kevin Gilpin


I've defined an annotation module. I define a service and contribute it to the EagerLoad configuration point, but EagerLoad throws a ClassCastException. If I define the contribution in an XML file, it works. The relevant code is included below.

Module
======

package com.praxeon.search.service;

import java.util.Collections;
import java.util.List;

import org.apache.hivemind.annotations.AbstractAnnotatedModule;
import org.apache.hivemind.annotations.definition.Configuration ;
import org.apache.hivemind.annotations.definition.Contribution;
import org.apache.hivemind.annotations.definition.Module;
import org.apache.hivemind.annotations.definition.Service;

import com.praxeon.api.index.IndexHome ;
import com.praxeon.api.index.SegmentHostListener;
import com.praxeon.index.service.StatusQueueSegmentHostListener;

import com.praxeon.sysutils.config.XMLConfiguration;

@Module(id="praxeon.search.annot ")
public class SearchModule extends AbstractAnnotatedModule {

    @Configuration(id="QueueName")
    public String getQueueName() {
        return XMLConfiguration.getValue("/*/Search/SegmentHostQueue");
    }
   
    @Service(id="StatusQueueSegmentHostListener")
    public SegmentHostListener getStatusQueueSegmentHostListener() {
        String queueName = configuration("QueueName", String.class );
        StatusQueueSegmentHostListener listener = new StatusQueueSegmentHostListener(queueName);
        service(IndexHome.class).addSegmentHostListener(listener);
        return listener;
    }
   
    @Contribution(configurationId="hivemind.EagerLoad")
    public List eagerLoad() {
        return Collections.singletonList(service("StatusQueueSegmentHostListener", SegmentHostListener.class ));
    }
}

Exception
=========

java.lang.ClassCastException: $SegmentHostListener_1161fffc175
    at org.apache.hivemind.service.impl.EagerLoader.run(EagerLoader.java:37)
    at org.apache.hivemind.impl.StartupImpl.run( StartupImpl.java :45)
    at org.apache.hivemind.impl.RegistryInfrastructureImpl.startup(RegistryInfrastructureImpl.java:435)
    at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:170)
    at com.praxeon.config.HivemindConfiguration.load (HivemindConfiguration.java:145)

XML contribution that works
===========================

    <contribution configuration-id="hivemind.EagerLoad">
        <load service-id="praxeon.search.annot.StatusQueueSegmentHostListener"/>
    </contribution>



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