Skip to content

Commit

Permalink
Refactor: renamed ComponentInstance.roles to securityRoles (therefore
Browse files Browse the repository at this point in the history
getRoles() is changed to getSecurityRoles())
  • Loading branch information
jiracekz committed Feb 5, 2015
1 parent 5538f98 commit 9b189a9
Show file tree
Hide file tree
Showing 12 changed files with 1,292 additions and 1,292 deletions.
312 changes: 156 additions & 156 deletions jdeeco-core/model/RuntimeModel.ecore

Large diffs are not rendered by default.

2,158 changes: 1,079 additions & 1,079 deletions jdeeco-core/model/RuntimeModel.ecorediag

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ ComponentInstance createComponentInstance(Object obj) throws AnnotationProcessor
throw new AnnotationProcessorException("The same role cannot be assigned multiply to a component.");
}
SecurityRole securityRole = createRoleFromClassDefinition(role.value(), km, SECURITY_ARGUMENT_PATH_VALIDATION.VALIDATE, SECURITY_ROLE_LOAD_TYPE.RECURSIVE);
componentInstance.getRoles().add(securityRole);
componentInstance.getSecurityRoles().add(securityRole);
roles.add(role.value());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getEnsembleControllers <em>Ensemble Controllers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getInternalData <em>Internal Data</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#isSystemComponent <em>System Component</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getRoles <em>Roles</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getSecurityRoles <em>Security Roles</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getRatingsProcess <em>Ratings Process</em>}</li>
* </ul>
* </p>
Expand Down Expand Up @@ -192,20 +192,20 @@ public interface ComponentInstance extends EObject {
void setSystemComponent(boolean value);

/**
* Returns the value of the '<em><b>Roles</b></em>' containment reference list.
* Returns the value of the '<em><b>Security Roles</b></em>' containment reference list.
* The list contents are of type {@link cz.cuni.mff.d3s.deeco.model.runtime.api.SecurityRole}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Roles</em>' containment reference list isn't clear,
* If the meaning of the '<em>Security Roles</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Roles</em>' containment reference list.
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage#getComponentInstance_Roles()
* @return the value of the '<em>Security Roles</em>' containment reference list.
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataPackage#getComponentInstance_SecurityRoles()
* @model containment="true"
* @generated
*/
EList<SecurityRole> getRoles();
EList<SecurityRole> getSecurityRoles();

/**
* Returns the value of the '<em><b>Ratings Process</b></em>' containment reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#getEnsembleControllers <em>Ensemble Controllers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#getInternalData <em>Internal Data</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#isSystemComponent <em>System Component</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#getRoles <em>Roles</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#getSecurityRoles <em>Security Roles</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ComponentInstanceImpl#getRatingsProcess <em>Ratings Process</em>}</li>
* </ul>
* </p>
Expand Down Expand Up @@ -158,14 +158,14 @@ public class ComponentInstanceImpl extends MinimalEObjectImpl.Container implemen
protected boolean systemComponent = SYSTEM_COMPONENT_EDEFAULT;

/**
* The cached value of the '{@link #getRoles() <em>Roles</em>}' containment reference list.
* The cached value of the '{@link #getSecurityRoles() <em>Security Roles</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRoles()
* @see #getSecurityRoles()
* @generated
* @ordered
*/
protected EList<SecurityRole> roles;
protected EList<SecurityRole> securityRoles;

/**
* The cached value of the '{@link #getRatingsProcess() <em>Ratings Process</em>}' containment reference.
Expand Down Expand Up @@ -321,11 +321,11 @@ public void setSystemComponent(boolean newSystemComponent) {
* <!-- end-user-doc -->
* @generated
*/
public EList<SecurityRole> getRoles() {
if (roles == null) {
roles = new EObjectContainmentEList<SecurityRole>(SecurityRole.class, this, RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES);
public EList<SecurityRole> getSecurityRoles() {
if (securityRoles == null) {
securityRoles = new EObjectContainmentEList<SecurityRole>(SecurityRole.class, this, RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES);
}
return roles;
return securityRoles;
}

/**
Expand Down Expand Up @@ -406,8 +406,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID,
return ((InternalEList<?>)getEnsembleControllers()).basicRemove(otherEnd, msgs);
case RuntimeMetadataPackage.COMPONENT_INSTANCE__INTERNAL_DATA:
return ((InternalEList<?>)getInternalData()).basicRemove(otherEnd, msgs);
case RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES:
return ((InternalEList<?>)getRoles()).basicRemove(otherEnd, msgs);
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES:
return ((InternalEList<?>)getSecurityRoles()).basicRemove(otherEnd, msgs);
case RuntimeMetadataPackage.COMPONENT_INSTANCE__RATINGS_PROCESS:
return basicSetRatingsProcess(null, msgs);
}
Expand Down Expand Up @@ -437,8 +437,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
else return getInternalData().map();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SYSTEM_COMPONENT:
return isSystemComponent();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES:
return getRoles();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES:
return getSecurityRoles();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__RATINGS_PROCESS:
return getRatingsProcess();
}
Expand Down Expand Up @@ -477,9 +477,9 @@ public void eSet(int featureID, Object newValue) {
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SYSTEM_COMPONENT:
setSystemComponent((Boolean)newValue);
return;
case RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES:
getRoles().clear();
getRoles().addAll((Collection<? extends SecurityRole>)newValue);
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES:
getSecurityRoles().clear();
getSecurityRoles().addAll((Collection<? extends SecurityRole>)newValue);
return;
case RuntimeMetadataPackage.COMPONENT_INSTANCE__RATINGS_PROCESS:
setRatingsProcess((RatingsProcess)newValue);
Expand Down Expand Up @@ -517,8 +517,8 @@ public void eUnset(int featureID) {
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SYSTEM_COMPONENT:
setSystemComponent(SYSTEM_COMPONENT_EDEFAULT);
return;
case RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES:
getRoles().clear();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES:
getSecurityRoles().clear();
return;
case RuntimeMetadataPackage.COMPONENT_INSTANCE__RATINGS_PROCESS:
setRatingsProcess((RatingsProcess)null);
Expand Down Expand Up @@ -549,8 +549,8 @@ public boolean eIsSet(int featureID) {
return internalData != null && !internalData.isEmpty();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SYSTEM_COMPONENT:
return systemComponent != SYSTEM_COMPONENT_EDEFAULT;
case RuntimeMetadataPackage.COMPONENT_INSTANCE__ROLES:
return roles != null && !roles.isEmpty();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__SECURITY_ROLES:
return securityRoles != null && !securityRoles.isEmpty();
case RuntimeMetadataPackage.COMPONENT_INSTANCE__RATINGS_PROCESS:
return ratingsProcess != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ public EAttribute getComponentInstance_SystemComponent() {
* <!-- end-user-doc -->
* @generated
*/
public EReference getComponentInstance_Roles() {
public EReference getComponentInstance_SecurityRoles() {
return (EReference)componentInstanceEClass.getEStructuralFeatures().get(7);
}

Expand Down Expand Up @@ -1204,7 +1204,7 @@ public void createPackageContents() {
createEReference(componentInstanceEClass, COMPONENT_INSTANCE__ENSEMBLE_CONTROLLERS);
createEReference(componentInstanceEClass, COMPONENT_INSTANCE__INTERNAL_DATA);
createEAttribute(componentInstanceEClass, COMPONENT_INSTANCE__SYSTEM_COMPONENT);
createEReference(componentInstanceEClass, COMPONENT_INSTANCE__ROLES);
createEReference(componentInstanceEClass, COMPONENT_INSTANCE__SECURITY_ROLES);
createEReference(componentInstanceEClass, COMPONENT_INSTANCE__RATINGS_PROCESS);

ensembleDefinitionEClass = createEClass(ENSEMBLE_DEFINITION);
Expand Down Expand Up @@ -1370,7 +1370,7 @@ public void initializePackageContents() {
initEReference(getComponentInstance_EnsembleControllers(), this.getEnsembleController(), this.getEnsembleController_ComponentInstance(), "ensembleControllers", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getComponentInstance_InternalData(), this.getStringToObjectMap(), null, "internalData", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getComponentInstance_SystemComponent(), ecorePackage.getEBoolean(), "systemComponent", "false", 0, 1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getComponentInstance_Roles(), this.getSecurityRole(), null, "roles", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getComponentInstance_SecurityRoles(), this.getSecurityRole(), null, "securityRoles", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getComponentInstance_RatingsProcess(), this.getRatingsProcess(), this.getRatingsProcess_ComponentInstance(), "ratingsProcess", null, 0, 1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

initEClass(ensembleDefinitionEClass, EnsembleDefinition.class, "EnsembleDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,13 @@ public interface RuntimeMetadataPackage extends EPackage {
int COMPONENT_INSTANCE__SYSTEM_COMPONENT = 6;

/**
* The feature id for the '<em><b>Roles</b></em>' containment reference list.
* The feature id for the '<em><b>Security Roles</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int COMPONENT_INSTANCE__ROLES = 7;
int COMPONENT_INSTANCE__SECURITY_ROLES = 7;

/**
* The feature id for the '<em><b>Ratings Process</b></em>' containment reference.
Expand Down Expand Up @@ -1805,15 +1805,15 @@ public interface RuntimeMetadataPackage extends EPackage {
EAttribute getComponentInstance_SystemComponent();

/**
* Returns the meta object for the containment reference list '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getRoles <em>Roles</em>}'.
* Returns the meta object for the containment reference list '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getSecurityRoles <em>Security Roles</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Roles</em>'.
* @see cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getRoles()
* @return the meta object for the containment reference list '<em>Security Roles</em>'.
* @see cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getSecurityRoles()
* @see #getComponentInstance()
* @generated
*/
EReference getComponentInstance_Roles();
EReference getComponentInstance_SecurityRoles();

/**
* Returns the meta object for the containment reference '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance#getRatingsProcess <em>Ratings Process</em>}'.
Expand Down Expand Up @@ -2694,12 +2694,12 @@ interface Literals {
EAttribute COMPONENT_INSTANCE__SYSTEM_COMPONENT = eINSTANCE.getComponentInstance_SystemComponent();

/**
* The meta object literal for the '<em><b>Roles</b></em>' containment reference list feature.
* The meta object literal for the '<em><b>Security Roles</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference COMPONENT_INSTANCE__ROLES = eINSTANCE.getComponentInstance_Roles();
EReference COMPONENT_INSTANCE__SECURITY_ROLES = eINSTANCE.getComponentInstance_SecurityRoles();

/**
* The meta object literal for the '<em><b>Ratings Process</b></em>' containment reference feature.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private Object accessValue(SealedObject sealedObject, KnowledgeManager replica,
boolean decryptionSucceeded = false;

// gets the roles transitive closure
List<SecurityRole> transitiveRoles = RoleHelper.getTransitiveRoles(replica.getComponent().getRoles());
List<SecurityRole> transitiveRoles = RoleHelper.getTransitiveRoles(replica.getComponent().getSecurityRoles());

// try each role, if it can decrypt the data
for (SecurityRole role : transitiveRoles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private boolean canAccessTag(PathRoot localRole, KnowledgePath securedKnowledgeP
}

// get the roles transitive closure
List<SecurityRole> localRoles = RoleHelper.getTransitiveRoles(accessingKnowledgeManager.getComponent().getRoles());
List<SecurityRole> localRoles = RoleHelper.getTransitiveRoles(accessingKnowledgeManager.getComponent().getSecurityRoles());
boolean canAccessTag = false;

// read the data from the security tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ public void testComponentSecurityAnnotations() throws AnnotationProcessorExcepti
assertEquals(123, ((AbsoluteSecurityRoleArgument) timeSecurityTags.get(0).getRequiredRole().getArguments().get(2)).getValue());
assertEquals("some_value", ((AbsoluteSecurityRoleArgument) timeSecurityTags.get(0).getRequiredRole().getArguments().get(3)).getValue());

assertEquals(2, component.getRoles().size());
assertEquals(cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC4.Role1.class.getName(), component.getRoles().get(0).getRoleName());
assertEquals(1, component.getRoles().get(0).getArguments().size());
assertEquals(cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC4.Role2.class.getName(), component.getRoles().get(1).getRoleName());
assertEquals(5, component.getRoles().get(1).getArguments().size());
assertEquals(2, component.getSecurityRoles().size());
assertEquals(cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC4.Role1.class.getName(), component.getSecurityRoles().get(0).getRoleName());
assertEquals(1, component.getSecurityRoles().get(0).getArguments().size());
assertEquals(cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC4.Role2.class.getName(), component.getSecurityRoles().get(1).getRoleName());
assertEquals(5, component.getSecurityRoles().get(1).getArguments().size());

pathArgument = (PathSecurityRoleArgument)component.getRoles().get(1).getArguments().get(0);
pathArgument = (PathSecurityRoleArgument)component.getSecurityRoles().get(1).getArguments().get(0);
assertEquals(RuntimeModelHelper.createKnowledgePath("name"), pathArgument.getKnowledgePath());
assertEquals("name", pathArgument.getName());
assertEquals("time", component.getRoles().get(1).getArguments().get(1).getName());
assertEquals("time", component.getSecurityRoles().get(1).getArguments().get(1).getName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public void setUp() throws InvalidKeyException, CertificateEncodingException, Ke
SecurityRole role = factory.createSecurityRole();
role.setRoleName("testrole1");
ComponentInstance tmpComponent = factory.createComponentInstance();
tmpComponent.getRoles().add(role);
when(component.getRoles()).thenReturn(tmpComponent.getRoles());
tmpComponent.getSecurityRoles().add(role);
when(component.getSecurityRoles()).thenReturn(tmpComponent.getSecurityRoles());

replicaKnowledgeManager = new BaseKnowledgeManager("receiver_id", component);
securityHelper = new SecurityHelper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,19 @@ public void checkSecurity_localTest1() throws TaskInvocationException, Knowledge
arg_some_param.setName("roleA_some_param");
arg_some_param.setKnowledgePath(RuntimeModelHelper.createKnowledgePath("some_param"));
roleA.getArguments().add(arg_some_param);
localComponent.getRoles().add(roleA);
localComponent.getSecurityRoles().add(roleA);

SecurityRole roleB = factory.createSecurityRole();
roleB.setRoleName("roleB");
localComponent.getRoles().add(roleB);
localComponent.getSecurityRoles().add(roleB);

SecurityRole roleC = factory.createSecurityRole();
roleC.setRoleName("roleC");
shadowComponent.getRoles().add(roleC);
shadowComponent.getSecurityRoles().add(roleC);

SecurityRole roleC2 = factory.createSecurityRole();
roleC2.setRoleName("roleC");
localComponent.getRoles().add(roleC2);
localComponent.getSecurityRoles().add(roleC2);

// when checkSecurity() as coordinator is called
assertFalse(target.checkSecurity(PathRoot.COORDINATOR, shadowKnowledgeManager));
Expand Down Expand Up @@ -250,14 +250,14 @@ public void checkSecurity_localTest2() throws TaskInvocationException, Knowledge

SecurityRole roleB = factory.createSecurityRole();
roleB.setRoleName("roleB");
localComponent.getRoles().add(roleB);
localComponent.getSecurityRoles().add(roleB);

// when checkSecurity() as member is called
assertFalse(target.checkSecurity(PathRoot.MEMBER, shadowKnowledgeManager));

SecurityRole roleC2 = factory.createSecurityRole();
roleC2.setRoleName("roleC");
localComponent.getRoles().add(roleC2);
localComponent.getSecurityRoles().add(roleC2);

// when checkSecurity() as member is called
assertTrue(target.checkSecurity(PathRoot.MEMBER, shadowKnowledgeManager));
Expand Down Expand Up @@ -291,7 +291,7 @@ public void checkSecurity_ContextTest() throws TaskInvocationException, Knowledg

SecurityRole role = factory.createSecurityRole();
role.setRoleName("role");
localComponent.getRoles().add(role);
localComponent.getSecurityRoles().add(role);

assertFalse(target.checkSecurity(PathRoot.COORDINATOR, localKnowledgeManager));

Expand Down Expand Up @@ -336,14 +336,14 @@ public void checkSecurity_localNestedPathTest() throws TaskInvocationException,

SecurityRole roleA = factory.createSecurityRole();
roleA.setRoleName("roleA");
localComponent.getRoles().add(roleA);
localComponent.getSecurityRoles().add(roleA);

// when checkSecurity() as member is called (missing roleB)
assertFalse(target.checkSecurity(PathRoot.MEMBER, shadowKnowledgeManager));

SecurityRole roleB = factory.createSecurityRole();
roleB.setRoleName("roleB");
localComponent.getRoles().add(roleB);
localComponent.getSecurityRoles().add(roleB);

// when checkSecurity() as member is called
assertTrue(target.checkSecurity(PathRoot.MEMBER, shadowKnowledgeManager));
Expand Down

0 comments on commit 9b189a9

Please sign in to comment.