diff --git a/jdeeco-core/model/RuntimeModel.ecore b/jdeeco-core/model/RuntimeModel.ecore
index 53547c08d..668efb120 100644
--- a/jdeeco-core/model/RuntimeModel.ecore
+++ b/jdeeco-core/model/RuntimeModel.ecore
@@ -65,6 +65,8 @@
+
+
diff --git a/jdeeco-core/model/RuntimeModel.ecorediag b/jdeeco-core/model/RuntimeModel.ecorediag
index e08c94ca7..f2dce6f2f 100644
--- a/jdeeco-core/model/RuntimeModel.ecorediag
+++ b/jdeeco-core/model/RuntimeModel.ecorediag
@@ -177,6 +177,14 @@
+
+
+
+
+
+
+
+
@@ -188,7 +196,7 @@
-
+
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessor.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessor.java
index 19519be8b..4ff7955cd 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessor.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessor.java
@@ -749,6 +749,19 @@ EnsembleDefinition createEnsembleDefinition(Class> clazz) throws AnnotationPro
CommunicationBoundaryPredicate cBoundary = createCommunicationBoundary(clazz);
ensembleDefinition.setCommunicationBoundary(cBoundary);
+ // take the first role (if exists)
+ // at current setting, it is not possible to have multiple instances of the same annotation
+ // and if it would be possible, it is checked in RolesAnnotationChecker
+ Class>[] coordinatorRoleAnnotations = RoleAnnotationsHelper.getCoordinatorRoleAnnotations(clazz);
+ if (coordinatorRoleAnnotations != null && coordinatorRoleAnnotations.length > 0) {
+ ensembleDefinition.setCoordinatorRole(coordinatorRoleAnnotations[0]);
+ }
+
+ Class>[] memberRoleAnnotations = RoleAnnotationsHelper.getMemberRoleAnnotations(clazz);
+ if (memberRoleAnnotations != null && memberRoleAnnotations.length > 0) {
+ ensembleDefinition.setMemberRole(memberRoleAnnotations[0]);
+ }
+
TimeTrigger periodicEnsembleTrigger = createPeriodicTrigger(clazz);
List exchangeKChangeTriggers = createKnowledgeChangeTriggers(exchange.getMethod(), PathOrigin.ENSEMBLE);
List conditionKChangeTriggers = createKnowledgeChangeTriggers(condition.getMethod(), PathOrigin.ENSEMBLE);
@@ -961,10 +974,7 @@ List createParameters(Method method, PathOrigin pathOrigin)
for (int i = 0; i < parameterTypes.length; i++) {
parameters.add(createParameter(parameterTypes[i], genericTypes[i], i, allAnnotations[i], pathOrigin));
}
- if (parameters.isEmpty()) {
- throw new AnnotationProcessorException(
- "The "+ (pathOrigin == PathOrigin.COMPONENT ? "component" : "ensemble") + " process cannot have zero parameters.");
- }
+
return parameters;
}
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/RoleAnnotationsHelper.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/RoleAnnotationsHelper.java
index 3c886bd1c..c30945d79 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/RoleAnnotationsHelper.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/annotations/processor/RoleAnnotationsHelper.java
@@ -17,7 +17,7 @@
*
*/
public class RoleAnnotationsHelper {
-
+
public static Class>[] getCoordinatorRoleAnnotations(Class> clazz) {
Class>[] result = translateCoordinatorRoles(clazz.getAnnotationsByType(CoordinatorRole.class));
return result;
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/EnsembleDefinition.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/EnsembleDefinition.java
index a54543471..7a2b15555 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/EnsembleDefinition.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/EnsembleDefinition.java
@@ -4,6 +4,7 @@
import cz.cuni.mff.d3s.deeco.network.CommunicationBoundaryPredicate;
+import java.lang.reflect.Type;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
@@ -22,6 +23,8 @@
* {@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getTriggers Triggers}
* {@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getCommunicationBoundary Communication Boundary}
* {@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getPartitionedBy Partitioned By}
+ * {@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getCoordinatorRole Coordinator Role}
+ * {@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getMemberRole Member Role}
*
*
*
@@ -176,4 +179,56 @@ public interface EnsembleDefinition extends EObject {
*/
void setPartitionedBy(String value);
+ /**
+ * Returns the value of the 'Coordinator Role' attribute.
+ *
+ *
+ * If the meaning of the 'Coordinator Role' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ *
+ * @return the value of the 'Coordinator Role' attribute.
+ * @see #setCoordinatorRole(Type)
+ * @see cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage#getEnsembleDefinition_CoordinatorRole()
+ * @model dataType="cz.cuni.mff.d3s.deeco.model.runtime.api.Type"
+ * @generated
+ */
+ Type getCoordinatorRole();
+
+ /**
+ * Sets the value of the '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getCoordinatorRole Coordinator Role}' attribute.
+ *
+ *
+ * @param value the new value of the 'Coordinator Role' attribute.
+ * @see #getCoordinatorRole()
+ * @generated
+ */
+ void setCoordinatorRole(Type value);
+
+ /**
+ * Returns the value of the 'Member Role' attribute.
+ *
+ *
+ * If the meaning of the 'Member Role' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ *
+ * @return the value of the 'Member Role' attribute.
+ * @see #setMemberRole(Type)
+ * @see cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage#getEnsembleDefinition_MemberRole()
+ * @model dataType="cz.cuni.mff.d3s.deeco.model.runtime.api.Type"
+ * @generated
+ */
+ Type getMemberRole();
+
+ /**
+ * Sets the value of the '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getMemberRole Member Role}' attribute.
+ *
+ *
+ * @param value the new value of the 'Member Role' attribute.
+ * @see #getMemberRole()
+ * @generated
+ */
+ void setMemberRole(Type value);
+
} // EnsembleDefinition
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/Parameter.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/Parameter.java
index 53d070806..dd9cea37b 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/Parameter.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/api/Parameter.java
@@ -2,6 +2,7 @@
*/
package cz.cuni.mff.d3s.deeco.model.runtime.api;
+import java.lang.reflect.Type;
import org.eclipse.emf.ecore.EObject;
/**
@@ -142,12 +143,12 @@ public interface Parameter extends EObject {
*
*
* @return the value of the 'Generic Type' attribute.
- * @see #setGenericType(java.lang.reflect.Type)
+ * @see #setGenericType(Type)
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage#getParameter_GenericType()
* @model dataType="cz.cuni.mff.d3s.deeco.model.runtime.api.Type" required="true"
* @generated
*/
- java.lang.reflect.Type getGenericType();
+ Type getGenericType();
/**
* Sets the value of the '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter#getGenericType Generic Type}' attribute.
@@ -157,6 +158,6 @@ public interface Parameter extends EObject {
* @see #getGenericType()
* @generated
*/
- void setGenericType(java.lang.reflect.Type value);
+ void setGenericType(Type value);
} // Parameter
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/EnsembleDefinitionImpl.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/EnsembleDefinitionImpl.java
index 07758b8ac..ee89ccbaa 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/EnsembleDefinitionImpl.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/EnsembleDefinitionImpl.java
@@ -11,6 +11,7 @@
import cz.cuni.mff.d3s.deeco.network.CommunicationBoundaryPredicate;
+import java.lang.reflect.Type;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
@@ -40,6 +41,8 @@
* {@link cz.cuni.mff.d3s.deeco.model.runtime.impl.EnsembleDefinitionImpl#getTriggers Triggers}
* {@link cz.cuni.mff.d3s.deeco.model.runtime.impl.EnsembleDefinitionImpl#getCommunicationBoundary Communication Boundary}
* {@link cz.cuni.mff.d3s.deeco.model.runtime.impl.EnsembleDefinitionImpl#getPartitionedBy Partitioned By}
+ * {@link cz.cuni.mff.d3s.deeco.model.runtime.impl.EnsembleDefinitionImpl#getCoordinatorRole Coordinator Role}
+ * {@link cz.cuni.mff.d3s.deeco.model.runtime.impl.EnsembleDefinitionImpl#getMemberRole Member Role}
*
*
*
@@ -136,6 +139,46 @@ public class EnsembleDefinitionImpl extends MinimalEObjectImpl.Container impleme
*/
protected String partitionedBy = PARTITIONED_BY_EDEFAULT;
+ /**
+ * The default value of the '{@link #getCoordinatorRole() Coordinator Role}' attribute.
+ *
+ *
+ * @see #getCoordinatorRole()
+ * @generated
+ * @ordered
+ */
+ protected static final Type COORDINATOR_ROLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCoordinatorRole() Coordinator Role}' attribute.
+ *
+ *
+ * @see #getCoordinatorRole()
+ * @generated
+ * @ordered
+ */
+ protected Type coordinatorRole = COORDINATOR_ROLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getMemberRole() Member Role}' attribute.
+ *
+ *
+ * @see #getMemberRole()
+ * @generated
+ * @ordered
+ */
+ protected static final Type MEMBER_ROLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMemberRole() Member Role}' attribute.
+ *
+ *
+ * @see #getMemberRole()
+ * @generated
+ * @ordered
+ */
+ protected Type memberRole = MEMBER_ROLE_EDEFAULT;
+
/**
*
*
@@ -316,6 +359,48 @@ public void setPartitionedBy(String newPartitionedBy) {
eNotify(new ENotificationImpl(this, Notification.SET, RuntimeMetadataPackage.ENSEMBLE_DEFINITION__PARTITIONED_BY, oldPartitionedBy, partitionedBy));
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public Type getCoordinatorRole() {
+ return coordinatorRole;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public void setCoordinatorRole(Type newCoordinatorRole) {
+ Type oldCoordinatorRole = coordinatorRole;
+ coordinatorRole = newCoordinatorRole;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, RuntimeMetadataPackage.ENSEMBLE_DEFINITION__COORDINATOR_ROLE, oldCoordinatorRole, coordinatorRole));
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public Type getMemberRole() {
+ return memberRole;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public void setMemberRole(Type newMemberRole) {
+ Type oldMemberRole = memberRole;
+ memberRole = newMemberRole;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, RuntimeMetadataPackage.ENSEMBLE_DEFINITION__MEMBER_ROLE, oldMemberRole, memberRole));
+ }
+
/**
*
*
@@ -354,6 +439,10 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
return getCommunicationBoundary();
case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__PARTITIONED_BY:
return getPartitionedBy();
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__COORDINATOR_ROLE:
+ return getCoordinatorRole();
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__MEMBER_ROLE:
+ return getMemberRole();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -386,6 +475,12 @@ public void eSet(int featureID, Object newValue) {
case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__PARTITIONED_BY:
setPartitionedBy((String)newValue);
return;
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__COORDINATOR_ROLE:
+ setCoordinatorRole((Type)newValue);
+ return;
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__MEMBER_ROLE:
+ setMemberRole((Type)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -416,6 +511,12 @@ public void eUnset(int featureID) {
case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__PARTITIONED_BY:
setPartitionedBy(PARTITIONED_BY_EDEFAULT);
return;
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__COORDINATOR_ROLE:
+ setCoordinatorRole(COORDINATOR_ROLE_EDEFAULT);
+ return;
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__MEMBER_ROLE:
+ setMemberRole(MEMBER_ROLE_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -440,6 +541,10 @@ public boolean eIsSet(int featureID) {
return COMMUNICATION_BOUNDARY_EDEFAULT == null ? communicationBoundary != null : !COMMUNICATION_BOUNDARY_EDEFAULT.equals(communicationBoundary);
case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__PARTITIONED_BY:
return PARTITIONED_BY_EDEFAULT == null ? partitionedBy != null : !PARTITIONED_BY_EDEFAULT.equals(partitionedBy);
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__COORDINATOR_ROLE:
+ return COORDINATOR_ROLE_EDEFAULT == null ? coordinatorRole != null : !COORDINATOR_ROLE_EDEFAULT.equals(coordinatorRole);
+ case RuntimeMetadataPackage.ENSEMBLE_DEFINITION__MEMBER_ROLE:
+ return MEMBER_ROLE_EDEFAULT == null ? memberRole != null : !MEMBER_ROLE_EDEFAULT.equals(memberRole);
}
return super.eIsSet(featureID);
}
@@ -460,6 +565,10 @@ public String toString() {
result.append(communicationBoundary);
result.append(", partitionedBy: ");
result.append(partitionedBy);
+ result.append(", coordinatorRole: ");
+ result.append(coordinatorRole);
+ result.append(", memberRole: ");
+ result.append(memberRole);
result.append(')');
return result.toString();
}
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/ParameterImpl.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/ParameterImpl.java
index b2357d162..502161ef8 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/ParameterImpl.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/ParameterImpl.java
@@ -6,6 +6,7 @@
import cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage;
+import java.lang.reflect.Type;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
@@ -87,7 +88,7 @@ public class ParameterImpl extends MinimalEObjectImpl.Container implements Param
* @generated
* @ordered
*/
- protected static final java.lang.reflect.Type GENERIC_TYPE_EDEFAULT = null;
+ protected static final Type GENERIC_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getGenericType() Generic Type}' attribute.
@@ -97,7 +98,7 @@ public class ParameterImpl extends MinimalEObjectImpl.Container implements Param
* @generated
* @ordered
*/
- protected java.lang.reflect.Type genericType = GENERIC_TYPE_EDEFAULT;
+ protected Type genericType = GENERIC_TYPE_EDEFAULT;
/**
*
@@ -233,7 +234,7 @@ public void setType(Class newType) {
*
* @generated
*/
- public java.lang.reflect.Type getGenericType() {
+ public Type getGenericType() {
return genericType;
}
@@ -242,8 +243,8 @@ public java.lang.reflect.Type getGenericType() {
*
* @generated
*/
- public void setGenericType(java.lang.reflect.Type newGenericType) {
- java.lang.reflect.Type oldGenericType = genericType;
+ public void setGenericType(Type newGenericType) {
+ Type oldGenericType = genericType;
genericType = newGenericType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RuntimeMetadataPackage.PARAMETER__GENERIC_TYPE, oldGenericType, genericType));
@@ -301,7 +302,7 @@ public void eSet(int featureID, Object newValue) {
setType((Class)newValue);
return;
case RuntimeMetadataPackage.PARAMETER__GENERIC_TYPE:
- setGenericType((java.lang.reflect.Type)newValue);
+ setGenericType((Type)newValue);
return;
}
super.eSet(featureID, newValue);
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataFactoryImpl.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataFactoryImpl.java
index d55f1eb4d..2ea5c008a 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataFactoryImpl.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataFactoryImpl.java
@@ -10,6 +10,7 @@
import cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage;
import cz.cuni.mff.d3s.deeco.network.CommunicationBoundaryPredicate;
import java.lang.reflect.Method;
+import java.lang.reflect.Type;
import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
@@ -545,8 +546,8 @@ public String convertRatingsManagerToString(EDataType eDataType, Object instance
*
* @generated
*/
- public java.lang.reflect.Type createTypeFromString(EDataType eDataType, String initialValue) {
- return (java.lang.reflect.Type)super.createFromString(eDataType, initialValue);
+ public Type createTypeFromString(EDataType eDataType, String initialValue) {
+ return (Type)super.createFromString(eDataType, initialValue);
}
/**
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataPackageImpl.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataPackageImpl.java
index be6c5db35..3db888484 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataPackageImpl.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/impl/RuntimeMetadataPackageImpl.java
@@ -39,6 +39,7 @@
import cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage;
import cz.cuni.mff.d3s.deeco.network.CommunicationBoundaryPredicate;
import java.lang.reflect.Method;
+import java.lang.reflect.Type;
import java.util.Map;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -690,6 +691,24 @@ public EAttribute getEnsembleDefinition_PartitionedBy() {
return (EAttribute)ensembleDefinitionEClass.getEStructuralFeatures().get(5);
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public EAttribute getEnsembleDefinition_CoordinatorRole() {
+ return (EAttribute)ensembleDefinitionEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public EAttribute getEnsembleDefinition_MemberRole() {
+ return (EAttribute)ensembleDefinitionEClass.getEStructuralFeatures().get(7);
+ }
+
/**
*
*
@@ -1239,6 +1258,8 @@ public void createPackageContents() {
createEReference(ensembleDefinitionEClass, ENSEMBLE_DEFINITION__TRIGGERS);
createEAttribute(ensembleDefinitionEClass, ENSEMBLE_DEFINITION__COMMUNICATION_BOUNDARY);
createEAttribute(ensembleDefinitionEClass, ENSEMBLE_DEFINITION__PARTITIONED_BY);
+ createEAttribute(ensembleDefinitionEClass, ENSEMBLE_DEFINITION__COORDINATOR_ROLE);
+ createEAttribute(ensembleDefinitionEClass, ENSEMBLE_DEFINITION__MEMBER_ROLE);
conditionEClass = createEClass(CONDITION);
@@ -1407,6 +1428,8 @@ public void initializePackageContents() {
initEReference(getEnsembleDefinition_Triggers(), this.getTrigger(), null, "triggers", null, 0, -1, EnsembleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getEnsembleDefinition_CommunicationBoundary(), this.getCommunicationBoundary(), "communicationBoundary", null, 0, 1, EnsembleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getEnsembleDefinition_PartitionedBy(), ecorePackage.getEString(), "partitionedBy", null, 0, 1, EnsembleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEnsembleDefinition_CoordinatorRole(), this.getType(), "coordinatorRole", null, 0, 1, EnsembleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEnsembleDefinition_MemberRole(), this.getType(), "memberRole", null, 0, 1, EnsembleDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(conditionEClass, Condition.class, "Condition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -1489,7 +1512,7 @@ public void initializePackageContents() {
initEDataType(shadowKnowledgeManagerRegistryEDataType, ShadowKnowledgeManagerRegistry.class, "ShadowKnowledgeManagerRegistry", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(communicationBoundaryEDataType, CommunicationBoundaryPredicate.class, "CommunicationBoundary", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(ratingsManagerEDataType, RatingsManager.class, "RatingsManager", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(typeEDataType, java.lang.reflect.Type.class, "Type", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(typeEDataType, Type.class, "Type", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
// Create resource
createResource(eNS_URI);
diff --git a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/meta/RuntimeMetadataPackage.java b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/meta/RuntimeMetadataPackage.java
index 60cc68574..09b8e00b4 100644
--- a/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/meta/RuntimeMetadataPackage.java
+++ b/jdeeco-core/src/cz/cuni/mff/d3s/deeco/model/runtime/meta/RuntimeMetadataPackage.java
@@ -545,6 +545,24 @@ public interface RuntimeMetadataPackage extends EPackage {
*/
int ENSEMBLE_DEFINITION__PARTITIONED_BY = 5;
+ /**
+ * The feature id for the 'Coordinator Role' attribute.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ int ENSEMBLE_DEFINITION__COORDINATOR_ROLE = 6;
+
+ /**
+ * The feature id for the 'Member Role' attribute.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ int ENSEMBLE_DEFINITION__MEMBER_ROLE = 7;
+
/**
* The number of structural features of the 'Ensemble Definition' class.
*
@@ -552,7 +570,7 @@ public interface RuntimeMetadataPackage extends EPackage {
* @generated
* @ordered
*/
- int ENSEMBLE_DEFINITION_FEATURE_COUNT = 6;
+ int ENSEMBLE_DEFINITION_FEATURE_COUNT = 8;
/**
* The number of operations of the 'Ensemble Definition' class.
@@ -1922,6 +1940,28 @@ public interface RuntimeMetadataPackage extends EPackage {
*/
EAttribute getEnsembleDefinition_PartitionedBy();
+ /**
+ * Returns the meta object for the attribute '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getCoordinatorRole Coordinator Role}'.
+ *
+ *
+ * @return the meta object for the attribute 'Coordinator Role'.
+ * @see cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getCoordinatorRole()
+ * @see #getEnsembleDefinition()
+ * @generated
+ */
+ EAttribute getEnsembleDefinition_CoordinatorRole();
+
+ /**
+ * Returns the meta object for the attribute '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getMemberRole Member Role}'.
+ *
+ *
+ * @return the meta object for the attribute 'Member Role'.
+ * @see cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition#getMemberRole()
+ * @see #getEnsembleDefinition()
+ * @generated
+ */
+ EAttribute getEnsembleDefinition_MemberRole();
+
/**
* Returns the meta object for class '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.Condition Condition}'.
*
@@ -2809,6 +2849,22 @@ interface Literals {
*/
EAttribute ENSEMBLE_DEFINITION__PARTITIONED_BY = eINSTANCE.getEnsembleDefinition_PartitionedBy();
+ /**
+ * The meta object literal for the 'Coordinator Role' attribute feature.
+ *
+ *
+ * @generated
+ */
+ EAttribute ENSEMBLE_DEFINITION__COORDINATOR_ROLE = eINSTANCE.getEnsembleDefinition_CoordinatorRole();
+
+ /**
+ * The meta object literal for the 'Member Role' attribute feature.
+ *
+ *
+ * @generated
+ */
+ EAttribute ENSEMBLE_DEFINITION__MEMBER_ROLE = eINSTANCE.getEnsembleDefinition_MemberRole();
+
/**
* The meta object literal for the '{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ConditionImpl Condition}' class.
*
diff --git a/jdeeco-core/test/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessorTest.java b/jdeeco-core/test/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessorTest.java
index b9dc9c880..c7b6ac213 100644
--- a/jdeeco-core/test/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessorTest.java
+++ b/jdeeco-core/test/cz/cuni/mff/d3s/deeco/annotations/processor/AnnotationProcessorTest.java
@@ -27,8 +27,16 @@
import org.junit.rules.ExpectedException;
import org.mockito.InOrder;
+import cz.cuni.mff.d3s.deeco.annotations.CoordinatorRole;
+import cz.cuni.mff.d3s.deeco.annotations.Ensemble;
+import cz.cuni.mff.d3s.deeco.annotations.In;
import cz.cuni.mff.d3s.deeco.annotations.InOut;
+import cz.cuni.mff.d3s.deeco.annotations.KnowledgeExchange;
+import cz.cuni.mff.d3s.deeco.annotations.MemberRole;
+import cz.cuni.mff.d3s.deeco.annotations.Membership;
import cz.cuni.mff.d3s.deeco.annotations.Out;
+import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling;
+import cz.cuni.mff.d3s.deeco.annotations.Role;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.TokenMgrError;
@@ -640,20 +648,6 @@ public void testExceptionsInComponentParsing4() throws AnnotationProcessorExcept
processor.processComponent(input);
}
- @Test
- public void testExceptionsInComponentParsing5() throws AnnotationProcessorException {
- RuntimeMetadata model = factory.createRuntimeMetadata();
- AnnotationProcessor processor = new AnnotationProcessor(factory,model,knowledgeManagerFactory,new ArrayList());
-
- WrongC5 input = new WrongC5();
- exception.expect(AnnotationProcessorException.class);
- exception.expectMessage(
- "Component: "+input.getClass().getCanonicalName()+"->" +
- "Process: process1->" +
- "The component process cannot have zero parameters.");
- processor.processComponent(input);
- }
-
@Test
public void testExceptionsInEnsembleParsing1() throws AnnotationProcessorException, DuplicateEnsembleDefinitionException {
RuntimeMetadata model = factory.createRuntimeMetadata();
@@ -820,6 +814,51 @@ public void testAnnotationCheckersEnsembleException() throws AnnotationProcessor
processor.processEnsemble(CorrectE1.class);
}
+ @Role
+ static class RoleClass1 { }
+
+ @Role
+ static class RoleClass2 { }
+
+ @Ensemble
+ @PeriodicScheduling(period=3000)
+ @CoordinatorRole(RoleClass1.class)
+ @MemberRole(RoleClass2.class)
+ static class EnsembleClass1 { @Membership public static boolean m() { return false; } @KnowledgeExchange public static void pe() { } }
+
+ @Ensemble
+ @PeriodicScheduling(period=3000)
+ @CoordinatorRole(RoleClass2.class)
+ static class EnsembleClass2 { @Membership public static boolean m() { return false; } @KnowledgeExchange public static void pe() { }}
+
+ @Ensemble
+ @PeriodicScheduling(period=3000)
+ @MemberRole(RoleClass1.class)
+ static class EnsembleClass3 { @Membership public static boolean m() { return false; } @KnowledgeExchange public static void pe() { }}
+
+ @Ensemble
+ @PeriodicScheduling(period=3000)
+ static class EnsembleClass4 { @Membership public static boolean m() { return false; } @KnowledgeExchange public static void pe() { }}
+
+ @Test
+ public void testEnsembleRoles() throws AnnotationProcessorException, DuplicateEnsembleDefinitionException {
+ RuntimeMetadata model = factory.createRuntimeMetadata();
+ AnnotationProcessor processor = new AnnotationProcessor(factory,model,knowledgeManagerFactory,new ArrayList());
+ EnsembleDefinition ed1 = processor.processEnsemble(EnsembleClass1.class);
+ EnsembleDefinition ed2 = processor.processEnsemble(EnsembleClass2.class);
+ EnsembleDefinition ed3 = processor.processEnsemble(EnsembleClass3.class);
+ EnsembleDefinition ed4 = processor.processEnsemble(EnsembleClass4.class);
+
+ assertEquals(RoleClass1.class, ed1.getCoordinatorRole());
+ assertEquals(RoleClass2.class, ed1.getMemberRole());
+ assertEquals(RoleClass2.class, ed2.getCoordinatorRole());
+ assertNull(ed2.getMemberRole());
+ assertNull(ed3.getCoordinatorRole());
+ assertEquals(RoleClass1.class, ed3.getMemberRole());
+ assertNull(ed4.getCoordinatorRole());
+ assertNull(ed4.getMemberRole());
+ }
+
/*
* Helpers.
*/