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.spec;
016    
017    import org.apache.hivemind.ClassResolver;
018    import org.apache.tapestry.bean.BindingBeanInitializer;
019    import org.apache.tapestry.binding.BindingSource;
020    import org.apache.tapestry.coerce.ValueConverter;
021    
022    /**
023     * A Factory used by {@link org.apache.tapestry.parse.SpecificationParser}  to create Tapestry
024     * domain objects.
025     * <p>
026     * The default implementation here creates the expected runtime instances of classes in packages:
027     * <ul>
028     * <li>org.apache.tapestry.spec</li>
029     * <li>org.apache.tapestry.bean</li>
030     * </ul>
031     * <p>
032     * This class is extended by Spindle - the Eclipse Plugin for Tapestry
033     * 
034     * @author GWL
035     * @since 1.0.9
036     */
037    
038    public class SpecFactory
039    {
040        /**
041         * Creates a concrete instance of {@link ApplicationSpecification}.
042         */
043    
044        public IApplicationSpecification createApplicationSpecification()
045        {
046            return new ApplicationSpecification();
047        }
048    
049        /**
050         * Creates an instance of {@link LibrarySpecification}.
051         * 
052         * @since 2.2
053         */
054    
055        public ILibrarySpecification createLibrarySpecification()
056        {
057            return new LibrarySpecification();
058        }
059    
060        /**
061         * Returns a new instance of {@link IAssetSpecification}.
062         * 
063         * @since 3.0
064         */
065    
066        public IAssetSpecification createAssetSpecification()
067        {
068            return new AssetSpecification();
069        }
070    
071        /**
072         * Creates a new instance of {@link IBeanSpecification}.
073         * 
074         * @since 3.0
075         */
076    
077        public IBeanSpecification createBeanSpecification()
078        {
079            return new BeanSpecification();
080        }
081    
082        public IBindingSpecification createBindingSpecification()
083        {
084            return new BindingSpecification();
085        }
086    
087        /**
088         * Creates a concrete instance of {@link IComponentSpecification}.
089         */
090    
091        public IComponentSpecification createComponentSpecification()
092        {
093            return new ComponentSpecification();
094        }
095    
096        /**
097         * Creates a concrete instance of {@link IContainedComponent}.
098         */
099    
100        public IContainedComponent createContainedComponent()
101        {
102            return new ContainedComponent();
103        }
104    
105        /**
106         * Creates a concrete instance of {@link ParameterSpecification}.
107         */
108    
109        public IParameterSpecification createParameterSpecification()
110        {
111            return new ParameterSpecification();
112        }
113    
114        /** @since 4.0 */
115        public BindingBeanInitializer createBindingBeanInitializer(BindingSource source)
116        {
117            return new BindingBeanInitializer(source);
118        }
119    
120        /**
121         * Creates a concrete instance of {@link org.apache.tapestry.spec.IExtensionSpecification}.
122         * 
123         * @since 2.2
124         */
125    
126        public IExtensionSpecification createExtensionSpecification(ClassResolver resolver,
127                ValueConverter valueConverter)
128        {
129            return new ExtensionSpecification(resolver, valueConverter);
130        }
131    
132        /**
133         * Creates a concrete instance of {@link org.apache.tapestry.spec.IPropertySpecification}.
134         * 
135         * @since 3.0
136         */
137    
138        public IPropertySpecification createPropertySpecification()
139        {
140            return new PropertySpecification();
141        }
142    
143        /** @since 4.0 */
144        public InjectSpecification createInjectSpecification()
145        {
146            return new InjectSpecificationImpl();
147        }
148    }