Package org.apache.hivemind.definition.impl

Examples of org.apache.hivemind.definition.impl.ModuleDefinitionImpl


     * Creates a Registry with one module, that defines a threaded Service "StringHolder"
     * @param implementationClass  implementation class of the service
     */
    private Registry createRegistryShutdownListener(Class implementationClass)
    {
        ModuleDefinitionImpl module = createModuleDefinition("hivemind.test.services");
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(module);

        ServicePointDefinition sp1 = helper.addServicePoint("StringHolder", StringHolder.class.getName());
        helper.addSimpleServiceImplementation(sp1, implementationClass.getName(), ServiceModel.THREADED);

View Full Code Here


    /**
     * Creates a Registry with one module, that defines a Service "Reverser" which is a POJO
     */
    private Registry createRegistryWithPojo(final String serviceModel)
    {
        ModuleDefinitionImpl module = createModuleDefinition("bean");
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(module);

        ServicePointDefinition sp1 = helper.addServicePoint("Reverser", Reverser.class.getName());
        helper.addSimpleServiceImplementation(sp1, Reverser.class.getName(), serviceModel);

View Full Code Here

        module.setModuleId("module");
        module.toString();
        new RegistryInfrastructureImpl(null, Locale.ENGLISH).toString();
        new InterceptorStackImpl(null, mockServicePoint, null).toString();

        ModuleDefinition md = new ModuleDefinitionImpl("module", null, null, null);
        ServicePointDefinitionImpl spd = new ServicePointDefinitionImpl(md, "service", null,
                Visibility.PUBLIC, Runnable.class.getName());
        ImplementationDefinition sid = new ImplementationDefinitionImpl(md,
                null, null, ServiceModel.PRIMITIVE, true);
        spd.addImplementation(sid);
View Full Code Here

        // the same module name "hivemind"

        ModuleDefinition md = registryDefinition.getModule("hivemind");
        if (md == null)
        {
            md = new ModuleDefinitionImpl("hivemind", HiveMind.getClassLocation(getClass(), resolver),
                    resolver, null);
            registryDefinition.addModule(md);
        }

        // The cast to ModuleDefinitionImpl is save, since we exactly now the origin
View Full Code Here

     */
    public void processModule(Class moduleClass, String moduleId)
    {
        checkModuleClassPrerequisites(moduleClass);
       
        ModuleDefinitionImpl module = new ModuleDefinitionImpl(moduleId,
                createModuleLocation(moduleClass), _classResolver, moduleClass.getPackage().getName());

        // processServices(moduleClass);

        ModuleInstanceProvider instanceProvider = new ModuleInstanceProviderImpl(moduleClass,
                module.getId());
        // Register provider as initialization provider so it can acquire a reference to the
        // registry
        _registryDefinition.addRegistryInitializationListener(instanceProvider);

        processModuleMethods(moduleClass, module, instanceProvider);
View Full Code Here

     * Creates a Registry with one module, that defines a Service "Loud" added to the EagerLoad
     * configuration.
     */
    private Registry createEagerLoadModule(final String serviceModel)
    {
        ModuleDefinitionImpl module = createModuleDefinition("hivemind.test.services");
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(module);

        ServicePointDefinition sp1 = helper.addServicePoint("Loud", Runnable.class.getName());
        helper.addSimpleServiceImplementation(sp1, LoudRunner.class.getName(), serviceModel);

View Full Code Here

     * Builds a registry containing a single service "Listener" that implements the {@link RegistryShutdownListener}
     * interface.
     */
    private Registry createModuleWithShutdownListener(final String serviceModel)
    {
        ModuleDefinitionImpl module = createModuleDefinition("module1");
       
        ServicePointDefinitionImpl sp1 = createServicePointDefinition(module, "Listener", Runnable.class);
       
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(newLocation()) {

            public Object constructCoreServiceImplementation(ImplementationConstructionContext context)
            {
                RunnableImpl result = new RunnableImpl();
                result.setType(serviceModel);
                return result;
            }};
       
        ImplementationDefinition impl = new ImplementationDefinitionImpl(module, newLocation(),
                constructor, serviceModel, true);
        sp1.addImplementation(impl);
        module.addServicePoint(sp1);
        return buildFrameworkRegistry(module);
    }
View Full Code Here

    /**
     * Convenience method for creating a {@link ModuleDefinitionImpl}.
     */
    protected ModuleDefinitionImpl createModuleDefinition(String moduleId)
    {
        ModuleDefinitionImpl result = new ModuleDefinitionImpl(moduleId, newLocation(),
                getClassResolver(), "");

        return result;
    }
View Full Code Here

    protected void setUp() throws Exception
    {
      super.setUp();
     
        ModuleDefinitionImpl module = createModuleDefinition("hivemind.tests.serviceByInterface");

        ServicePointDefinitionImpl sp1 = createServicePointDefinition(module, "uniqueService", IUniqueService.class);
        ImplementationDefinition impl1 = createServiceImplementationDefinition(module, UniqueServiceImpl.class);
        sp1.addImplementation(impl1);

        module.addServicePoint(sp1);

        ServicePointDefinitionImpl sp2 = createServicePointDefinition(module, "multipleServiceOne", IMultipleService.class);
        ImplementationDefinition impl2 = createServiceImplementationDefinition(module, MultipleServiceImpl.class);
        sp2.addImplementation(impl2);

        module.addServicePoint(sp2);

        ServicePointDefinitionImpl sp3 = createServicePointDefinition(module, "multipleServiceTwo", IMultipleService.class);
        sp3.addImplementation(impl2);
       
        module.addServicePoint(sp3);

        registry = buildFrameworkRegistry(module);
    }
View Full Code Here

        }
    }

    public void testDuplicateExtensionPoints() throws Exception
    {
        ModuleDefinitionImpl testModule = createModuleDefinition("hivemind.test");

        testModule.addServicePoint(createServicePointDefinition(testModule, "MyService", Comparable.class));
        try
        {
            testModule.addServicePoint(createServicePointDefinition(testModule, "MyService", Comparable.class));
            fail("duplicate service point not detected");
        }
        catch (ApplicationRuntimeException expected)
        {
        }

        testModule.addConfigurationPoint(createConfigurationPointDefinition(testModule, "MyConfig"));
        try
        {
            testModule.addConfigurationPoint(createConfigurationPointDefinition(testModule, "MyConfig"));
            fail("duplicate configuration point not detected");
        }
        catch (ApplicationRuntimeException expected)
        {
        }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.definition.impl.ModuleDefinitionImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.