Package org.apache.tapestry.ioc.def

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


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

        ServiceDef existing = _serviceDefs.get(serviceId);

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

        _serviceDefs.put(serviceId, serviceDef);
    }
View Full Code Here


            _modules.add(module);

            for (String serviceId : def.getServiceIds())
            {
                ServiceDef serviceDef = module.getServiceDef(serviceId);

                Module existing = _serviceIdToModule.get(serviceId);

                if (existing != null) throw new RuntimeException(IOCMessages.serviceIdConflict(serviceId, existing
                        .getServiceDef(serviceId), serviceDef));

                _serviceIdToModule.put(serviceId, module);

                // The service is defined but will not have gone further than that.
                _tracker.define(serviceDef, Status.DEFINED);

                for (Class marker : serviceDef.getMarkers())
                    InternalUtils.addToMapList(_markerToServiceDef, marker, serviceDef);

            }
        }
View Full Code Here

        _builtinServices.put(serviceId, service);

        // Make sure each of the builtin services is also available via the Builtin annotation
        // marker.

        ServiceDef serviceDef = new ServiceDef()
        {
            public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
            {
                return null;
            }

            public Set<Class> getMarkers()
            {
                return BUILTIN;
            }

            public String getServiceId()
            {
                return serviceId;
            }

            public Class getServiceInterface()
            {
                return serviceInterface;
            }

            public String getServiceScope()
            {
                return IOCConstants.DEFAULT_SCOPE;
            }

            public boolean isEagerLoad()
            {
                return false;
            }
        };

        for (Class marker : serviceDef.getMarkers())
            InternalUtils.addToMapList(_markerToServiceDef, marker, serviceDef);

        _tracker.define(serviceDef, Status.BUILTIN);
    }
View Full Code Here

            switch (matches.size())
            {

                case 1:

                    ServiceDef def = matches.get(0);

                    return getService(def.getServiceId(), objectType);

                case 0:

                    // It's no accident that the user put the marker annotation at the injection
                    // point, since it matches a known marker annotation, it better be there for
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

            _modules.add(module);

            for (String serviceId : def.getServiceIds())
            {
                ServiceDef serviceDef = module.getServiceDef(serviceId);

                Module existing = _serviceIdToModule.get(serviceId);

                if (existing != null) throw new RuntimeException(IOCMessages.serviceIdConflict(serviceId, existing
                        .getServiceDef(serviceId), serviceDef));

                _serviceIdToModule.put(serviceId, module);

                // The service is defined but will not have gone further than that.
                _tracker.define(serviceDef, Status.DEFINED);

                for (Class marker : serviceDef.getMarkers())
                    InternalUtils.addToMapList(_markerToServiceDef, marker, serviceDef);

            }
        }
View Full Code Here

        _builtinServices.put(serviceId, service);

        // Make sure each of the builtin services is also available via the Builtin annotation
        // marker.

        ServiceDef serviceDef = new ServiceDef()
        {
            public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
            {
                return null;
            }

            public Set<Class> getMarkers()
            {
                return BUILTIN;
            }

            public String getServiceId()
            {
                return serviceId;
            }

            public Class getServiceInterface()
            {
                return serviceInterface;
            }

            public String getServiceScope()
            {
                return IOCConstants.DEFAULT_SCOPE;
            }

            public boolean isEagerLoad()
            {
                return false;
            }
        };

        for (Class marker : serviceDef.getMarkers())
            InternalUtils.addToMapList(_markerToServiceDef, marker, serviceDef);

        _tracker.define(serviceDef, Status.BUILTIN);
    }
View Full Code Here

            switch (matches.size())
            {

                case 1:

                    ServiceDef def = matches.get(0);

                    return getService(def.getServiceId(), objectType);

                case 0:

                    // It's no accident that the user put the marker annotation at the injection
                    // point, since it matches a known marker annotation, it better be there for
View Full Code Here

    {
        _context = context;

        for (final String beanName : BeanFactoryUtils.beanNamesIncludingAncestors(_context))
        {
            ServiceDef serviceDef = new ServiceDef()
            {
                private Object getBean()
                {
                    return _context.getBean(beanName);
                }

                private Class getBeanType()
                {
                    return _context.getType(beanName);
                }

                public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
                {
                    return new ObjectCreator()
                    {
                        public Object createObject()
                        {
                            return getBean();
                        }
                    };
                }

                public String getServiceId()
                {
                    return beanName;
                }

                public Class getServiceInterface()
                {
                    return getBeanType();
                }

                public String getServiceScope()
                {
                    return IOCConstants.DEFAULT_SCOPE;
                }

                public boolean isEagerLoad()
                {
                    return false;
                }

                /** Returns an empty set, Spring has no concept of a marker annotation. */
                public Set<Class> getMarkers()
                {
                    return Collections.emptySet();
                }

            };

            _serviceDefs.put(beanName, serviceDef);
        }

        // And add one service that is the Spring WebApplicationContext.

        ServiceDef serviceDef = new ServiceDef()
        {

            public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
            {
                return new ObjectCreator()
View Full Code Here

        // Combine service-specific markers with those inherited form the module.
        Set<Class> markers = CollectionFactory.newSet(_defaultMarkers);
        markers.addAll(_markers);

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

        _accumulator.addServiceDef(serviceDef);

        _serviceId = null;
        _serviceInterface = null;
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.