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.hivemind;
016
017 import org.apache.commons.logging.Log;
018 import org.apache.hivemind.internal.Module;
019
020 /**
021 * Used when constructing an interceptor stack around
022 * a service implementation instance.
023 *
024 * @author Howard Lewis Ship
025 */
026 public interface InterceptorStack
027 {
028 /**
029 * Return the full id of the service extension point for which
030 * interceptors are being fabricated.
031 */
032
033 public String getServiceExtensionPointId();
034
035 /**
036 * Returns the module which contains the service extension point.
037 */
038
039 public Module getServiceModule();
040
041 /**
042 * Returns the interface for the service; the same
043 * as {@link org.apache.hivemind.internal.ServicePoint#getServiceInterface()}.
044 */
045 public Class getServiceInterface();
046
047 /**
048 * Returns the current top object on the stack.
049 */
050 public Object peek();
051
052 /**
053 * Pushes a new instance onto the stack. The new instance
054 * should be a wrapper around {@link #peek()}, and should
055 * implement the service extension point's interface.
056 *
057 * <p>The stack checks that the interceptor is not null,
058 * and that the interceptor implements the service interface.
059 */
060
061 public void push(Object interceptor);
062
063 /**
064 * Returns the Log instance that should be used to log any information
065 * about the service, or the construction of the service.
066 */
067
068 public Log getServiceLog();
069 }