001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry;
016    
017    import java.util.Collection;
018    
019    import org.apache.hivemind.ClassResolver;
020    
021    /**
022     *  An object that provides a component with access to helper beans.
023     *  Helper beans are JavaBeans associated with a page or component
024     *  that are used to extend the functionality of the component via
025     *  aggregation.
026     *
027     *  @author Howard Lewis Ship
028     *  @since 1.0.4
029     **/
030    
031    
032    public interface IBeanProvider
033    {
034            /**
035             *  Returns the JavaBean with the specified name.  The bean is created as needed.
036             *
037             *  @throws ApplicationRuntimeException if no such bean is available.
038             *
039             **/
040            
041            public Object getBean(String name);
042            
043            /**
044             *  Returns the {@link IComponent} (which may be a 
045             *  {@link org.apache.tapestry.IPage}) for which
046             *  this bean provider is providing beans.
047             *
048             *  @since 1.0.5
049             **/
050            
051            public IComponent getComponent();
052            
053            /**
054             *  Returns a collection of the names of any beans which may
055             *  be provided.
056             *
057             *  @since 1.0.6
058             *  @see org.apache.tapestry.spec.IComponentSpecification#getBeanNames()
059             *
060             **/
061            
062            public Collection getBeanNames();
063            
064        /**
065         *  Returns true if the provider can provide the named bean.
066         * 
067         *  @since 2.2
068         * 
069         **/
070        
071        public boolean canProvideBean(String name);
072        
073            /**
074             *  Returns a resource resolver.
075             * 
076             *  @since 1.0.8
077             * 
078             **/
079            
080            public ClassResolver getClassResolver();
081            
082    }
083