1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.jdtaus.core.container.ri.client;
22
23 import java.util.HashMap;
24 import java.util.Map;
25 import org.jdtaus.core.container.Dependency;
26 import org.jdtaus.core.container.Implementation;
27 import org.jdtaus.core.container.Messages;
28 import org.jdtaus.core.container.Properties;
29
30
31
32
33
34
35
36 class Instance
37 {
38
39
40 private int scope;
41
42
43 private String className;
44
45
46 private String modelVersion;
47
48
49 private String moduleName;
50
51
52 private Map dependencies;
53
54
55 private Implementation implementation;
56
57
58 private Dependency dependency;
59
60
61 private ClassLoader classLoader;
62
63 public Instance( final ClassLoader classLoader, final int scope,
64 final String className, final String modelVersion,
65 final String moduleName )
66 {
67 this.classLoader = classLoader;
68 this.scope = scope;
69 this.className = className;
70 this.modelVersion = modelVersion;
71 this.moduleName = moduleName;
72 }
73
74 public ClassLoader getClassLoader()
75 {
76 return this.classLoader;
77 }
78
79 public int getScope()
80 {
81 return this.scope;
82 }
83
84 public String getClassName()
85 {
86 return this.className;
87 }
88
89 public String getModelVersion()
90 {
91 return this.modelVersion;
92 }
93
94 public String getModuleName()
95 {
96 return this.moduleName;
97 }
98
99 public Implementation getImplementation()
100 {
101 return this.implementation;
102 }
103
104 public void setImplementation( final Implementation implementation )
105 {
106 this.implementation = implementation;
107 }
108
109 public Dependency getDependency()
110 {
111 return this.dependency;
112 }
113
114 public void setDependency( final Dependency dependency )
115 {
116 this.dependency = dependency;
117 }
118
119 public Properties getProperties()
120 {
121 Properties properties = null;
122
123 if ( this.implementation != null )
124 {
125 properties = this.implementation.getProperties();
126 }
127 else if ( this.dependency != null )
128 {
129 properties = this.dependency.getProperties();
130 }
131
132 return properties;
133 }
134
135 public Messages getMessages()
136 {
137 Messages messages = null;
138
139 if ( this.implementation != null )
140 {
141 messages = this.implementation.getMessages();
142 }
143 else if ( this.dependency != null )
144 {
145 messages = this.dependency.getImplementation().getMessages();
146 }
147
148 return messages;
149 }
150
151 public Object getDependencyObject(
152 final String dependencyName )
153 {
154 if ( this.dependencies == null )
155 {
156 this.dependencies = new HashMap();
157 }
158
159 return this.dependencies.get( dependencyName );
160 }
161
162 public void setDependencyObject( final String dependencyName,
163 final Object object )
164 {
165 if ( this.dependencies == null )
166 {
167 this.dependencies = new HashMap();
168 }
169
170 this.dependencies.put( dependencyName, object );
171 }
172
173 }