Skip to content

Commit

Permalink
Adding capability to extending the model (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadelkhoury committed Dec 29, 2021
1 parent f559afc commit e559bf2
Show file tree
Hide file tree
Showing 32 changed files with 1,406 additions and 58 deletions.
11 changes: 11 additions & 0 deletions org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="stores" upperBound="-1"
eType="#//Store" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sources" upperBound="-1"
eType="#//Source" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Specification">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
Expand Down Expand Up @@ -117,6 +119,8 @@
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="persistence" eType="#//OSLCServicePersistence"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceBinding" eType="#//SourceBinding"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WebService">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
Expand All @@ -132,6 +136,8 @@
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="persistence" eType="#//WebServicePersistence"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceBinding" eType="#//SourceBinding"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TrsService" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="basePageLimit" lowerBound="1"
Expand Down Expand Up @@ -366,6 +372,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="jettyPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MavenSpecificationConfiguration" eSuperTypes="#//SpecificationConfiguration"/>
<eClassifiers xsi:type="ecore:EClass" name="Source" abstract="true"/>
<eClassifiers xsi:type="ecore:EClass" name="Store">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultNamedGraph" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
Expand All @@ -382,6 +389,10 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="password" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SourceBinding">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
eType="#//Source"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ServicePersistence" abstract="true">
<eStructuralFeatures xsi:type="ecore:EReference" name="store" lowerBound="1" eType="#//Store"/>
</eClassifiers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//AdaptorInterface/backendCodeTemplate_searchResources"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//AdaptorInterface/backendCodeTemplate_createResource"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//AdaptorInterface/stores"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//AdaptorInterface/sources"/>
</genClasses>
<genClasses ecoreClass="adaptorInterface.ecore#//Specification">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//Specification/name"/>
Expand Down Expand Up @@ -127,6 +128,7 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Service/basicCapabilities"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//Service/usages"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Service/persistence"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Service/sourceBinding"/>
</genClasses>
<genClasses ecoreClass="adaptorInterface.ecore#//WebService">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//WebService/name"/>
Expand All @@ -137,6 +139,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//WebService/delete"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//WebService/update"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//WebService/persistence"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//WebService/sourceBinding"/>
</genClasses>
<genClasses image="false" ecoreClass="adaptorInterface.ecore#//TrsService">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//TrsService/basePageLimit"/>
Expand All @@ -154,8 +157,8 @@
</genClasses>
<genClasses ecoreClass="adaptorInterface.ecore#//ResourceProperty">
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/id"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/title"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/name"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/title"/>
<genFeatures createChild="false" propertyMultiLine="true" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/description"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//ResourceProperty/propertyDefinition"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//ResourceProperty/occurs"/>
Expand Down Expand Up @@ -272,6 +275,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//MavenServerConfiguration/jettyPort"/>
</genClasses>
<genClasses ecoreClass="adaptorInterface.ecore#//MavenSpecificationConfiguration"/>
<genClasses image="false" ecoreClass="adaptorInterface.ecore#//Source"/>
<genClasses ecoreClass="adaptorInterface.ecore#//Store">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//Store/defaultNamedGraph"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//Store/sparqlQueryEndpoint"/>
Expand All @@ -282,6 +286,9 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//StoreWithAuthentication/username"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//StoreWithAuthentication/password"/>
</genClasses>
<genClasses image="false" ecoreClass="adaptorInterface.ecore#//SourceBinding">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//SourceBinding/source"/>
</genClasses>
<genClasses image="false" ecoreClass="adaptorInterface.ecore#//ServicePersistence">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//ServicePersistence/store"/>
</genClasses>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions org.eclipse.lyo.tools.adaptormodel.edit/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,10 @@ _UI_ServerConfiguration_generateJspFilesForOslcUI_feature = Generate Jsp Files F
_UI_Specification_name_feature = Name
_UI_Resource_title_feature = Title
_UI_Resource_description_feature = Description
_UI_Source_type = Source
_UI_SourceBinding_type = Source Binding
_UI_AdaptorInterface_souces_feature = Souces
_UI_Service_sourceBinding_feature = Source Binding
_UI_WebService_sourceBinding_feature = Source Binding
_UI_SourceBinding_source_feature = Source
_UI_AdaptorInterface_sources_feature = Sources
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object objec
childrenFeatures.add(AdaptorinterfacePackage.Literals.ADAPTOR_INTERFACE__REQUIRED_ADAPTORS);
childrenFeatures.add(AdaptorinterfacePackage.Literals.ADAPTOR_INTERFACE__CONFIGURATION);
childrenFeatures.add(AdaptorinterfacePackage.Literals.ADAPTOR_INTERFACE__STORES);
childrenFeatures.add(AdaptorinterfacePackage.Literals.ADAPTOR_INTERFACE__SOURCES);
}
return childrenFeatures;
}
Expand Down Expand Up @@ -510,6 +511,7 @@ public void notifyChanged(Notification notification) {
case AdaptorinterfacePackage.ADAPTOR_INTERFACE__REQUIRED_ADAPTORS:
case AdaptorinterfacePackage.ADAPTOR_INTERFACE__CONFIGURATION:
case AdaptorinterfacePackage.ADAPTOR_INTERFACE__STORES:
case AdaptorinterfacePackage.ADAPTOR_INTERFACE__SOURCES:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,29 @@ public Adapter createStoreWithAuthenticationAdapter() {
return storeWithAuthenticationItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link adaptorinterface.SourceBinding} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SourceBindingItemProvider sourceBindingItemProvider;

/**
* This creates an adapter for a {@link adaptorinterface.SourceBinding}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createSourceBindingAdapter() {
if (sourceBindingItemProvider == null) {
sourceBindingItemProvider = new SourceBindingItemProvider(this);
}

return sourceBindingItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link adaptorinterface.OSLCServicePersistence} instances.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -962,6 +985,7 @@ public void dispose() {
if (mavenSpecificationConfigurationItemProvider != null) mavenSpecificationConfigurationItemProvider.dispose();
if (storeItemProvider != null) storeItemProvider.dispose();
if (storeWithAuthenticationItemProvider != null) storeWithAuthenticationItemProvider.dispose();
if (sourceBindingItemProvider != null) sourceBindingItemProvider.dispose();
if (oslcServicePersistenceItemProvider != null) oslcServicePersistenceItemProvider.dispose();
if (webServicePersistenceItemProvider != null) webServicePersistenceItemProvider.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
super.getPropertyDescriptors(object);

addIdPropertyDescriptor(object);
addTitlePropertyDescriptor(object);
addNamePropertyDescriptor(object);
addTitlePropertyDescriptor(object);
addDescriptionPropertyDescriptor(object);
addPropertyDefinitionPropertyDescriptor(object);
addOccursPropertyDescriptor(object);
Expand Down Expand Up @@ -382,8 +382,8 @@ public void notifyChanged(Notification notification) {

switch (notification.getFeatureID(ResourceProperty.class)) {
case AdaptorinterfacePackage.RESOURCE_PROPERTY__ID:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__TITLE:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__NAME:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__TITLE:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__DESCRIPTION:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__OCCURS:
case AdaptorinterfacePackage.RESOURCE_PROPERTY__READ_ONLY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object objec
childrenFeatures.add(AdaptorinterfacePackage.Literals.SERVICE__CREATION_DIALOGS);
childrenFeatures.add(AdaptorinterfacePackage.Literals.SERVICE__BASIC_CAPABILITIES);
childrenFeatures.add(AdaptorinterfacePackage.Literals.SERVICE__PERSISTENCE);
childrenFeatures.add(AdaptorinterfacePackage.Literals.SERVICE__SOURCE_BINDING);
}
return childrenFeatures;
}
Expand Down Expand Up @@ -221,6 +222,7 @@ public void notifyChanged(Notification notification) {
case AdaptorinterfacePackage.SERVICE__CREATION_DIALOGS:
case AdaptorinterfacePackage.SERVICE__BASIC_CAPABILITIES:
case AdaptorinterfacePackage.SERVICE__PERSISTENCE:
case AdaptorinterfacePackage.SERVICE__SOURCE_BINDING:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
Expand Down Expand Up @@ -267,6 +269,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(createChildParameter
(AdaptorinterfacePackage.Literals.SERVICE__PERSISTENCE,
AdaptorinterfaceFactory.eINSTANCE.createOSLCServicePersistence()));

newChildDescriptors.add
(createChildParameter
(AdaptorinterfacePackage.Literals.SERVICE__SOURCE_BINDING,
AdaptorinterfaceFactory.eINSTANCE.createSourceBinding()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/**
*/
package adaptorinterface.provider;


import adaptorinterface.AdaptorinterfacePackage;

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;

/**
* This is the item provider adapter for a {@link adaptorinterface.SourceBinding} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class SourceBindingItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SourceBindingItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}

/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);

addSourcePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}

/**
* This adds a property descriptor for the Source feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addSourcePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SourceBinding_source_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_SourceBinding_source_feature", "_UI_SourceBinding_type"),
AdaptorinterfacePackage.Literals.SOURCE_BINDING__SOURCE,
true,
false,
true,
null,
null,
null));
}

/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("_UI_SourceBinding_type");
}


/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}

/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}

/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return AdaptorInterfaceEditPlugin.INSTANCE;
}

}
Loading

0 comments on commit e559bf2

Please sign in to comment.