org.eclipse.stp.core.sca.impl
Class ModuleComponentImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.ecore.impl.BasicEObjectImpl
          extended by org.eclipse.emf.ecore.impl.EObjectImpl
              extended by org.eclipse.stp.core.sca.impl.SCAObjectImpl
                  extended by org.eclipse.stp.core.internal.sca.SCAInternalObjectImpl
                      extended by org.eclipse.stp.core.sca.impl.ComponentImpl
                          extended by org.eclipse.stp.core.sca.impl.ModuleComponentImpl
All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject, SCAInternalObject, Component, ModuleComponent, SCAObject

public class ModuleComponentImpl
extends ComponentImpl
implements ModuleComponent

An implementation of the model object 'Module Component'.

The following features are implemented:


Nested Class Summary
 class ModuleComponentImpl.ModuleImplementationImpl
          Provides an implementation of ModuleImplementation which directly updates the obvious fields on the enclosing instance of ModuleComponent.
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
org.eclipse.emf.ecore.InternalEObject.EStore
 
Field Summary
static java.lang.String copyright
           
 
Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
ELAST_EOBJECT_FLAG
 
Fields inherited from interface org.eclipse.stp.core.sca.Component
STATE_ABSTRACT, STATE_IMPLEMENTED, STATE_TYPED, TYPE_ABSTRACT
 
Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
EOPPOSITE_FEATURE_BASE
 
Method Summary
 java.lang.Object eGet(org.eclipse.emf.ecore.EStructuralFeature eFeature, boolean resolve)
           
 org.eclipse.emf.common.notify.NotificationChain eInverseAdd(org.eclipse.emf.ecore.InternalEObject otherEnd, int featureID, java.lang.Class baseClass, org.eclipse.emf.common.notify.NotificationChain msgs)
           
 org.eclipse.emf.common.notify.NotificationChain eInverseRemove(org.eclipse.emf.ecore.InternalEObject otherEnd, int featureID, java.lang.Class baseClass, org.eclipse.emf.common.notify.NotificationChain msgs)
           
 boolean eIsSet(org.eclipse.emf.ecore.EStructuralFeature eFeature)
           
 void eSet(org.eclipse.emf.ecore.EStructuralFeature eFeature, java.lang.Object newValue)
           
 void eSetProxyURI(org.eclipse.emf.common.util.URI uri)
           
 void eUnset(org.eclipse.emf.ecore.EStructuralFeature eFeature)
           
 org.eclipse.emf.ecore.util.FeatureMap getAny()
           
 org.eclipse.emf.ecore.util.FeatureMap getAnyAttribute()
           
 Implementation getImplementation()
          The Implementation is a substitution group element that will be specialized for each component type.
 java.lang.String getModule()
           
 int getState()
           
 java.lang.String getType()
           
 java.lang.String getUri()
           
 ComponentType resolveComponentType()
          Uses the Implementation to resolve the ComponentType.
 Implementation setAbstractImplementation(ComponentType aComponentType)
          A convenience method to set an abstract implementation type (SCAPackage.eINSTANCE.getSCACoreRoot_ImplementationAbstract()).
 void setModule(java.lang.String newModule)
           
 Implementation setSpecializedImplementation(Implementation newImplementation)
          Only accepts instances of ModuleImplementation.
 void setUri(java.lang.String newUri)
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.stp.core.sca.impl.ComponentImpl
basicSetPropertyValuesSet, basicSetReferenceValuesSet, getComposite, getName, getPropertyValuesSet, getReferenceValues, getReferenceValues, getReferenceValues, getReferenceValuesSet, getSingleWireSource, getSingleWireTarget, getWireSource, getWireSource, getWireSourcesWiredToTarget, getWireTarget, getWireTarget, hasValidAbstractType, setName, setPropertyValuesSet, setReferenceValue, setReferenceValuesSet
 
Methods inherited from class org.eclipse.stp.core.internal.sca.SCAInternalObjectImpl
getEObject, getFlags
 
Methods inherited from class org.eclipse.stp.core.sca.impl.SCAObjectImpl
addStatus, clearStatus, getStatus
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eIsProxy, eSetClass, eSetDeliver
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eContainer, eContainingFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eInternalResource, eInverseAdd, eInverseRemove, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eResolveProxy, eResource, eSet, eSetResource, eSetStore, eSetting, eStore, eUnset, eURIFragmentSegment, eVirtualGet, eVirtualGet, eVirtualIsSet, eVirtualSet, eVirtualUnset
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.stp.core.sca.Component
getComposite, getName, getPropertyValuesSet, getReferenceValues, getReferenceValues, getReferenceValues, getSingleWireSource, getSingleWireTarget, getWireSource, getWireSource, getWireSourcesWiredToTarget, getWireTarget, getWireTarget, setName, setPropertyValuesSet, setReferenceValue
 
Methods inherited from interface org.eclipse.stp.core.sca.SCAObject
addStatus, clearStatus, getEObject, getFlags, getStatus
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eResource
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eNotify
 
Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
eNotificationRequired
 

Field Detail

copyright

public static final java.lang.String copyright

See Also:
Constant Field Values
Method Detail

getAny

public org.eclipse.emf.ecore.util.FeatureMap getAny()

Specified by:
getAny in interface ModuleComponent
Returns:
the value of the 'Any' attribute list.
See Also:
SCAPackage.getModuleComponent_Any()

getModule

public java.lang.String getModule()

Specified by:
getModule in interface ModuleComponent
Returns:
the value of the 'Module' attribute.
See Also:
ModuleComponent.setModule(String), SCAPackage.getModuleComponent_Module()

setModule

public void setModule(java.lang.String newModule)

Specified by:
setModule in interface ModuleComponent
Parameters:
newModule - the new value of the 'Module' attribute.
See Also:
ModuleComponent.getModule()

getUri

public java.lang.String getUri()

Specified by:
getUri in interface ModuleComponent
Returns:
the value of the 'Uri' attribute.
See Also:
ModuleComponent.setUri(String), SCAPackage.getModuleComponent_Uri()

setUri

public void setUri(java.lang.String newUri)

Specified by:
setUri in interface ModuleComponent
Parameters:
newUri - the new value of the 'Uri' attribute.
See Also:
ModuleComponent.getUri()

getAnyAttribute

public org.eclipse.emf.ecore.util.FeatureMap getAnyAttribute()

Specified by:
getAnyAttribute in interface ModuleComponent
Returns:
the value of the 'Any Attribute' attribute list.
See Also:
SCAPackage.getModuleComponent_AnyAttribute()

eInverseAdd

public org.eclipse.emf.common.notify.NotificationChain eInverseAdd(org.eclipse.emf.ecore.InternalEObject otherEnd,
                                                                   int featureID,
                                                                   java.lang.Class baseClass,
                                                                   org.eclipse.emf.common.notify.NotificationChain msgs)

Specified by:
eInverseAdd in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eInverseAdd in class ComponentImpl

eInverseRemove

public org.eclipse.emf.common.notify.NotificationChain eInverseRemove(org.eclipse.emf.ecore.InternalEObject otherEnd,
                                                                      int featureID,
                                                                      java.lang.Class baseClass,
                                                                      org.eclipse.emf.common.notify.NotificationChain msgs)

Specified by:
eInverseRemove in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eInverseRemove in class ComponentImpl

eGet

public java.lang.Object eGet(org.eclipse.emf.ecore.EStructuralFeature eFeature,
                             boolean resolve)

Specified by:
eGet in interface org.eclipse.emf.ecore.EObject
Overrides:
eGet in class ComponentImpl

eSet

public void eSet(org.eclipse.emf.ecore.EStructuralFeature eFeature,
                 java.lang.Object newValue)

Specified by:
eSet in interface org.eclipse.emf.ecore.EObject
Overrides:
eSet in class ComponentImpl

eUnset

public void eUnset(org.eclipse.emf.ecore.EStructuralFeature eFeature)

Specified by:
eUnset in interface org.eclipse.emf.ecore.EObject
Overrides:
eUnset in class ComponentImpl

eIsSet

public boolean eIsSet(org.eclipse.emf.ecore.EStructuralFeature eFeature)

Specified by:
eIsSet in interface org.eclipse.emf.ecore.EObject
Overrides:
eIsSet in class ComponentImpl

toString

public java.lang.String toString()

Overrides:
toString in class ComponentImpl

resolveComponentType

public ComponentType resolveComponentType()
Description copied from interface: Component
Uses the Implementation to resolve the ComponentType.

If the Implementation is abstract, then the ComponentType is an embedded element and cannot be shared. Otherwise, the ComponentType could be shared; the underlying implementation will determine if the ComponentType can be shared and handle it automatically.

The ComponentType can be shared in some cases. If the implementation introspector defines an IShareableComponentTypeFactory, then the implementation model will be converted to URI and requested through the ResourceSet of the Implementation that is supplied.

Therefore, resolve() should only be supplied implementations that are contained by a Component, which are contained by a ResourceSet. (The actual containment is Implementation > Component > Composite/Module > SCACoreRoot > Resource > ResourceSet).

The one special case is AbstractImplementation (SCAPackage.getAbstractImplementation()) which does not need to be contained to be resolved.

The feature from the implementation will be determined using the FeatureMap of the containing Component.

The containment requirement is to allow context for resolving a specialized implementation. For cases where the Component or the Implementation is not contained, use IModelIntrospectionManager.resolve(Implementation) to resolve an Implementation and explicitly supply the correct project as the context.

Specified by:
resolveComponentType in interface Component
Returns:
The ComponentType contract for this Component

getState

public int getState()
Specified by:
getState in interface Component
Returns:
One of Component.STATE_ABSTRACT, Component.STATE_TYPED, or Component.STATE_IMPLEMENTED.

getType

public java.lang.String getType()
Specified by:
getType in interface Component
Returns:
The type of the underlying implementation. When Component.getState() returns Component.STATE_ABSTRACT, the type will be "implementation.abstract". Otherwise, the type will be the substitution group name of the implementation.

setSpecializedImplementation

public Implementation setSpecializedImplementation(Implementation newImplementation)
Only accepts instances of ModuleImplementation. Other attempts will generate assertion failures and will not override the current implementation. To correctly support substitution groups, the specific EMF feature for an implementation element type must be specified through a FeatureAdapter attached to the Implementation. Component Handlers or other clients should set the feature using FeatureAdapter.setFeature(SCAObject, EStructuralFeature). For the example test, a PropertiesImplementation was created which has a structural feature on the document root of PropsPackage.eINSTANCE.getDocumentRoot_ImplementationProperties(). So the correct feature to set using the FeatureAdapter for the PropertiesImplementation EClass instances is PropsPackage.eINSTANCE.getDocumentRoot_ImplementationProperties(). This will ensure that when the XML document is serialized, that it uses the substitution group element name ("implementation.properties") instead of using the xsi:type="props:PropertiesImplementation" format.

Specified by:
setSpecializedImplementation in interface Component
Parameters:
newImplementation - The instance of the implementation to configure this component with.
Returns:
The existing Implementation.

setAbstractImplementation

public Implementation setAbstractImplementation(ComponentType aComponentType)
Description copied from interface: Component
A convenience method to set an abstract implementation type (SCAPackage.eINSTANCE.getSCACoreRoot_ImplementationAbstract()). The serialized form will have the element name "implemenation.abstract" with a serialized, embedded ComponentType ( ...).

Specified by:
setAbstractImplementation in interface Component
Parameters:
aComponentType - The component type that should be used to configure the Abstract Implementation that will be created for this Component.
Returns:
The existing Implementation.

getImplementation

public Implementation getImplementation()
Description copied from interface: Component
The Implementation is a substitution group element that will be specialized for each component type.

Specified by:
getImplementation in interface Component
Returns:
The current implementation set on this Component.

eSetProxyURI

public void eSetProxyURI(org.eclipse.emf.common.util.URI uri)
Specified by:
eSetProxyURI in interface org.eclipse.emf.ecore.InternalEObject
Overrides:
eSetProxyURI in class org.eclipse.emf.ecore.impl.EObjectImpl