Package org.apache.tapestry.ioc.def

Examples of org.apache.tapestry.ioc.def.ServiceDef


        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);

        ServiceDef sd = md.getServiceDef("Greeter");

        assertEquals(sd.getMarker(), BlueMarker.class);

        verify();
    }
View Full Code Here


        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);

        ServiceDef sd = md.getServiceDef("RedGreeter");

        assertEquals(sd.getMarker(), RedMarker.class);

        verify();
    }
View Full Code Here

        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);

        ServiceDef sd = md.getServiceDef("SecondRedGreeter");

        assertEquals(sd.getMarker(), RedMarker.class);

        verify();
    }
View Full Code Here

        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);

        ServiceDef sd = md.getServiceDef("SurprisinglyBlueGreeter");

        assertEquals(sd.getMarker(), BlueMarker.class);

        verify();
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void find_decorator_defs_for_service()
    {
        InternalRegistry registry = mockInternalRegistry();
        ServiceDef serviceDef = mockServiceDef();
        DecoratorDef def1 = mockDecoratorDef();
        DecoratorDef def2 = mockDecoratorDef();
        Set<DecoratorDef> rawDefs = newMock(Set.class);
        Logger logger = mockLogger();
View Full Code Here

            {
                return _classFactory.getConstructorLocation(constructor);
            }
        };

        ServiceDef serviceDef = new ServiceDefImpl(_serviceInterface, _serviceId, _scope,
                _eagerLoad, source);

        _accumulator.addServiceDef(serviceDef);

        _serviceId = null;
View Full Code Here

    {
        notBlank(serviceId, "serviceId");
        notNull(serviceInterface, "serviceInterface");
        // module may be null.

        ServiceDef def = _moduleDef.getServiceDef(serviceId);

        // RegistryImpl should already have checked that the service exists.
        assert def != null;

        Object service = findOrCreate(def, null);

        try
        {
            return serviceInterface.cast(service);
        }
        catch (ClassCastException ex)
        {
            // This may be overkill: I don't know how this could happen
            // given that the return type of the method determines
            // the service interface.

            throw new RuntimeException(IOCMessages.serviceWrongInterface(serviceId, def
                    .getServiceInterface(), serviceInterface));
        }
    }
View Full Code Here

        return result;
    }

    public List<ServiceDecorator> findDecoratorsForService(String serviceId)
    {
        ServiceDef sd = _moduleDef.getServiceDef(serviceId);

        return _registry.findDecoratorsForService(sd);
    }
View Full Code Here

        Collection<String> result = newList();

        for (String id : _moduleDef.getServiceIds())
        {
            ServiceDef def = _moduleDef.getServiceDef(id);

            if (serviceInterface.isAssignableFrom(def.getServiceInterface())) result.add(id);
        }

        return result;
    }
View Full Code Here

        synchronized (MUTEX)
        {
            for (String serviceId : _moduleDef.getServiceIds())
            {
                ServiceDef def = _moduleDef.getServiceDef(serviceId);

                if (def.isEagerLoad()) findOrCreate(def, proxies);
            }

            for (EagerLoadServiceProxy proxy : proxies)
                proxy.eagerLoadService();
        }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.def.ServiceDef

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.