001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.config.impl;
008
009 import java.io.File;
010 import java.util.logging.Logger;
011
012 import org.codehaus.janino.ScriptEvaluator;
013 import org.eclipse.emf.common.notify.Notification;
014 import org.eclipse.emf.common.notify.NotificationChain;
015 import org.eclipse.emf.common.util.EList;
016 import org.eclipse.emf.ecore.EClass;
017 import org.eclipse.emf.ecore.InternalEObject;
018 import org.eclipse.emf.ecore.impl.ENotificationImpl;
019 import org.eclipse.emf.ecore.impl.EObjectImpl;
020 import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
021 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
022 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
023 import org.eclipse.emf.ecore.util.InternalEList;
024
025 import com.hammurapi.config.Collection;
026 import com.hammurapi.config.ConfigPackage;
027 import com.hammurapi.config.Factory;
028 import com.hammurapi.config.Source;
029 import com.hammurapi.config.bootstrap.ConfigurationException;
030 import com.hammurapi.config.bootstrap.FactoryClosure;
031 import com.hammurapi.config.bootstrap.TokenExpander.TokenSource;
032 import com.hammurapi.config.runtime.Component;
033 import com.hammurapi.config.runtime.ConfigurationContext;
034 import com.hammurapi.config.runtime.FactoryClosureBase;
035 import com.hammurapi.config.runtime.FactoryConfig;
036 import com.hammurapi.party.PartyPackage;
037 import com.hammurapi.party.Role;
038
039 /**
040 * <!-- begin-user-doc -->
041 * An implementation of the model object '<em><b>Collection</b></em>'.
042 * <!-- end-user-doc -->
043 * <p>
044 * The following features are implemented:
045 * <ul>
046 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getRoles <em>Roles</em>}</li>
047 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getDescription <em>Description</em>}</li>
048 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getConfigScript <em>Config Script</em>}</li>
049 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getId <em>Id</em>}</li>
050 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getSource <em>Source</em>}</li>
051 * <li>{@link com.hammurapi.config.impl.CollectionImpl#isEnabled <em>Enabled</em>}</li>
052 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getService <em>Service</em>}</li>
053 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getSupportedExecutionEnvironments <em>Supported Execution Environments</em>}</li>
054 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getHomePage <em>Home Page</em>}</li>
055 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getElement <em>Element</em>}</li>
056 * <li>{@link com.hammurapi.config.impl.CollectionImpl#getType <em>Type</em>}</li>
057 * <li>{@link com.hammurapi.config.impl.CollectionImpl#isFactoryCollection <em>Factory Collection</em>}</li>
058 * </ul>
059 * </p>
060 *
061 * @generated
062 */
063 public class CollectionImpl extends EObjectImpl implements Collection {
064 /**
065 * The cached value of the '{@link #getRoles() <em>Roles</em>}' containment reference list.
066 * <!-- begin-user-doc -->
067 * <!-- end-user-doc -->
068 * @see #getRoles()
069 * @generated
070 * @ordered
071 */
072 protected EList<Role> roles;
073 private static final Logger logger = Logger.getLogger(CollectionImpl.class.getName());
074 /**
075 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
076 * <!-- begin-user-doc -->
077 * <!-- end-user-doc -->
078 * @see #getDescription()
079 * @generated
080 * @ordered
081 */
082 protected static final String DESCRIPTION_EDEFAULT = null;
083
084 /**
085 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
086 * <!-- begin-user-doc -->
087 * <!-- end-user-doc -->
088 * @see #getDescription()
089 * @generated
090 * @ordered
091 */
092 protected String description = DESCRIPTION_EDEFAULT;
093
094 /**
095 * The default value of the '{@link #getConfigScript() <em>Config Script</em>}' attribute.
096 * <!-- begin-user-doc -->
097 * <!-- end-user-doc -->
098 * @see #getConfigScript()
099 * @generated
100 * @ordered
101 */
102 protected static final String CONFIG_SCRIPT_EDEFAULT = null;
103
104 /**
105 * The cached value of the '{@link #getConfigScript() <em>Config Script</em>}' attribute.
106 * <!-- begin-user-doc -->
107 * <!-- end-user-doc -->
108 * @see #getConfigScript()
109 * @generated
110 * @ordered
111 */
112 protected String configScript = CONFIG_SCRIPT_EDEFAULT;
113
114 /**
115 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
116 * <!-- begin-user-doc -->
117 * <!-- end-user-doc -->
118 * @see #getId()
119 * @generated
120 * @ordered
121 */
122 protected static final String ID_EDEFAULT = null;
123
124 /**
125 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
128 * @see #getId()
129 * @generated
130 * @ordered
131 */
132 protected String id = ID_EDEFAULT;
133
134 /**
135 * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference list.
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
138 * @see #getSource()
139 * @generated
140 * @ordered
141 */
142 protected EList<Source> source;
143
144 /**
145 * The default value of the '{@link #isEnabled() <em>Enabled</em>}' attribute.
146 * <!-- begin-user-doc -->
147 * <!-- end-user-doc -->
148 * @see #isEnabled()
149 * @generated
150 * @ordered
151 */
152 protected static final boolean ENABLED_EDEFAULT = true;
153
154 /**
155 * The cached value of the '{@link #isEnabled() <em>Enabled</em>}' attribute.
156 * <!-- begin-user-doc -->
157 * <!-- end-user-doc -->
158 * @see #isEnabled()
159 * @generated
160 * @ordered
161 */
162 protected boolean enabled = ENABLED_EDEFAULT;
163
164 /**
165 * The cached value of the '{@link #getService() <em>Service</em>}' attribute list.
166 * <!-- begin-user-doc -->
167 * <!-- end-user-doc -->
168 * @see #getService()
169 * @generated
170 * @ordered
171 */
172 protected EList<String> service;
173
174 /**
175 * The cached value of the '{@link #getSupportedExecutionEnvironments() <em>Supported Execution Environments</em>}' attribute list.
176 * <!-- begin-user-doc -->
177 * <!-- end-user-doc -->
178 * @see #getSupportedExecutionEnvironments()
179 * @generated
180 * @ordered
181 */
182 protected EList<String> supportedExecutionEnvironments;
183 /**
184 * The default value of the '{@link #getHomePage() <em>Home Page</em>}' attribute.
185 * <!-- begin-user-doc -->
186 * <!-- end-user-doc -->
187 * @see #getHomePage()
188 * @generated
189 * @ordered
190 */
191 protected static final String HOME_PAGE_EDEFAULT = null;
192 /**
193 * The cached value of the '{@link #getHomePage() <em>Home Page</em>}' attribute.
194 * <!-- begin-user-doc -->
195 * <!-- end-user-doc -->
196 * @see #getHomePage()
197 * @generated
198 * @ordered
199 */
200 protected String homePage = HOME_PAGE_EDEFAULT;
201 /**
202 * The cached value of the '{@link #getElement() <em>Element</em>}' containment reference list.
203 * <!-- begin-user-doc -->
204 * <!-- end-user-doc -->
205 * @see #getElement()
206 * @generated
207 * @ordered
208 */
209 protected EList<Factory> element;
210
211 /**
212 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
213 * <!-- begin-user-doc -->
214 * <!-- end-user-doc -->
215 * @see #getType()
216 * @generated
217 * @ordered
218 */
219 protected static final String TYPE_EDEFAULT = "java.util.ArrayList";
220
221 /**
222 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
223 * <!-- begin-user-doc -->
224 * <!-- end-user-doc -->
225 * @see #getType()
226 * @generated
227 * @ordered
228 */
229 protected String type = TYPE_EDEFAULT;
230
231 /**
232 * The default value of the '{@link #isFactoryCollection() <em>Factory Collection</em>}' attribute.
233 * <!-- begin-user-doc -->
234 * <!-- end-user-doc -->
235 * @see #isFactoryCollection()
236 * @generated
237 * @ordered
238 */
239 protected static final boolean FACTORY_COLLECTION_EDEFAULT = false;
240
241 /**
242 * The cached value of the '{@link #isFactoryCollection() <em>Factory Collection</em>}' attribute.
243 * <!-- begin-user-doc -->
244 * <!-- end-user-doc -->
245 * @see #isFactoryCollection()
246 * @generated
247 * @ordered
248 */
249 protected boolean factoryCollection = FACTORY_COLLECTION_EDEFAULT;
250
251 /**
252 * <!-- begin-user-doc -->
253 * <!-- end-user-doc -->
254 * @generated
255 */
256 protected CollectionImpl() {
257 super();
258 }
259
260 /**
261 * <!-- begin-user-doc -->
262 * <!-- end-user-doc -->
263 * @generated
264 */
265 @Override
266 protected EClass eStaticClass() {
267 return ConfigPackage.Literals.COLLECTION;
268 }
269
270 /**
271 * <!-- begin-user-doc -->
272 * <!-- end-user-doc -->
273 * @generated
274 */
275 public EList<Role> getRoles() {
276 if (roles == null) {
277 roles = new EObjectContainmentWithInverseEList<Role>(Role.class, this, ConfigPackage.COLLECTION__ROLES, PartyPackage.ROLE__OWNER);
278 }
279 return roles;
280 }
281
282 /**
283 * <!-- begin-user-doc -->
284 * <!-- end-user-doc -->
285 * @generated
286 */
287 public String getDescription() {
288 return description;
289 }
290
291 /**
292 * <!-- begin-user-doc -->
293 * <!-- end-user-doc -->
294 * @generated
295 */
296 public void setDescription(String newDescription) {
297 String oldDescription = description;
298 description = newDescription;
299 if (eNotificationRequired())
300 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__DESCRIPTION, oldDescription, description));
301 }
302
303 /**
304 * <!-- begin-user-doc -->
305 * <!-- end-user-doc -->
306 * @generated
307 */
308 public String getConfigScript() {
309 return configScript;
310 }
311
312 /**
313 * <!-- begin-user-doc -->
314 * <!-- end-user-doc -->
315 * @generated
316 */
317 public void setConfigScript(String newConfigScript) {
318 String oldConfigScript = configScript;
319 configScript = newConfigScript;
320 if (eNotificationRequired())
321 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__CONFIG_SCRIPT, oldConfigScript, configScript));
322 }
323
324 /**
325 * <!-- begin-user-doc -->
326 * <!-- end-user-doc -->
327 * @generated
328 */
329 public String getId() {
330 return id;
331 }
332
333 /**
334 * <!-- begin-user-doc -->
335 * <!-- end-user-doc -->
336 * @generated
337 */
338 public void setId(String newId) {
339 String oldId = id;
340 id = newId;
341 if (eNotificationRequired())
342 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__ID, oldId, id));
343 }
344
345 /**
346 * <!-- begin-user-doc -->
347 * <!-- end-user-doc -->
348 * @generated
349 */
350 public EList<Source> getSource() {
351 if (source == null) {
352 source = new EObjectContainmentEList<Source>(Source.class, this, ConfigPackage.COLLECTION__SOURCE);
353 }
354 return source;
355 }
356
357 /**
358 * <!-- begin-user-doc -->
359 * <!-- end-user-doc -->
360 * @generated
361 */
362 public boolean isEnabled() {
363 return enabled;
364 }
365
366 /**
367 * <!-- begin-user-doc -->
368 * <!-- end-user-doc -->
369 * @generated
370 */
371 public void setEnabled(boolean newEnabled) {
372 boolean oldEnabled = enabled;
373 enabled = newEnabled;
374 if (eNotificationRequired())
375 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__ENABLED, oldEnabled, enabled));
376 }
377
378 /**
379 * <!-- begin-user-doc -->
380 * <!-- end-user-doc -->
381 * @generated
382 */
383 public EList<String> getService() {
384 if (service == null) {
385 service = new EDataTypeUniqueEList<String>(String.class, this, ConfigPackage.COLLECTION__SERVICE);
386 }
387 return service;
388 }
389
390 /**
391 * <!-- begin-user-doc -->
392 * <!-- end-user-doc -->
393 * @generated
394 */
395 public EList<String> getSupportedExecutionEnvironments() {
396 if (supportedExecutionEnvironments == null) {
397 supportedExecutionEnvironments = new EDataTypeUniqueEList<String>(String.class, this, ConfigPackage.COLLECTION__SUPPORTED_EXECUTION_ENVIRONMENTS);
398 }
399 return supportedExecutionEnvironments;
400 }
401
402 /**
403 * <!-- begin-user-doc -->
404 * <!-- end-user-doc -->
405 * @generated
406 */
407 public String getHomePage() {
408 return homePage;
409 }
410
411 /**
412 * <!-- begin-user-doc -->
413 * <!-- end-user-doc -->
414 * @generated
415 */
416 public void setHomePage(String newHomePage) {
417 String oldHomePage = homePage;
418 homePage = newHomePage;
419 if (eNotificationRequired())
420 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__HOME_PAGE, oldHomePage, homePage));
421 }
422
423 /**
424 * <!-- begin-user-doc -->
425 * <!-- end-user-doc -->
426 * @generated
427 */
428 public EList<Factory> getElement() {
429 if (element == null) {
430 element = new EObjectContainmentEList<Factory>(Factory.class, this, ConfigPackage.COLLECTION__ELEMENT);
431 }
432 return element;
433 }
434
435 /**
436 * <!-- begin-user-doc -->
437 * <!-- end-user-doc -->
438 * @generated
439 */
440 public String getType() {
441 return type;
442 }
443
444 /**
445 * <!-- begin-user-doc -->
446 * <!-- end-user-doc -->
447 * @generated
448 */
449 public void setType(String newType) {
450 String oldType = type;
451 type = newType;
452 if (eNotificationRequired())
453 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__TYPE, oldType, type));
454 }
455
456 /**
457 * <!-- begin-user-doc -->
458 * <!-- end-user-doc -->
459 * @generated
460 */
461 public boolean isFactoryCollection() {
462 return factoryCollection;
463 }
464
465 /**
466 * <!-- begin-user-doc -->
467 * <!-- end-user-doc -->
468 * @generated
469 */
470 public void setFactoryCollection(boolean newFactoryCollection) {
471 boolean oldFactoryCollection = factoryCollection;
472 factoryCollection = newFactoryCollection;
473 if (eNotificationRequired())
474 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.COLLECTION__FACTORY_COLLECTION, oldFactoryCollection, factoryCollection));
475 }
476
477 /**
478 * <!-- begin-user-doc -->
479 * <!-- end-user-doc -->
480 * @generated NOT
481 */
482 @SuppressWarnings("unchecked")
483 public FactoryClosure<Object> create(final FactoryConfig factoryConfig) throws ConfigurationException {
484 logger.fine("Creating a new collection of type "+getType());
485 ClassLoader cl = factoryConfig.getClassLoader();
486 if (cl==null) {
487 cl = getClass().getClassLoader();
488 }
489 final ClassLoader theClassLoader = cl;
490
491 return new FactoryClosureBase<Object>() {
492
493 public Object create(Object... args) throws ConfigurationException {
494 java.util.Collection<Object> c;
495 try {
496 c = (java.util.Collection<Object>) ObjectDefinitionImpl.construct(theClassLoader.loadClass(getType()), args);
497 } catch (Exception e) {
498 throw new ConfigurationException(e);
499 }
500
501 for (Factory element: getElement()) {
502 if (element.isEnabled()) {
503 logger.fine("Adding collection element");
504 FactoryClosure<Object> efr = element.create(factoryConfig);
505 c.add(isFactoryCollection() ? efr : efr.create());
506 destroyableSink.addDestroyable(efr.getDestroyable());
507 }
508 }
509 Collection def = CollectionImpl.this;
510 // Init.
511 if (c instanceof Component) {
512 Component<Collection> comp = (Component<Collection>) c;
513 ConfigurationContext<Collection> context = (ConfigurationContext<Collection>) factoryConfig.getContextFactory().createContext(def, comp, factoryConfig, destroyableSink);
514 comp.init(context);
515 }
516
517 // Execute script once all elements are initialized
518 if (getConfigScript()!=null && getConfigScript().trim().length()>0) {
519 ScriptEvaluator se = new ScriptEvaluator();
520 se.setParameters(new String[] {"instance", "definition", "config"}, new Class[] {c.getClass(), def.getClass(), factoryConfig.getClass()});
521 se.setParentClassLoader(theClassLoader);
522 se.setThrownExceptions(new Class[] {ConfigurationException.class});
523 try {
524 se.cook(getConfigScript());
525 se.evaluate(new Object[] {c, def, factoryConfig});
526 } catch (Exception e) {
527 throw new ConfigurationException(e);
528 }
529 }
530
531 ObjectDefinitionImpl.expose(CollectionImpl.this, c, factoryConfig.getContext(), theClassLoader, destroyableSink);
532 toDestroy(c);
533 return c;
534 }
535
536 };
537 }
538
539 /**
540 * <!-- begin-user-doc -->
541 * <!-- end-user-doc -->
542 * @generated
543 */
544 public void compile(EList<String> profilePath, TokenSource tokens, ClassLoader classLoader, File dir, String targetPackage, String targetClass) throws ConfigurationException {
545 // TODO: implement this method
546 // Ensure that you remove @generated or mark it @generated NOT
547 throw new UnsupportedOperationException();
548 }
549
550 /**
551 * <!-- begin-user-doc -->
552 * <!-- end-user-doc -->
553 * @generated
554 */
555 @SuppressWarnings("unchecked")
556 @Override
557 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
558 switch (featureID) {
559 case ConfigPackage.COLLECTION__ROLES:
560 return ((InternalEList<InternalEObject>)(InternalEList<?>)getRoles()).basicAdd(otherEnd, msgs);
561 }
562 return super.eInverseAdd(otherEnd, featureID, msgs);
563 }
564
565 /**
566 * <!-- begin-user-doc -->
567 * <!-- end-user-doc -->
568 * @generated
569 */
570 @Override
571 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
572 switch (featureID) {
573 case ConfigPackage.COLLECTION__ROLES:
574 return ((InternalEList<?>)getRoles()).basicRemove(otherEnd, msgs);
575 case ConfigPackage.COLLECTION__SOURCE:
576 return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs);
577 case ConfigPackage.COLLECTION__ELEMENT:
578 return ((InternalEList<?>)getElement()).basicRemove(otherEnd, msgs);
579 }
580 return super.eInverseRemove(otherEnd, featureID, msgs);
581 }
582
583 /**
584 * <!-- begin-user-doc -->
585 * <!-- end-user-doc -->
586 * @generated
587 */
588 @Override
589 public Object eGet(int featureID, boolean resolve, boolean coreType) {
590 switch (featureID) {
591 case ConfigPackage.COLLECTION__ROLES:
592 return getRoles();
593 case ConfigPackage.COLLECTION__DESCRIPTION:
594 return getDescription();
595 case ConfigPackage.COLLECTION__CONFIG_SCRIPT:
596 return getConfigScript();
597 case ConfigPackage.COLLECTION__ID:
598 return getId();
599 case ConfigPackage.COLLECTION__SOURCE:
600 return getSource();
601 case ConfigPackage.COLLECTION__ENABLED:
602 return isEnabled();
603 case ConfigPackage.COLLECTION__SERVICE:
604 return getService();
605 case ConfigPackage.COLLECTION__SUPPORTED_EXECUTION_ENVIRONMENTS:
606 return getSupportedExecutionEnvironments();
607 case ConfigPackage.COLLECTION__HOME_PAGE:
608 return getHomePage();
609 case ConfigPackage.COLLECTION__ELEMENT:
610 return getElement();
611 case ConfigPackage.COLLECTION__TYPE:
612 return getType();
613 case ConfigPackage.COLLECTION__FACTORY_COLLECTION:
614 return isFactoryCollection();
615 }
616 return super.eGet(featureID, resolve, coreType);
617 }
618
619 /**
620 * <!-- begin-user-doc -->
621 * <!-- end-user-doc -->
622 * @generated
623 */
624 @SuppressWarnings("unchecked")
625 @Override
626 public void eSet(int featureID, Object newValue) {
627 switch (featureID) {
628 case ConfigPackage.COLLECTION__ROLES:
629 getRoles().clear();
630 getRoles().addAll((java.util.Collection<? extends Role>)newValue);
631 return;
632 case ConfigPackage.COLLECTION__DESCRIPTION:
633 setDescription((String)newValue);
634 return;
635 case ConfigPackage.COLLECTION__CONFIG_SCRIPT:
636 setConfigScript((String)newValue);
637 return;
638 case ConfigPackage.COLLECTION__ID:
639 setId((String)newValue);
640 return;
641 case ConfigPackage.COLLECTION__SOURCE:
642 getSource().clear();
643 getSource().addAll((java.util.Collection<? extends Source>)newValue);
644 return;
645 case ConfigPackage.COLLECTION__ENABLED:
646 setEnabled((Boolean)newValue);
647 return;
648 case ConfigPackage.COLLECTION__SERVICE:
649 getService().clear();
650 getService().addAll((java.util.Collection<? extends String>)newValue);
651 return;
652 case ConfigPackage.COLLECTION__SUPPORTED_EXECUTION_ENVIRONMENTS:
653 getSupportedExecutionEnvironments().clear();
654 getSupportedExecutionEnvironments().addAll((java.util.Collection<? extends String>)newValue);
655 return;
656 case ConfigPackage.COLLECTION__HOME_PAGE:
657 setHomePage((String)newValue);
658 return;
659 case ConfigPackage.COLLECTION__ELEMENT:
660 getElement().clear();
661 getElement().addAll((java.util.Collection<? extends Factory>)newValue);
662 return;
663 case ConfigPackage.COLLECTION__TYPE:
664 setType((String)newValue);
665 return;
666 case ConfigPackage.COLLECTION__FACTORY_COLLECTION:
667 setFactoryCollection((Boolean)newValue);
668 return;
669 }
670 super.eSet(featureID, newValue);
671 }
672
673 /**
674 * <!-- begin-user-doc -->
675 * <!-- end-user-doc -->
676 * @generated
677 */
678 @Override
679 public void eUnset(int featureID) {
680 switch (featureID) {
681 case ConfigPackage.COLLECTION__ROLES:
682 getRoles().clear();
683 return;
684 case ConfigPackage.COLLECTION__DESCRIPTION:
685 setDescription(DESCRIPTION_EDEFAULT);
686 return;
687 case ConfigPackage.COLLECTION__CONFIG_SCRIPT:
688 setConfigScript(CONFIG_SCRIPT_EDEFAULT);
689 return;
690 case ConfigPackage.COLLECTION__ID:
691 setId(ID_EDEFAULT);
692 return;
693 case ConfigPackage.COLLECTION__SOURCE:
694 getSource().clear();
695 return;
696 case ConfigPackage.COLLECTION__ENABLED:
697 setEnabled(ENABLED_EDEFAULT);
698 return;
699 case ConfigPackage.COLLECTION__SERVICE:
700 getService().clear();
701 return;
702 case ConfigPackage.COLLECTION__SUPPORTED_EXECUTION_ENVIRONMENTS:
703 getSupportedExecutionEnvironments().clear();
704 return;
705 case ConfigPackage.COLLECTION__HOME_PAGE:
706 setHomePage(HOME_PAGE_EDEFAULT);
707 return;
708 case ConfigPackage.COLLECTION__ELEMENT:
709 getElement().clear();
710 return;
711 case ConfigPackage.COLLECTION__TYPE:
712 setType(TYPE_EDEFAULT);
713 return;
714 case ConfigPackage.COLLECTION__FACTORY_COLLECTION:
715 setFactoryCollection(FACTORY_COLLECTION_EDEFAULT);
716 return;
717 }
718 super.eUnset(featureID);
719 }
720
721 /**
722 * <!-- begin-user-doc -->
723 * <!-- end-user-doc -->
724 * @generated
725 */
726 @Override
727 public boolean eIsSet(int featureID) {
728 switch (featureID) {
729 case ConfigPackage.COLLECTION__ROLES:
730 return roles != null && !roles.isEmpty();
731 case ConfigPackage.COLLECTION__DESCRIPTION:
732 return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
733 case ConfigPackage.COLLECTION__CONFIG_SCRIPT:
734 return CONFIG_SCRIPT_EDEFAULT == null ? configScript != null : !CONFIG_SCRIPT_EDEFAULT.equals(configScript);
735 case ConfigPackage.COLLECTION__ID:
736 return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
737 case ConfigPackage.COLLECTION__SOURCE:
738 return source != null && !source.isEmpty();
739 case ConfigPackage.COLLECTION__ENABLED:
740 return enabled != ENABLED_EDEFAULT;
741 case ConfigPackage.COLLECTION__SERVICE:
742 return service != null && !service.isEmpty();
743 case ConfigPackage.COLLECTION__SUPPORTED_EXECUTION_ENVIRONMENTS:
744 return supportedExecutionEnvironments != null && !supportedExecutionEnvironments.isEmpty();
745 case ConfigPackage.COLLECTION__HOME_PAGE:
746 return HOME_PAGE_EDEFAULT == null ? homePage != null : !HOME_PAGE_EDEFAULT.equals(homePage);
747 case ConfigPackage.COLLECTION__ELEMENT:
748 return element != null && !element.isEmpty();
749 case ConfigPackage.COLLECTION__TYPE:
750 return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
751 case ConfigPackage.COLLECTION__FACTORY_COLLECTION:
752 return factoryCollection != FACTORY_COLLECTION_EDEFAULT;
753 }
754 return super.eIsSet(featureID);
755 }
756
757 /**
758 * <!-- begin-user-doc -->
759 * <!-- end-user-doc -->
760 * @generated
761 */
762 @Override
763 public String toString() {
764 if (eIsProxy()) return super.toString();
765
766 StringBuffer result = new StringBuffer(super.toString());
767 result.append(" (description: ");
768 result.append(description);
769 result.append(", configScript: ");
770 result.append(configScript);
771 result.append(", id: ");
772 result.append(id);
773 result.append(", enabled: ");
774 result.append(enabled);
775 result.append(", service: ");
776 result.append(service);
777 result.append(", supportedExecutionEnvironments: ");
778 result.append(supportedExecutionEnvironments);
779 result.append(", homePage: ");
780 result.append(homePage);
781 result.append(", type: ");
782 result.append(type);
783 result.append(", factoryCollection: ");
784 result.append(factoryCollection);
785 result.append(')');
786 return result.toString();
787 }
788
789 } //CollectionImpl