Package org.apache.hivemind.impl

Examples of org.apache.hivemind.impl.CreateClassServiceConstructor


    {
        Element instanceBuilder;
       
        if (ib instanceof CreateClassServiceConstructor)
        {
            CreateClassServiceConstructor cid = (CreateClassServiceConstructor) ib;
            instanceBuilder = _document.createElement("create-instance");

            instanceBuilder.setAttribute("class", cid.getInstanceClassName());
            if (!id.getServiceModel().equals("singleton"))
                instanceBuilder.setAttribute("model", id.getServiceModel());
        }
        else
        {
View Full Code Here


    }

    public ImplementationConstructor createConstructor(
        String contributingModuleId)
    {
        CreateClassServiceConstructor result = new CreateClassServiceConstructor(
                getLocation(), _instanceClassName);

        return result;
    }
View Full Code Here

    public ImplementationDefinition addSimpleServiceImplementation(
            ServicePointDefinition servicePoint,
            String serviceImplementationClass, String serviceModel)
    {
        return addServiceImplementation(servicePoint,
                new CreateClassServiceConstructor(_module.getLocation(), serviceImplementationClass),
                serviceModel);
    }
View Full Code Here

    public void testCreateClassServiceConstructorAccessors()
    {
        replayControls();

        CreateClassServiceConstructor c = new CreateClassServiceConstructor(newLocation(),
                "java.util.HashMap");

        c.setInstanceClassName("java.util.HashMap");

        assertEquals("java.util.HashMap", c.getInstanceClassName());

        verifyControls();
    }
View Full Code Here

        ServicePoint sp = new ServicePointImpl(m, null);
       
        replayControls();

        CreateClassServiceConstructor c = new CreateClassServiceConstructor(newLocation(),
                "java.util.HashMap");

        ImplementationConstructionContext context = new ImplementationConstructionContextImpl(m, sp);
        Object o1 = c.constructCoreServiceImplementation(context);
        Object o2 = c.constructCoreServiceImplementation(context);

        assertNotSame(o1, o2);

        assertTrue(o1 instanceof HashMap);
        assertTrue(o2 instanceof HashMap);
View Full Code Here

    {
        Module m = newModule();
       
        ServicePoint sp = new ServicePointImpl(m, null);

        CreateClassServiceConstructor c = new CreateClassServiceConstructor(newLocation(),
                SimpleBean.class.getName() + ",value=HiveMind");

        ImplementationConstructionContext context = new ImplementationConstructionContextImpl(m, sp);
        SimpleBean b = (SimpleBean) c.constructCoreServiceImplementation(context);

        assertEquals("HiveMind", b.getValue());
    }
View Full Code Here

    {
        Module m = newModule();
       
        ServicePoint sp = new ServicePointImpl(m, null);

        CreateClassServiceConstructor c = new CreateClassServiceConstructor(newLocation(),
                PrivateBean.class.getName());

        try
        {
            ImplementationConstructionContext context = new ImplementationConstructionContextImpl(m, sp);
            c.constructCoreServiceImplementation(context);
            unreachable();
        }
        catch (Exception ex)
        {
            assertExceptionSubstring(
View Full Code Here

     * Convenience method for creating a {@link ImplementationDefinition}.
     */
    protected ImplementationDefinition createServiceImplementationDefinition(ModuleDefinition module, Class serviceImplementationClass)
    {
        ImplementationDefinition result = new ImplementationDefinitionImpl(module, newLocation(),
                new CreateClassServiceConstructor(newLocation(), serviceImplementationClass.getName()),
                "singleton", true);

        return result;
    }
View Full Code Here

    public ServiceImplementationConstructor createConstructor(
        ServicePoint point,
        Module contributingModule)
    {
        CreateClassServiceConstructor result = new CreateClassServiceConstructor();

        result.setLocation(getLocation());
        result.setContributingModule(contributingModule);
        result.setInstanceClassName(_instanceClassName);

        return result;
    }
View Full Code Here

    {
        Module m = (Module) newMock(Module.class);

        replayControls();

        CreateClassServiceConstructor c = new CreateClassServiceConstructor();

        c.setContributingModule(m);

        assertSame(m, c.getContributingModule());

        c.setInstanceClassName("java.util.HashMap");

        assertEquals("java.util.HashMap", c.getInstanceClassName());

        verifyControls();
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.impl.CreateClassServiceConstructor

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.