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.Map;
028    import com.hammurapi.config.MapEntry;
029    import com.hammurapi.config.Source;
030    import com.hammurapi.config.bootstrap.ConfigurationException;
031    import com.hammurapi.config.bootstrap.FactoryClosure;
032    import com.hammurapi.config.bootstrap.TokenExpander.TokenSource;
033    import com.hammurapi.config.runtime.Component;
034    import com.hammurapi.config.runtime.ConfigurationContext;
035    import com.hammurapi.config.runtime.FactoryConfig;
036    import com.hammurapi.party.PartyPackage;
037    import com.hammurapi.party.Role;
038    import com.hammurapi.config.runtime.FactoryClosureBase;
039    
040    /**
041     * <!-- begin-user-doc -->
042     * An implementation of the model object '<em><b>Map</b></em>'.
043     * <!-- end-user-doc -->
044     * <p>
045     * The following features are implemented:
046     * <ul>
047     *   <li>{@link com.hammurapi.config.impl.MapImpl#getRoles <em>Roles</em>}</li>
048     *   <li>{@link com.hammurapi.config.impl.MapImpl#getDescription <em>Description</em>}</li>
049     *   <li>{@link com.hammurapi.config.impl.MapImpl#getConfigScript <em>Config Script</em>}</li>
050     *   <li>{@link com.hammurapi.config.impl.MapImpl#getId <em>Id</em>}</li>
051     *   <li>{@link com.hammurapi.config.impl.MapImpl#getSource <em>Source</em>}</li>
052     *   <li>{@link com.hammurapi.config.impl.MapImpl#isEnabled <em>Enabled</em>}</li>
053     *   <li>{@link com.hammurapi.config.impl.MapImpl#getService <em>Service</em>}</li>
054     *   <li>{@link com.hammurapi.config.impl.MapImpl#getSupportedExecutionEnvironments <em>Supported Execution Environments</em>}</li>
055     *   <li>{@link com.hammurapi.config.impl.MapImpl#getHomePage <em>Home Page</em>}</li>
056     *   <li>{@link com.hammurapi.config.impl.MapImpl#getEntry <em>Entry</em>}</li>
057     *   <li>{@link com.hammurapi.config.impl.MapImpl#getType <em>Type</em>}</li>
058     *   <li>{@link com.hammurapi.config.impl.MapImpl#isFactoryMap <em>Factory Map</em>}</li>
059     * </ul>
060     * </p>
061     *
062     * @generated
063     */
064    public class MapImpl extends EObjectImpl implements Map {
065            /**
066             * The cached value of the '{@link #getRoles() <em>Roles</em>}' containment reference list.
067             * <!-- begin-user-doc -->
068             * <!-- end-user-doc -->
069             * @see #getRoles()
070             * @generated
071             * @ordered
072             */
073            protected EList<Role> roles;
074            private static final Logger logger = Logger.getLogger(MapImpl.class.getName());
075            /**
076             * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
077             * <!-- begin-user-doc -->
078             * <!-- end-user-doc -->
079             * @see #getDescription()
080             * @generated
081             * @ordered
082             */
083            protected static final String DESCRIPTION_EDEFAULT = null;
084    
085            /**
086             * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
087             * <!-- begin-user-doc -->
088             * <!-- end-user-doc -->
089             * @see #getDescription()
090             * @generated
091             * @ordered
092             */
093            protected String description = DESCRIPTION_EDEFAULT;
094    
095            /**
096             * The default value of the '{@link #getConfigScript() <em>Config Script</em>}' attribute.
097             * <!-- begin-user-doc -->
098             * <!-- end-user-doc -->
099             * @see #getConfigScript()
100             * @generated
101             * @ordered
102             */
103            protected static final String CONFIG_SCRIPT_EDEFAULT = null;
104    
105            /**
106             * The cached value of the '{@link #getConfigScript() <em>Config Script</em>}' attribute.
107             * <!-- begin-user-doc -->
108             * <!-- end-user-doc -->
109             * @see #getConfigScript()
110             * @generated
111             * @ordered
112             */
113            protected String configScript = CONFIG_SCRIPT_EDEFAULT;
114    
115            /**
116             * The default value of the '{@link #getId() <em>Id</em>}' attribute.
117             * <!-- begin-user-doc -->
118             * <!-- end-user-doc -->
119             * @see #getId()
120             * @generated
121             * @ordered
122             */
123            protected static final String ID_EDEFAULT = null;
124    
125            /**
126             * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
127             * <!-- begin-user-doc -->
128             * <!-- end-user-doc -->
129             * @see #getId()
130             * @generated
131             * @ordered
132             */
133            protected String id = ID_EDEFAULT;
134    
135            /**
136             * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference list.
137             * <!-- begin-user-doc -->
138             * <!-- end-user-doc -->
139             * @see #getSource()
140             * @generated
141             * @ordered
142             */
143            protected EList<Source> source;
144    
145            /**
146             * The default value of the '{@link #isEnabled() <em>Enabled</em>}' attribute.
147             * <!-- begin-user-doc -->
148             * <!-- end-user-doc -->
149             * @see #isEnabled()
150             * @generated
151             * @ordered
152             */
153            protected static final boolean ENABLED_EDEFAULT = true;
154    
155            /**
156             * The cached value of the '{@link #isEnabled() <em>Enabled</em>}' attribute.
157             * <!-- begin-user-doc -->
158             * <!-- end-user-doc -->
159             * @see #isEnabled()
160             * @generated
161             * @ordered
162             */
163            protected boolean enabled = ENABLED_EDEFAULT;
164    
165            /**
166             * The cached value of the '{@link #getService() <em>Service</em>}' attribute list.
167             * <!-- begin-user-doc -->
168             * <!-- end-user-doc -->
169             * @see #getService()
170             * @generated
171             * @ordered
172             */
173            protected EList<String> service;
174    
175            /**
176             * The cached value of the '{@link #getSupportedExecutionEnvironments() <em>Supported Execution Environments</em>}' attribute list.
177             * <!-- begin-user-doc -->
178             * <!-- end-user-doc -->
179             * @see #getSupportedExecutionEnvironments()
180             * @generated
181             * @ordered
182             */
183            protected EList<String> supportedExecutionEnvironments;
184            /**
185             * The default value of the '{@link #getHomePage() <em>Home Page</em>}' attribute.
186             * <!-- begin-user-doc -->
187             * <!-- end-user-doc -->
188             * @see #getHomePage()
189             * @generated
190             * @ordered
191             */
192            protected static final String HOME_PAGE_EDEFAULT = null;
193            /**
194             * The cached value of the '{@link #getHomePage() <em>Home Page</em>}' attribute.
195             * <!-- begin-user-doc -->
196             * <!-- end-user-doc -->
197             * @see #getHomePage()
198             * @generated
199             * @ordered
200             */
201            protected String homePage = HOME_PAGE_EDEFAULT;
202            /**
203             * The cached value of the '{@link #getEntry() <em>Entry</em>}' containment reference list.
204             * <!-- begin-user-doc -->
205             * <!-- end-user-doc -->
206             * @see #getEntry()
207             * @generated
208             * @ordered
209             */
210            protected EList<MapEntry> entry;
211    
212            /**
213             * The default value of the '{@link #getType() <em>Type</em>}' attribute.
214             * <!-- begin-user-doc -->
215             * <!-- end-user-doc -->
216             * @see #getType()
217             * @generated
218             * @ordered
219             */
220            protected static final String TYPE_EDEFAULT = "java.util.HashMap";
221    
222            /**
223             * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
224             * <!-- begin-user-doc -->
225             * <!-- end-user-doc -->
226             * @see #getType()
227             * @generated
228             * @ordered
229             */
230            protected String type = TYPE_EDEFAULT;
231    
232            /**
233             * The default value of the '{@link #isFactoryMap() <em>Factory Map</em>}' attribute.
234             * <!-- begin-user-doc -->
235             * <!-- end-user-doc -->
236             * @see #isFactoryMap()
237             * @generated
238             * @ordered
239             */
240            protected static final boolean FACTORY_MAP_EDEFAULT = false;
241    
242            /**
243             * The cached value of the '{@link #isFactoryMap() <em>Factory Map</em>}' attribute.
244             * <!-- begin-user-doc -->
245             * <!-- end-user-doc -->
246             * @see #isFactoryMap()
247             * @generated
248             * @ordered
249             */
250            protected boolean factoryMap = FACTORY_MAP_EDEFAULT;
251    
252            /**
253             * <!-- begin-user-doc -->
254             * <!-- end-user-doc -->
255             * @generated
256             */
257            protected MapImpl() {
258                    super();
259            }
260    
261            /**
262             * <!-- begin-user-doc -->
263             * <!-- end-user-doc -->
264             * @generated
265             */
266            @Override
267            protected EClass eStaticClass() {
268                    return ConfigPackage.Literals.MAP;
269            }
270    
271            /**
272             * <!-- begin-user-doc -->
273             * <!-- end-user-doc -->
274             * @generated
275             */
276            public EList<Role> getRoles() {
277                    if (roles == null) {
278                            roles = new EObjectContainmentWithInverseEList<Role>(Role.class, this, ConfigPackage.MAP__ROLES, PartyPackage.ROLE__OWNER);
279                    }
280                    return roles;
281            }
282    
283            /**
284             * <!-- begin-user-doc -->
285             * <!-- end-user-doc -->
286             * @generated
287             */
288            public String getDescription() {
289                    return description;
290            }
291    
292            /**
293             * <!-- begin-user-doc -->
294             * <!-- end-user-doc -->
295             * @generated
296             */
297            public void setDescription(String newDescription) {
298                    String oldDescription = description;
299                    description = newDescription;
300                    if (eNotificationRequired())
301                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__DESCRIPTION, oldDescription, description));
302            }
303    
304            /**
305             * <!-- begin-user-doc -->
306             * <!-- end-user-doc -->
307             * @generated
308             */
309            public String getConfigScript() {
310                    return configScript;
311            }
312    
313            /**
314             * <!-- begin-user-doc -->
315             * <!-- end-user-doc -->
316             * @generated
317             */
318            public void setConfigScript(String newConfigScript) {
319                    String oldConfigScript = configScript;
320                    configScript = newConfigScript;
321                    if (eNotificationRequired())
322                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__CONFIG_SCRIPT, oldConfigScript, configScript));
323            }
324    
325            /**
326             * <!-- begin-user-doc -->
327             * <!-- end-user-doc -->
328             * @generated
329             */
330            public String getId() {
331                    return id;
332            }
333    
334            /**
335             * <!-- begin-user-doc -->
336             * <!-- end-user-doc -->
337             * @generated
338             */
339            public void setId(String newId) {
340                    String oldId = id;
341                    id = newId;
342                    if (eNotificationRequired())
343                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__ID, oldId, id));
344            }
345    
346            /**
347             * <!-- begin-user-doc -->
348             * <!-- end-user-doc -->
349             * @generated
350             */
351            public EList<Source> getSource() {
352                    if (source == null) {
353                            source = new EObjectContainmentEList<Source>(Source.class, this, ConfigPackage.MAP__SOURCE);
354                    }
355                    return source;
356            }
357    
358            /**
359             * <!-- begin-user-doc -->
360             * <!-- end-user-doc -->
361             * @generated
362             */
363            public boolean isEnabled() {
364                    return enabled;
365            }
366    
367            /**
368             * <!-- begin-user-doc -->
369             * <!-- end-user-doc -->
370             * @generated
371             */
372            public void setEnabled(boolean newEnabled) {
373                    boolean oldEnabled = enabled;
374                    enabled = newEnabled;
375                    if (eNotificationRequired())
376                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__ENABLED, oldEnabled, enabled));
377            }
378    
379            /**
380             * <!-- begin-user-doc -->
381             * <!-- end-user-doc -->
382             * @generated
383             */
384            public EList<String> getService() {
385                    if (service == null) {
386                            service = new EDataTypeUniqueEList<String>(String.class, this, ConfigPackage.MAP__SERVICE);
387                    }
388                    return service;
389            }
390    
391            /**
392             * <!-- begin-user-doc -->
393             * <!-- end-user-doc -->
394             * @generated
395             */
396            public EList<String> getSupportedExecutionEnvironments() {
397                    if (supportedExecutionEnvironments == null) {
398                            supportedExecutionEnvironments = new EDataTypeUniqueEList<String>(String.class, this, ConfigPackage.MAP__SUPPORTED_EXECUTION_ENVIRONMENTS);
399                    }
400                    return supportedExecutionEnvironments;
401            }
402    
403            /**
404             * <!-- begin-user-doc -->
405             * <!-- end-user-doc -->
406             * @generated
407             */
408            public String getHomePage() {
409                    return homePage;
410            }
411    
412            /**
413             * <!-- begin-user-doc -->
414             * <!-- end-user-doc -->
415             * @generated
416             */
417            public void setHomePage(String newHomePage) {
418                    String oldHomePage = homePage;
419                    homePage = newHomePage;
420                    if (eNotificationRequired())
421                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__HOME_PAGE, oldHomePage, homePage));
422            }
423    
424            /**
425             * <!-- begin-user-doc -->
426             * <!-- end-user-doc -->
427             * @generated
428             */
429            public EList<MapEntry> getEntry() {
430                    if (entry == null) {
431                            entry = new EObjectContainmentEList<MapEntry>(MapEntry.class, this, ConfigPackage.MAP__ENTRY);
432                    }
433                    return entry;
434            }
435    
436            /**
437             * <!-- begin-user-doc -->
438             * <!-- end-user-doc -->
439             * @generated
440             */
441            public String getType() {
442                    return type;
443            }
444    
445            /**
446             * <!-- begin-user-doc -->
447             * <!-- end-user-doc -->
448             * @generated
449             */
450            public void setType(String newType) {
451                    String oldType = type;
452                    type = newType;
453                    if (eNotificationRequired())
454                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__TYPE, oldType, type));
455            }
456    
457            /**
458             * <!-- begin-user-doc -->
459             * <!-- end-user-doc -->
460             * @generated
461             */
462            public boolean isFactoryMap() {
463                    return factoryMap;
464            }
465    
466            /**
467             * <!-- begin-user-doc -->
468             * <!-- end-user-doc -->
469             * @generated
470             */
471            public void setFactoryMap(boolean newFactoryMap) {
472                    boolean oldFactoryMap = factoryMap;
473                    factoryMap = newFactoryMap;
474                    if (eNotificationRequired())
475                            eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.MAP__FACTORY_MAP, oldFactoryMap, factoryMap));
476            }
477    
478            /**
479             * <!-- begin-user-doc -->
480             * <!-- end-user-doc -->
481             * @generated NOT
482             */
483            @SuppressWarnings("unchecked")
484            public FactoryClosure<Object> create(final FactoryConfig factoryConfig) throws ConfigurationException {
485                    return new FactoryClosureBase<Object>() {
486    
487                            public Object create(Object... args) throws ConfigurationException {
488                                    logger.fine("Creating a new map of type "+getType());
489                                    
490                                    ClassLoader cl = factoryConfig.getClassLoader();
491                                    if (cl==null) {
492                                            cl = getClass().getClassLoader();
493                                    }
494                                    try {
495                                            final java.util.Map<Object, Object> map = (java.util.Map<Object, Object>) ObjectDefinitionImpl.construct(cl.loadClass(getType()), args);
496                                            for (MapEntry entry: getEntry()) {
497                                                    if (entry.getKey().isEnabled()) {
498                                                            logger.fine("Adding new entry");
499                                                            
500                                                            FactoryClosure<Object> kfr = entry.getKey().create(factoryConfig);
501                                                            FactoryClosure<Object> vfr = entry.getValue().create(factoryConfig);                              
502                                                            map.put(kfr.create(), isFactoryMap() ? vfr : vfr.create());
503                                                            destroyableSink.addDestroyable(kfr.getDestroyable());
504                                                            destroyableSink.addDestroyable(vfr.getDestroyable());
505                                                    }
506                                            }
507                                            
508                                            Map def = MapImpl.this;
509                                            // Init.
510                                            if (map instanceof Component) {
511                                                    Component<Map> comp = (Component<Map>) map;
512                                                    ConfigurationContext<Map> context = (ConfigurationContext<Map>) factoryConfig.getContextFactory().createContext(def, comp, factoryConfig, destroyableSink); 
513                                                    comp.init(context);
514                                            }
515                                            
516                                            // Execute script once all keys and values are initialized
517                                            if (getConfigScript()!=null && getConfigScript().trim().length()>0) {
518                                                    ScriptEvaluator se = new ScriptEvaluator();
519                                                    se.setParameters(new String[] {"instance", "definition", "config"}, new Class[] {map.getClass(), def.getClass(), factoryConfig.getClass()});
520                                                    se.setParentClassLoader(cl);
521                                                    se.setThrownExceptions(new Class[] {ConfigurationException.class});
522                                                    se.cook(getConfigScript());
523                                                    se.evaluate(new Object[] {map, def, factoryConfig});
524                                            }
525                                            ObjectDefinitionImpl.expose(MapImpl.this, map, factoryConfig.getContext(), cl, destroyableSink);
526                                            toDestroy(map);
527                                            return map;
528                                    } catch (ConfigurationException e) {
529                                            throw e;
530                                    } catch (Exception e) {
531                                            throw new ConfigurationException(e);
532                                    }
533                            }
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.MAP__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.MAP__ROLES:
574                                    return ((InternalEList<?>)getRoles()).basicRemove(otherEnd, msgs);
575                            case ConfigPackage.MAP__SOURCE:
576                                    return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs);
577                            case ConfigPackage.MAP__ENTRY:
578                                    return ((InternalEList<?>)getEntry()).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.MAP__ROLES:
592                                    return getRoles();
593                            case ConfigPackage.MAP__DESCRIPTION:
594                                    return getDescription();
595                            case ConfigPackage.MAP__CONFIG_SCRIPT:
596                                    return getConfigScript();
597                            case ConfigPackage.MAP__ID:
598                                    return getId();
599                            case ConfigPackage.MAP__SOURCE:
600                                    return getSource();
601                            case ConfigPackage.MAP__ENABLED:
602                                    return isEnabled();
603                            case ConfigPackage.MAP__SERVICE:
604                                    return getService();
605                            case ConfigPackage.MAP__SUPPORTED_EXECUTION_ENVIRONMENTS:
606                                    return getSupportedExecutionEnvironments();
607                            case ConfigPackage.MAP__HOME_PAGE:
608                                    return getHomePage();
609                            case ConfigPackage.MAP__ENTRY:
610                                    return getEntry();
611                            case ConfigPackage.MAP__TYPE:
612                                    return getType();
613                            case ConfigPackage.MAP__FACTORY_MAP:
614                                    return isFactoryMap();
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.MAP__ROLES:
629                                    getRoles().clear();
630                                    getRoles().addAll((Collection<? extends Role>)newValue);
631                                    return;
632                            case ConfigPackage.MAP__DESCRIPTION:
633                                    setDescription((String)newValue);
634                                    return;
635                            case ConfigPackage.MAP__CONFIG_SCRIPT:
636                                    setConfigScript((String)newValue);
637                                    return;
638                            case ConfigPackage.MAP__ID:
639                                    setId((String)newValue);
640                                    return;
641                            case ConfigPackage.MAP__SOURCE:
642                                    getSource().clear();
643                                    getSource().addAll((Collection<? extends Source>)newValue);
644                                    return;
645                            case ConfigPackage.MAP__ENABLED:
646                                    setEnabled((Boolean)newValue);
647                                    return;
648                            case ConfigPackage.MAP__SERVICE:
649                                    getService().clear();
650                                    getService().addAll((Collection<? extends String>)newValue);
651                                    return;
652                            case ConfigPackage.MAP__SUPPORTED_EXECUTION_ENVIRONMENTS:
653                                    getSupportedExecutionEnvironments().clear();
654                                    getSupportedExecutionEnvironments().addAll((Collection<? extends String>)newValue);
655                                    return;
656                            case ConfigPackage.MAP__HOME_PAGE:
657                                    setHomePage((String)newValue);
658                                    return;
659                            case ConfigPackage.MAP__ENTRY:
660                                    getEntry().clear();
661                                    getEntry().addAll((Collection<? extends MapEntry>)newValue);
662                                    return;
663                            case ConfigPackage.MAP__TYPE:
664                                    setType((String)newValue);
665                                    return;
666                            case ConfigPackage.MAP__FACTORY_MAP:
667                                    setFactoryMap((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.MAP__ROLES:
682                                    getRoles().clear();
683                                    return;
684                            case ConfigPackage.MAP__DESCRIPTION:
685                                    setDescription(DESCRIPTION_EDEFAULT);
686                                    return;
687                            case ConfigPackage.MAP__CONFIG_SCRIPT:
688                                    setConfigScript(CONFIG_SCRIPT_EDEFAULT);
689                                    return;
690                            case ConfigPackage.MAP__ID:
691                                    setId(ID_EDEFAULT);
692                                    return;
693                            case ConfigPackage.MAP__SOURCE:
694                                    getSource().clear();
695                                    return;
696                            case ConfigPackage.MAP__ENABLED:
697                                    setEnabled(ENABLED_EDEFAULT);
698                                    return;
699                            case ConfigPackage.MAP__SERVICE:
700                                    getService().clear();
701                                    return;
702                            case ConfigPackage.MAP__SUPPORTED_EXECUTION_ENVIRONMENTS:
703                                    getSupportedExecutionEnvironments().clear();
704                                    return;
705                            case ConfigPackage.MAP__HOME_PAGE:
706                                    setHomePage(HOME_PAGE_EDEFAULT);
707                                    return;
708                            case ConfigPackage.MAP__ENTRY:
709                                    getEntry().clear();
710                                    return;
711                            case ConfigPackage.MAP__TYPE:
712                                    setType(TYPE_EDEFAULT);
713                                    return;
714                            case ConfigPackage.MAP__FACTORY_MAP:
715                                    setFactoryMap(FACTORY_MAP_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.MAP__ROLES:
730                                    return roles != null && !roles.isEmpty();
731                            case ConfigPackage.MAP__DESCRIPTION:
732                                    return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
733                            case ConfigPackage.MAP__CONFIG_SCRIPT:
734                                    return CONFIG_SCRIPT_EDEFAULT == null ? configScript != null : !CONFIG_SCRIPT_EDEFAULT.equals(configScript);
735                            case ConfigPackage.MAP__ID:
736                                    return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
737                            case ConfigPackage.MAP__SOURCE:
738                                    return source != null && !source.isEmpty();
739                            case ConfigPackage.MAP__ENABLED:
740                                    return enabled != ENABLED_EDEFAULT;
741                            case ConfigPackage.MAP__SERVICE:
742                                    return service != null && !service.isEmpty();
743                            case ConfigPackage.MAP__SUPPORTED_EXECUTION_ENVIRONMENTS:
744                                    return supportedExecutionEnvironments != null && !supportedExecutionEnvironments.isEmpty();
745                            case ConfigPackage.MAP__HOME_PAGE:
746                                    return HOME_PAGE_EDEFAULT == null ? homePage != null : !HOME_PAGE_EDEFAULT.equals(homePage);
747                            case ConfigPackage.MAP__ENTRY:
748                                    return entry != null && !entry.isEmpty();
749                            case ConfigPackage.MAP__TYPE:
750                                    return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
751                            case ConfigPackage.MAP__FACTORY_MAP:
752                                    return factoryMap != FACTORY_MAP_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(", factoryMap: ");
784                    result.append(factoryMap);
785                    result.append(')');
786                    return result.toString();
787            }
788    
789    } //MapImpl