1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.impl; |
7 | |
8 | import de.uka.ipd.sdq.pcm.repository.*; |
9 | import org.eclipse.emf.ecore.EClass; |
10 | import org.eclipse.emf.ecore.EDataType; |
11 | import org.eclipse.emf.ecore.EObject; |
12 | import org.eclipse.emf.ecore.EPackage; |
13 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
14 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
15 | |
16 | import de.uka.ipd.sdq.pcm.repository.BasicComponent; |
17 | import de.uka.ipd.sdq.pcm.repository.CollectionDataType; |
18 | import de.uka.ipd.sdq.pcm.repository.CompleteComponentType; |
19 | import de.uka.ipd.sdq.pcm.repository.ComponentType; |
20 | import de.uka.ipd.sdq.pcm.repository.CompositeComponent; |
21 | import de.uka.ipd.sdq.pcm.repository.CompositeDataType; |
22 | import de.uka.ipd.sdq.pcm.repository.EventGroup; |
23 | import de.uka.ipd.sdq.pcm.repository.EventType; |
24 | import de.uka.ipd.sdq.pcm.repository.ExceptionType; |
25 | import de.uka.ipd.sdq.pcm.repository.InfrastructureInterface; |
26 | import de.uka.ipd.sdq.pcm.repository.InfrastructureProvidedRole; |
27 | import de.uka.ipd.sdq.pcm.repository.InfrastructureRequiredRole; |
28 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
29 | import de.uka.ipd.sdq.pcm.repository.InnerDeclaration; |
30 | import de.uka.ipd.sdq.pcm.repository.OperationInterface; |
31 | import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole; |
32 | import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole; |
33 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
34 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
35 | import de.uka.ipd.sdq.pcm.repository.ParameterModifier; |
36 | import de.uka.ipd.sdq.pcm.repository.PassiveResource; |
37 | import de.uka.ipd.sdq.pcm.repository.PrimitiveDataType; |
38 | import de.uka.ipd.sdq.pcm.repository.PrimitiveTypeEnum; |
39 | import de.uka.ipd.sdq.pcm.repository.ProvidesComponentType; |
40 | import de.uka.ipd.sdq.pcm.repository.Repository; |
41 | import de.uka.ipd.sdq.pcm.repository.RepositoryFactory; |
42 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
43 | import de.uka.ipd.sdq.pcm.repository.RequiredCharacterisation; |
44 | import de.uka.ipd.sdq.pcm.repository.SinkRole; |
45 | import de.uka.ipd.sdq.pcm.repository.SourceRole; |
46 | |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * An implementation of the model <b>Factory</b>. |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | public class RepositoryFactoryImpl extends EFactoryImpl implements RepositoryFactory { |
54 | /** |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
60 | |
61 | /** |
62 | * Creates the default factory implementation. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | public static RepositoryFactory init() { |
68 | try { |
69 | RepositoryFactory theRepositoryFactory = (RepositoryFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.uka.de/PalladioComponentModel/Repository/4.0"); |
70 | if (theRepositoryFactory != null) { |
71 | return theRepositoryFactory; |
72 | } |
73 | } |
74 | catch (Exception exception) { |
75 | EcorePlugin.INSTANCE.log(exception); |
76 | } |
77 | return new RepositoryFactoryImpl(); |
78 | } |
79 | |
80 | /** |
81 | * Creates an instance of the factory. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public RepositoryFactoryImpl() { |
87 | super(); |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | @Override |
96 | public EObject create(EClass eClass) { |
97 | switch (eClass.getClassifierID()) { |
98 | case RepositoryPackage.PASSIVE_RESOURCE: return createPassiveResource(); |
99 | case RepositoryPackage.BASIC_COMPONENT: return createBasicComponent(); |
100 | case RepositoryPackage.PARAMETER: return createParameter(); |
101 | case RepositoryPackage.REPOSITORY: return createRepository(); |
102 | case RepositoryPackage.REQUIRED_CHARACTERISATION: return createRequiredCharacterisation(); |
103 | case RepositoryPackage.EVENT_GROUP: return createEventGroup(); |
104 | case RepositoryPackage.EVENT_TYPE: return createEventType(); |
105 | case RepositoryPackage.EXCEPTION_TYPE: return createExceptionType(); |
106 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE: return createInfrastructureSignature(); |
107 | case RepositoryPackage.INFRASTRUCTURE_INTERFACE: return createInfrastructureInterface(); |
108 | case RepositoryPackage.INFRASTRUCTURE_REQUIRED_ROLE: return createInfrastructureRequiredRole(); |
109 | case RepositoryPackage.OPERATION_SIGNATURE: return createOperationSignature(); |
110 | case RepositoryPackage.OPERATION_INTERFACE: return createOperationInterface(); |
111 | case RepositoryPackage.OPERATION_REQUIRED_ROLE: return createOperationRequiredRole(); |
112 | case RepositoryPackage.SOURCE_ROLE: return createSourceRole(); |
113 | case RepositoryPackage.SINK_ROLE: return createSinkRole(); |
114 | case RepositoryPackage.OPERATION_PROVIDED_ROLE: return createOperationProvidedRole(); |
115 | case RepositoryPackage.INFRASTRUCTURE_PROVIDED_ROLE: return createInfrastructureProvidedRole(); |
116 | case RepositoryPackage.COMPLETE_COMPONENT_TYPE: return createCompleteComponentType(); |
117 | case RepositoryPackage.PROVIDES_COMPONENT_TYPE: return createProvidesComponentType(); |
118 | case RepositoryPackage.COMPOSITE_COMPONENT: return createCompositeComponent(); |
119 | case RepositoryPackage.PRIMITIVE_DATA_TYPE: return createPrimitiveDataType(); |
120 | case RepositoryPackage.COLLECTION_DATA_TYPE: return createCollectionDataType(); |
121 | case RepositoryPackage.COMPOSITE_DATA_TYPE: return createCompositeDataType(); |
122 | case RepositoryPackage.INNER_DECLARATION: return createInnerDeclaration(); |
123 | default: |
124 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
125 | } |
126 | } |
127 | |
128 | /** |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public Object createFromString(EDataType eDataType, String initialValue) { |
135 | switch (eDataType.getClassifierID()) { |
136 | case RepositoryPackage.PARAMETER_MODIFIER: |
137 | return createParameterModifierFromString(eDataType, initialValue); |
138 | case RepositoryPackage.COMPONENT_TYPE: |
139 | return createComponentTypeFromString(eDataType, initialValue); |
140 | case RepositoryPackage.PRIMITIVE_TYPE_ENUM: |
141 | return createPrimitiveTypeEnumFromString(eDataType, initialValue); |
142 | default: |
143 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
144 | } |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | public String convertToString(EDataType eDataType, Object instanceValue) { |
154 | switch (eDataType.getClassifierID()) { |
155 | case RepositoryPackage.PARAMETER_MODIFIER: |
156 | return convertParameterModifierToString(eDataType, instanceValue); |
157 | case RepositoryPackage.COMPONENT_TYPE: |
158 | return convertComponentTypeToString(eDataType, instanceValue); |
159 | case RepositoryPackage.PRIMITIVE_TYPE_ENUM: |
160 | return convertPrimitiveTypeEnumToString(eDataType, instanceValue); |
161 | default: |
162 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
163 | } |
164 | } |
165 | |
166 | /** |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | public PassiveResource createPassiveResource() { |
172 | PassiveResourceImpl passiveResource = new PassiveResourceImpl(); |
173 | return passiveResource; |
174 | } |
175 | |
176 | /** |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | public BasicComponent createBasicComponent() { |
182 | BasicComponentImpl basicComponent = new BasicComponentImpl(); |
183 | return basicComponent; |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | public Repository createRepository() { |
192 | RepositoryImpl repository = new RepositoryImpl(); |
193 | return repository; |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | public RequiredCharacterisation createRequiredCharacterisation() { |
202 | RequiredCharacterisationImpl requiredCharacterisation = new RequiredCharacterisationImpl(); |
203 | return requiredCharacterisation; |
204 | } |
205 | |
206 | /** |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | public Parameter createParameter() { |
212 | ParameterImpl parameter = new ParameterImpl(); |
213 | return parameter; |
214 | } |
215 | |
216 | /** |
217 | * <!-- begin-user-doc --> |
218 | * <!-- end-user-doc --> |
219 | * @generated |
220 | */ |
221 | public ComponentType createComponentTypeFromString(EDataType eDataType, String initialValue) { |
222 | ComponentType result = ComponentType.get(initialValue); |
223 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
224 | return result; |
225 | } |
226 | |
227 | /** |
228 | * <!-- begin-user-doc --> |
229 | * <!-- end-user-doc --> |
230 | * @generated |
231 | */ |
232 | public String convertComponentTypeToString(EDataType eDataType, Object instanceValue) { |
233 | return instanceValue == null ? null : instanceValue.toString(); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | public OperationSignature createOperationSignature() { |
242 | OperationSignatureImpl operationSignature = new OperationSignatureImpl(); |
243 | return operationSignature; |
244 | } |
245 | |
246 | /** |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | public ExceptionType createExceptionType() { |
252 | ExceptionTypeImpl exceptionType = new ExceptionTypeImpl(); |
253 | return exceptionType; |
254 | } |
255 | |
256 | /** |
257 | * <!-- begin-user-doc --> |
258 | * <!-- end-user-doc --> |
259 | * @generated |
260 | */ |
261 | public OperationInterface createOperationInterface() { |
262 | OperationInterfaceImpl operationInterface = new OperationInterfaceImpl(); |
263 | return operationInterface; |
264 | } |
265 | |
266 | /** |
267 | * <!-- begin-user-doc --> |
268 | * <!-- end-user-doc --> |
269 | * @generated |
270 | */ |
271 | public InfrastructureSignature createInfrastructureSignature() { |
272 | InfrastructureSignatureImpl infrastructureSignature = new InfrastructureSignatureImpl(); |
273 | return infrastructureSignature; |
274 | } |
275 | |
276 | /** |
277 | * <!-- begin-user-doc --> |
278 | * <!-- end-user-doc --> |
279 | * @generated |
280 | */ |
281 | public InfrastructureRequiredRole createInfrastructureRequiredRole() { |
282 | InfrastructureRequiredRoleImpl infrastructureRequiredRole = new InfrastructureRequiredRoleImpl(); |
283 | return infrastructureRequiredRole; |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | public EventType createEventType() { |
292 | EventTypeImpl eventType = new EventTypeImpl(); |
293 | return eventType; |
294 | } |
295 | |
296 | /** |
297 | * <!-- begin-user-doc --> |
298 | * <!-- end-user-doc --> |
299 | * @generated |
300 | */ |
301 | public EventGroup createEventGroup() { |
302 | EventGroupImpl eventGroup = new EventGroupImpl(); |
303 | return eventGroup; |
304 | } |
305 | |
306 | /** |
307 | * <!-- begin-user-doc --> |
308 | * <!-- end-user-doc --> |
309 | * @generated |
310 | */ |
311 | public CompleteComponentType createCompleteComponentType() { |
312 | CompleteComponentTypeImpl completeComponentType = new CompleteComponentTypeImpl(); |
313 | return completeComponentType; |
314 | } |
315 | |
316 | /** |
317 | * <!-- begin-user-doc --> |
318 | * <!-- end-user-doc --> |
319 | * @generated |
320 | */ |
321 | public ProvidesComponentType createProvidesComponentType() { |
322 | ProvidesComponentTypeImpl providesComponentType = new ProvidesComponentTypeImpl(); |
323 | return providesComponentType; |
324 | } |
325 | |
326 | /** |
327 | * <!-- begin-user-doc --> |
328 | * <!-- end-user-doc --> |
329 | * @generated |
330 | */ |
331 | public OperationRequiredRole createOperationRequiredRole() { |
332 | OperationRequiredRoleImpl operationRequiredRole = new OperationRequiredRoleImpl(); |
333 | return operationRequiredRole; |
334 | } |
335 | |
336 | /** |
337 | * <!-- begin-user-doc --> |
338 | * <!-- end-user-doc --> |
339 | * @generated |
340 | */ |
341 | public SourceRole createSourceRole() { |
342 | SourceRoleImpl sourceRole = new SourceRoleImpl(); |
343 | return sourceRole; |
344 | } |
345 | |
346 | /** |
347 | * <!-- begin-user-doc --> |
348 | * <!-- end-user-doc --> |
349 | * @generated |
350 | */ |
351 | public InfrastructureProvidedRole createInfrastructureProvidedRole() { |
352 | InfrastructureProvidedRoleImpl infrastructureProvidedRole = new InfrastructureProvidedRoleImpl(); |
353 | return infrastructureProvidedRole; |
354 | } |
355 | |
356 | /** |
357 | * <!-- begin-user-doc --> |
358 | * <!-- end-user-doc --> |
359 | * @generated |
360 | */ |
361 | public OperationProvidedRole createOperationProvidedRole() { |
362 | OperationProvidedRoleImpl operationProvidedRole = new OperationProvidedRoleImpl(); |
363 | return operationProvidedRole; |
364 | } |
365 | |
366 | /** |
367 | * <!-- begin-user-doc --> |
368 | * <!-- end-user-doc --> |
369 | * @generated |
370 | */ |
371 | public CompositeComponent createCompositeComponent() { |
372 | CompositeComponentImpl compositeComponent = new CompositeComponentImpl(); |
373 | return compositeComponent; |
374 | } |
375 | |
376 | /** |
377 | * <!-- begin-user-doc --> |
378 | * <!-- end-user-doc --> |
379 | * @generated |
380 | */ |
381 | public SinkRole createSinkRole() { |
382 | SinkRoleImpl sinkRole = new SinkRoleImpl(); |
383 | return sinkRole; |
384 | } |
385 | |
386 | /** |
387 | * <!-- begin-user-doc --> |
388 | * <!-- end-user-doc --> |
389 | * @generated |
390 | */ |
391 | public PrimitiveDataType createPrimitiveDataType() { |
392 | PrimitiveDataTypeImpl primitiveDataType = new PrimitiveDataTypeImpl(); |
393 | return primitiveDataType; |
394 | } |
395 | |
396 | /** |
397 | * <!-- begin-user-doc --> |
398 | * <!-- end-user-doc --> |
399 | * @generated |
400 | */ |
401 | public CollectionDataType createCollectionDataType() { |
402 | CollectionDataTypeImpl collectionDataType = new CollectionDataTypeImpl(); |
403 | return collectionDataType; |
404 | } |
405 | |
406 | /** |
407 | * <!-- begin-user-doc --> |
408 | * <!-- end-user-doc --> |
409 | * @generated |
410 | */ |
411 | public CompositeDataType createCompositeDataType() { |
412 | CompositeDataTypeImpl compositeDataType = new CompositeDataTypeImpl(); |
413 | return compositeDataType; |
414 | } |
415 | |
416 | /** |
417 | * <!-- begin-user-doc --> |
418 | * <!-- end-user-doc --> |
419 | * @generated |
420 | */ |
421 | public InnerDeclaration createInnerDeclaration() { |
422 | InnerDeclarationImpl innerDeclaration = new InnerDeclarationImpl(); |
423 | return innerDeclaration; |
424 | } |
425 | |
426 | /** |
427 | * <!-- begin-user-doc --> |
428 | * <!-- end-user-doc --> |
429 | * @generated |
430 | */ |
431 | public InfrastructureInterface createInfrastructureInterface() { |
432 | InfrastructureInterfaceImpl infrastructureInterface = new InfrastructureInterfaceImpl(); |
433 | return infrastructureInterface; |
434 | } |
435 | |
436 | /** |
437 | * <!-- begin-user-doc --> |
438 | * <!-- end-user-doc --> |
439 | * @generated |
440 | */ |
441 | public ParameterModifier createParameterModifierFromString(EDataType eDataType, String initialValue) { |
442 | ParameterModifier result = ParameterModifier.get(initialValue); |
443 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
444 | return result; |
445 | } |
446 | |
447 | /** |
448 | * <!-- begin-user-doc --> |
449 | * <!-- end-user-doc --> |
450 | * @generated |
451 | */ |
452 | public String convertParameterModifierToString(EDataType eDataType, Object instanceValue) { |
453 | return instanceValue == null ? null : instanceValue.toString(); |
454 | } |
455 | |
456 | /** |
457 | * <!-- begin-user-doc --> |
458 | * <!-- end-user-doc --> |
459 | * @generated |
460 | */ |
461 | public PrimitiveTypeEnum createPrimitiveTypeEnumFromString(EDataType eDataType, String initialValue) { |
462 | PrimitiveTypeEnum result = PrimitiveTypeEnum.get(initialValue); |
463 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
464 | return result; |
465 | } |
466 | |
467 | /** |
468 | * <!-- begin-user-doc --> |
469 | * <!-- end-user-doc --> |
470 | * @generated |
471 | */ |
472 | public String convertPrimitiveTypeEnumToString(EDataType eDataType, Object instanceValue) { |
473 | return instanceValue == null ? null : instanceValue.toString(); |
474 | } |
475 | |
476 | /** |
477 | * <!-- begin-user-doc --> |
478 | * <!-- end-user-doc --> |
479 | * @generated |
480 | */ |
481 | public RepositoryPackage getRepositoryPackage() { |
482 | return (RepositoryPackage)getEPackage(); |
483 | } |
484 | |
485 | /** |
486 | * <!-- begin-user-doc --> |
487 | * <!-- end-user-doc --> |
488 | * @deprecated |
489 | * @generated |
490 | */ |
491 | @Deprecated |
492 | public static RepositoryPackage getPackage() { |
493 | return RepositoryPackage.eINSTANCE; |
494 | } |
495 | |
496 | } //RepositoryFactoryImpl |