01: // Copyright 2004, 2005 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.hivemind.parse;
16:
17: import java.util.ArrayList;
18: import java.util.List;
19:
20: import org.apache.hivemind.Element;
21: import org.apache.hivemind.impl.BaseLocatable;
22: import org.apache.hivemind.util.ToStringBuilder;
23:
24: /**
25: * Base class for descriptors that represent invocating a service with parameters.
26: * This is used for the <interceptor> and <invoke-factory> elements.
27: *
28: * @author Howard Lewis Ship
29: */
30: public abstract class AbstractServiceInvocationDescriptor extends
31: BaseLocatable {
32: private String _factoryServiceId;
33:
34: private List _parameters;
35:
36: public void addParameter(Element parameter) {
37: if (_parameters == null)
38: _parameters = new ArrayList();
39:
40: _parameters.add(parameter);
41: }
42:
43: public List getParameters() {
44: return _parameters;
45: }
46:
47: public String getFactoryServiceId() {
48: return _factoryServiceId;
49: }
50:
51: public void setFactoryServiceId(String string) {
52: _factoryServiceId = string;
53: }
54:
55: public String toString() {
56: ToStringBuilder builder = new ToStringBuilder(this );
57:
58: builder.append("factoryServiceId", _factoryServiceId);
59: builder.append("parameters", _parameters);
60:
61: extendDescription(builder);
62:
63: return builder.toString();
64: }
65:
66: /**
67: * Overridden in subclasses to provide more information about
68: * the instance. This implementation does nothing.
69: */
70: protected void extendDescription(ToStringBuilder builder) {
71: }
72:
73: }
|