KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > parse > CreateInstanceDescriptor


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// 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.definition.ImplementationConstructor;
18 import org.apache.hivemind.impl.BaseLocatable;
19 import org.apache.hivemind.impl.CreateClassServiceConstructor;
20 import org.apache.hivemind.util.ToStringBuilder;
21
22 /**
23  * Descriptor for the <create-instance< element, used to create
24  * a core service implementation from a class name.
25  *
26  * @author Howard Lewis Ship
27  */

28 public final class CreateInstanceDescriptor extends BaseLocatable implements InstanceBuilder
29 {
30     private String JavaDoc _serviceModel = "singleton";
31     private String JavaDoc _instanceClassName;
32
33     public String JavaDoc getInstanceClassName()
34     {
35         return _instanceClassName;
36     }
37
38     public void setInstanceClassName(String JavaDoc string)
39     {
40         _instanceClassName = string;
41     }
42
43     public ImplementationConstructor createConstructor(
44         String JavaDoc contributingModuleId)
45     {
46         CreateClassServiceConstructor result = new CreateClassServiceConstructor(
47                 getLocation(), _instanceClassName);
48
49         return result;
50     }
51
52     public String JavaDoc toString()
53     {
54         ToStringBuilder builder = new ToStringBuilder(this);
55
56         builder.append("instanceClassName", _instanceClassName);
57         builder.append("serviceModel", _serviceModel);
58
59         return builder.toString();
60     }
61
62     public String JavaDoc getServiceModel()
63     {
64         return _serviceModel;
65     }
66
67     public void setServiceModel(String JavaDoc serviceModel)
68     {
69         _serviceModel = serviceModel;
70     }
71
72 }
73
Popular Tags