Package org.apache.tapestry.ioc.def

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


        return def.isPrivate() && this != module;
    }

    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 (def.getServiceInterface() != serviceInterface)
                continue;

            if (notVisible(def, module))
                continue;
View Full Code Here

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

            if (!def.isEagerLoad())
                continue;

            // The proxy implements the service interface, and RegistryShutdownListener, and (for
            // eager load services), EagerLoadServiceProxy
View Full Code Here

        assertEquals(ids.size(), 3);
        assertTrue(ids.contains("ioc.Fred"));
        assertTrue(ids.contains("ioc.Barney"));
        assertTrue(ids.contains("ioc.Wilma"));

        ServiceDef sd = md.getServiceDef("ioc.Fred");

        assertEquals(sd.getServiceId(), "ioc.Fred");

        assertEquals(sd.getServiceInterface(), FieService.class);

        assertEquals(sd.toString(), className + ".buildFred()");
        assertEquals(sd.getServiceLifeycle(), IOCConstants.DEFAULT_LIFECYCLE);
        assertEquals(sd.isPrivate(), false);
        assertEquals(sd.isEagerLoad(), false);

        sd = md.getServiceDef("ioc.Barney");

        assertEquals(sd.getServiceId(), "ioc.Barney");

        assertEquals(sd.getServiceInterface(), FoeService.class);

        assertEquals(sd.toString(), className + ".buildBarney()");
        assertEquals(sd.getServiceLifeycle(), "threaded");
        assertEquals(sd.isPrivate(), true);

        sd = md.getServiceDef("ioc.Wilma");
        assertEquals(sd.isEagerLoad(), true);

        // Now the decorator method.

        Set<DecoratorDef> defs = md.getDecoratorDefs();
View Full Code Here

        Set<String> ids = md.getServiceIds();

        assertEquals(ids.size(), 1);
        assertTrue(ids.contains("ioc.Fred"));

        ServiceDef sd = md.getServiceDef("ioc.Fred");

        assertEquals(sd.getServiceId(), "ioc.Fred");

        assertEquals(sd.getServiceInterface(), FieService.class);

        // The methods are considered in ascending order, by name, then descending order, by
        // parameter count. So the grinder will latch onto the method that takes a parameter,
        // and consider the other method (with no parameters) the conflict.

        assertEquals(sd.toString(), expectedMethod.toString());

        verify();
    }
View Full Code Here

    public void addServiceDef(ServiceDef serviceDef)
    {
        String serviceId = serviceDef.getServiceId();

        ServiceDef existing = _serviceDefs.get(serviceId);

        if (existing != null)
        {
            _logger.warn(buildMethodConflict(serviceDef.toString(), existing.toString()));
            return;
        }

        _serviceDefs.put(serviceId, serviceDef);
    }
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.