001    // Copyright 2007 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.hivemind.definition.impl;
016    
017    import org.apache.hivemind.Location;
018    import org.apache.hivemind.definition.ImplementationConstructor;
019    import org.apache.hivemind.definition.ImplementationDefinition;
020    import org.apache.hivemind.definition.ModuleDefinition;
021    
022    /**
023     * Default implementation of {@link ImplementationDefinition}.
024     * 
025     * @author Achim Huegen
026     */
027    public class ImplementationDefinitionImpl extends ExtensionDefinitionImpl implements
028            ImplementationDefinition
029    {
030        private String _serviceModel;
031    
032        private ImplementationConstructor _implementationConstructor;
033    
034        private boolean _isDefault;
035    
036        public ImplementationDefinitionImpl(ModuleDefinition module)
037        {
038            super(module);
039        }
040    
041        public ImplementationDefinitionImpl(ModuleDefinition module, Location location,
042                ImplementationConstructor implementationConstructor, String serviceModel, boolean isDefault)
043        {
044            super(module, location);
045            _implementationConstructor = implementationConstructor;
046            _serviceModel = serviceModel;
047            _isDefault = isDefault;
048        }
049    
050        /**
051         * @see org.apache.hivemind.definition.ImplementationDefinition#getServiceModel()
052         */
053        public String getServiceModel()
054        {
055            return _serviceModel;
056        }
057    
058        /**
059         * Sets the service model of the implementation.
060         */
061        public void setServiceModel(String serviceModel)
062        {
063            _serviceModel = serviceModel;
064        }
065    
066        /**
067         * @see org.apache.hivemind.definition.ImplementationDefinition#isDefault()
068         */
069        public boolean isDefault()
070        {
071            return _isDefault;
072        }
073    
074        /**
075         * Sets the default attribute of the implementation.
076         * @param isDefault   true, if this implementation is the default one
077         */
078        public void setDefault(boolean isDefault)
079        {
080            _isDefault = isDefault;
081        }
082    
083        /**
084         * @see org.apache.hivemind.definition.ImplementationDefinition#getServiceConstructor()
085         */
086        public ImplementationConstructor getServiceConstructor()
087        {
088            return _implementationConstructor;
089        }
090    
091        /**
092         * Sets the constructor implementation that is used for the creation of
093         * the implementation instance.
094         */
095        public void setImplementationConstructor(ImplementationConstructor serviceConstructor)
096        {
097            _implementationConstructor = serviceConstructor;
098        }
099    
100    }