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