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.parse;
016
017 import java.util.ArrayList;
018 import java.util.List;
019
020 import org.apache.hivemind.Element;
021 import org.apache.hivemind.impl.BaseLocatable;
022 import org.apache.hivemind.util.ToStringBuilder;
023
024 /**
025 * Base class for descriptors that represent invocating a service with parameters.
026 * This is used for the <interceptor> and <invoke-factory> elements.
027 *
028 * @author Howard Lewis Ship
029 */
030 public abstract class AbstractServiceInvocationDescriptor extends BaseLocatable
031 {
032 private String _factoryServiceId;
033
034 private List _parameters;
035
036 public void addParameter(Element parameter)
037 {
038 if (_parameters == null)
039 _parameters = new ArrayList();
040
041 _parameters.add(parameter);
042 }
043
044 public List getParameters()
045 {
046 return _parameters;
047 }
048
049 public String getFactoryServiceId()
050 {
051 return _factoryServiceId;
052 }
053
054 public void setFactoryServiceId(String string)
055 {
056 _factoryServiceId = string;
057 }
058
059 public String toString()
060 {
061 ToStringBuilder builder = new ToStringBuilder(this);
062
063 builder.append("factoryServiceId", _factoryServiceId);
064 builder.append("parameters", _parameters);
065
066 extendDescription(builder);
067
068 return builder.toString();
069 }
070
071 /**
072 * Overridden in subclasses to provide more information about
073 * the instance. This implementation does nothing.
074 */
075 protected void extendDescription(ToStringBuilder builder)
076 {
077 }
078
079
080 }