Skip to content

Commit

Permalink
[Feat]Add on global regions extension availabilityzone as a resource …
Browse files Browse the repository at this point in the history
…not a mixin.
  • Loading branch information
GOURDIN Christophe committed Jun 7, 2018
1 parent 2cdbff9 commit dc5a704
Show file tree
Hide file tree
Showing 25 changed files with 978 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Connector implementation for the OCCI kind:
* - scheme: http://occiware.org/occi/infrastructure/locations#
* - term: availabilityzone
* - title: This mixin is used to locate a resource or link in a datacenter part
* - title: This resource is used to locate a resource or link in a datacenter part
*/
public class AvailabilityzoneConnector extends org.eclipse.cmf.occi.multicloud.regions.impl.AvailabilityzoneImpl
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2016-2017 Inria
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* - Philippe Merle <[email protected]>
* - Faiez Zalila <[email protected]>
*
* Generated at Thu May 03 15:45:31 CEST 2018 from platform:/resource/org.eclipse.cmf.occi.multicloud.regions/model/regions.occie by org.eclipse.cmf.occi.core.gen.connector
*/
package org.eclipse.cmf.occi.multicloud.regions.connector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AvailabilityzonelinkConnector extends org.eclipse.cmf.occi.multicloud.regions.impl.AvailabilityzonelinkImpl {
/**
* Initialize the logger.
*/
private static Logger LOGGER = LoggerFactory.getLogger(AvailabilityzoneConnector.class);

// Start of user code Availabilityzoneconnector_constructor
/**
* Constructs a availabilityzone connector.
*/
AvailabilityzonelinkConnector()
{
LOGGER.debug("Constructor called on " + this);
// TODO: Implement this constructor.
}
// End of user code
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ public org.eclipse.cmf.occi.multicloud.regions.Regionlink createRegionlink() {
* EFactory method for OCCI kind:
* - scheme: http://occiware.org/occi/infrastructure/locations#
* - term: availabilityzone
* - title: This mixin is used to locate a resource or link in a datacenter part
* - title: This resource is used to locate a resource or link in a datacenter part
*/
@Override
public org.eclipse.cmf.occi.multicloud.regions.Availabilityzone createAvailabilityzone() {
return new AvailabilityzoneConnector();
}

@Override
public org.eclipse.cmf.occi.multicloud.regions.Availabilityzonelink createAvailabilityzonelink() {
return new AvailabilityzonelinkConnector();
}

/**
* EFactory method for OCCI kind:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ _UI_Region_regionDescription_feature = Region Description
_UI_China_type = China
_UI_Region_endpoint_feature = Endpoint
_UI_Region_regionName_feature = Region Name
_UI_Availabilityzonelink_type = Availabilityzonelink
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
import java.util.Collection;
import java.util.List;

import org.eclipse.cmf.occi.core.OCCIPackage;
import org.eclipse.cmf.occi.core.provider.MixinBaseItemProvider;

import org.eclipse.cmf.occi.core.provider.ResourceItemProvider;
import org.eclipse.cmf.occi.multicloud.regions.Availabilityzone;
import org.eclipse.cmf.occi.multicloud.regions.RegionsFactory;
import org.eclipse.cmf.occi.multicloud.regions.RegionsPackage;

import org.eclipse.emf.common.notify.AdapterFactory;
Expand All @@ -37,7 +40,7 @@
* <!-- end-user-doc -->
* @generated
*/
public class AvailabilityzoneItemProvider extends MixinBaseItemProvider {
public class AvailabilityzoneItemProvider extends ResourceItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -151,7 +154,7 @@ public Object getImage(Object object) {
*/
@Override
public String getText(Object object) {
String label = ((Availabilityzone)object).getZoneName();
String label = ((Availabilityzone)object).getId();
return label == null || label.length() == 0 ?
getString("_UI_Availabilityzone_type") :
getString("_UI_Availabilityzone_type") + " " + label;
Expand Down Expand Up @@ -189,6 +192,46 @@ public void notifyChanged(Notification notification) {
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createEurope()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createNorthamerica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createSouthamerica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAsiapacific()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAfrica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createChina()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.RESOURCE__LINKS,
RegionsFactory.eINSTANCE.createRegionlink()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.RESOURCE__LINKS,
RegionsFactory.eINSTANCE.createAvailabilityzonelink()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/**
* Copyright (c) 2015-2017 Obeo, Inria
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* - William Piers <[email protected]>
* - Philippe Merle <[email protected]>
* - Faiez Zalila <[email protected]>
*/
package org.eclipse.cmf.occi.multicloud.regions.provider;


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

import org.eclipse.cmf.occi.core.OCCIPackage;

import org.eclipse.cmf.occi.core.provider.LinkItemProvider;

import org.eclipse.cmf.occi.multicloud.regions.Availabilityzonelink;
import org.eclipse.cmf.occi.multicloud.regions.RegionsFactory;

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.IItemPropertyDescriptor;

/**
* This is the item provider adapter for a {@link org.eclipse.cmf.occi.multicloud.regions.Availabilityzonelink} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AvailabilityzonelinkItemProvider extends LinkItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AvailabilityzonelinkItemProvider(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);

}
return itemPropertyDescriptors;
}

/**
* This returns Availabilityzonelink.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Availabilityzonelink"));
}

/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Availabilityzonelink)object).getId();
return label == null || label.length() == 0 ?
getString("_UI_Availabilityzonelink_type") :
getString("_UI_Availabilityzonelink_type") + " " + label;
}


/**
* 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);

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createEurope()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createNorthamerica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createSouthamerica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAsiapacific()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAfrica()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createChina()));
}

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ public void notifyChanged(Notification notification) {
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAvailabilityzone()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
Expand Down Expand Up @@ -255,6 +250,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(createChildParameter
(OCCIPackage.Literals.RESOURCE__LINKS,
RegionsFactory.eINSTANCE.createRegionlink()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.RESOURCE__LINKS,
RegionsFactory.eINSTANCE.createAvailabilityzonelink()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ public void notifyChanged(Notification notification) {
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
RegionsFactory.eINSTANCE.createAvailabilityzone()));

newChildDescriptors.add
(createChildParameter
(OCCIPackage.Literals.ENTITY__PARTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ public Adapter createAvailabilityzoneAdapter() {
return availabilityzoneItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link org.eclipse.cmf.occi.multicloud.regions.Availabilityzonelink} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AvailabilityzonelinkItemProvider availabilityzonelinkItemProvider;

/**
* This creates an adapter for a {@link org.eclipse.cmf.occi.multicloud.regions.Availabilityzonelink}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createAvailabilityzonelinkAdapter() {
if (availabilityzonelinkItemProvider == null) {
availabilityzonelinkItemProvider = new AvailabilityzonelinkItemProvider(this);
}

return availabilityzonelinkItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link org.eclipse.cmf.occi.multicloud.regions.Europe} instances.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -390,6 +413,7 @@ public void dispose() {
if (regionItemProvider != null) regionItemProvider.dispose();
if (regionlinkItemProvider != null) regionlinkItemProvider.dispose();
if (availabilityzoneItemProvider != null) availabilityzoneItemProvider.dispose();
if (availabilityzonelinkItemProvider != null) availabilityzonelinkItemProvider.dispose();
if (europeItemProvider != null) europeItemProvider.dispose();
if (northamericaItemProvider != null) northamericaItemProvider.dispose();
if (southamericaItemProvider != null) southamericaItemProvider.dispose();
Expand Down
Loading

0 comments on commit dc5a704

Please sign in to comment.