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 org.apache.hivemind.impl.BaseLocatable;
18: import org.apache.hivemind.impl.CreateClassServiceConstructor;
19: import org.apache.hivemind.internal.Module;
20: import org.apache.hivemind.internal.ServicePoint;
21: import org.apache.hivemind.internal.ServiceImplementationConstructor;
22: import org.apache.hivemind.util.ToStringBuilder;
23:
24: /**
25: * Descriptor for the <create-instance< element, used to create
26: * a core service implementation from a class name.
27: *
28: * @author Howard Lewis Ship
29: */
30: public final class CreateInstanceDescriptor extends BaseLocatable
31: implements InstanceBuilder {
32: private String _serviceModel = "singleton";
33: private String _instanceClassName;
34:
35: public String getInstanceClassName() {
36: return _instanceClassName;
37: }
38:
39: public void setInstanceClassName(String string) {
40: _instanceClassName = string;
41: }
42:
43: public ServiceImplementationConstructor createConstructor(
44: ServicePoint point, Module contributingModule) {
45: CreateClassServiceConstructor result = new CreateClassServiceConstructor();
46:
47: result.setLocation(getLocation());
48: result.setContributingModule(contributingModule);
49: result.setInstanceClassName(_instanceClassName);
50:
51: return result;
52: }
53:
54: public String toString() {
55: ToStringBuilder builder = new ToStringBuilder(this );
56:
57: builder.append("instanceClassName", _instanceClassName);
58: builder.append("serviceModel", _serviceModel);
59:
60: return builder.toString();
61: }
62:
63: public String getServiceModel() {
64: return _serviceModel;
65: }
66:
67: public void setServiceModel(String serviceModel) {
68: _serviceModel = serviceModel;
69: }
70:
71: }
|