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, IComponentSpecification pageSpecification, INamespace namespace)
036        {
037            Defense.notNull(pageName, "pageName");
038            Defense.notNull(pageSpecification, "pageSpecification");
039            Defense.notNull(namespace, "namespace");
040    
041            _name = pageName;
042            _specification = pageSpecification;
043            _namespace = namespace;
044        }
045    
046        /**
047         * Returns the simple, unqualifed name of the page, or the type of the component. There will not
048         * be a namespace prefix, but there may be one or more folders (i.e., "admin/Menu").
049         */
050    
051        public String getName()
052        {
053            return _name;
054        }
055    
056        /**
057         * Returns the namespace containing the page.
058         */
059    
060        public INamespace getNamespace()
061        {
062            return _namespace;
063        }
064    
065        /**
066         * Returns the specification defining the page.
067         */
068        public IComponentSpecification getSpecification()
069        {
070            return _specification;
071        }
072    
073    }