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.InterceptorConstructor;
019 import org.apache.hivemind.definition.InterceptorDefinition;
020 import org.apache.hivemind.definition.ModuleDefinition;
021
022 /**
023 * Default implementation of {@link InterceptorDefinition}.
024 * Implementations of this interface may additionally implement the {@link org.apache.hivemind.Orderable}
025 * interface if a certain interceptor order is required.
026 *
027 * @author Achim Huegen
028 */
029 public class InterceptorDefinitionImpl extends ExtensionDefinitionImpl implements InterceptorDefinition
030 {
031 private InterceptorConstructor _interceptorConstructor;
032 private String _name;
033
034 public InterceptorDefinitionImpl(ModuleDefinition module)
035 {
036 super(module);
037 }
038
039 public InterceptorDefinitionImpl(ModuleDefinition module, String name, Location location,
040 InterceptorConstructor interceptorConstructor)
041 {
042 super(module, location);
043 _name = name;
044 _interceptorConstructor = interceptorConstructor;
045 }
046
047 /**
048 * @see org.apache.hivemind.definition.InterceptorDefinition#getInterceptorConstructor()
049 */
050 public InterceptorConstructor getInterceptorConstructor()
051 {
052 return _interceptorConstructor;
053 }
054
055 /**
056 * Sets the constructor implementation responsible for the creation of interceptor instances.
057 */
058 public void setInterceptorConstructor(InterceptorConstructor interceptorConstructor)
059 {
060 _interceptorConstructor = interceptorConstructor;
061 }
062
063 /**
064 * @see org.apache.hivemind.definition.InterceptorDefinition#getName()
065 */
066 public String getName()
067 {
068 return _name;
069 }
070
071 /**
072 * Sets the name of the interceptor.
073 */
074 public void setName(String name)
075 {
076 _name = name;
077 }
078
079 }