001    // Copyright 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.pageload;
016    
017    import org.apache.hivemind.util.Defense;
018    import org.apache.tapestry.INamespace;
019    import org.apache.tapestry.spec.IComponentSpecification;
020    
021    /**
022     * Contains information needed when trying to determine the name of a page or component class.
023     * 
024     * @author Howard M. Lewis Ship
025     * @since 4.0
026     */
027    public class ComponentClassProviderContext
028    {
029        private INamespace _namespace;
030    
031        private String _name;
032    
033        private IComponentSpecification _specification;
034    
035        public ComponentClassProviderContext(String pageName,
036                IComponentSpecification pageSpecification, INamespace namespace)
037        {
038            Defense.notNull(pageName, "pageName");
039            Defense.notNull(pageSpecification, "pageSpecification");
040            Defense.notNull(namespace, "namespace");
041    
042            _name = pageName;
043            _specification = pageSpecification;
044            _namespace = namespace;
045        }
046    
047        /**
048         * Returns the simple, unqualifed name of the page, or the type of the component. There will not
049         * be a namespace prefix, but there may be one or more folders (i.e., "admin/Menu").
050         */
051    
052        public String getName()
053        {
054            return _name;
055        }
056    
057        /**
058         * Returns the namespace containing the page.
059         */
060    
061        public INamespace getNamespace()
062        {
063            return _namespace;
064        }
065    
066        /**
067         * Returns the specification defining the page.
068         */
069        public IComponentSpecification getSpecification()
070        {
071            return _specification;
072        }
073    
074    }