Skip to content
Snippets Groups Projects
Commit 010728f6 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

removes the CBDP aspects from the service

refs 2620
parent f47720ed
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
......@@ -30,7 +29,6 @@ import org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum;
import org.fortiss.tooling.kernel.model.constraints.ConstraintsFactory;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraint;
import org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatus;
import org.fortiss.tooling.kernel.service.IConstraintVerificationService;
import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -44,7 +42,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 34F33564756833D453A66DFD53D78FC8
* @ConQAT.Rating YELLOW Hash: DBE8840892D099FA011822EF6EB4ED9E
*/
public final class ConstraintVerificationService extends
EObjectAwareServiceBase<IConstraintVerifier<IConstraint>> implements
......@@ -58,9 +56,6 @@ public final class ConstraintVerificationService extends
return INSTANCE;
}
/** Map ID -> Verifier. */
private HashMap<String, IConstraintVerifier<IConstraint>> idMap = new HashMap<>();
/** {@inheritDoc} */
@Override
public void startService() {
......@@ -75,13 +70,6 @@ public final class ConstraintVerificationService extends
addHandler(constraintElementClass, (IConstraintVerifier<IConstraint>)verifier);
}
/** {@inheritDoc} */
@Override
protected void addHandler(Class<?> modelElementClass, IConstraintVerifier<IConstraint> handler) {
super.addHandler(modelElementClass, handler);
idMap.put(handler.getID(), handler);
}
/** {@inheritDoc} */
@Override
public String getIntrospectionDescription() {
......@@ -129,7 +117,9 @@ public final class ConstraintVerificationService extends
// And we also update the checksums after in case the verification had some side
// effects...
updateChecksums(constraint);
constraint.getVerificationStatus().setConstraint(constraint);
if(constraint.getVerificationStatus() != null) {
constraint.getVerificationStatus().setConstraint(constraint);
}
}
});
}
......@@ -137,13 +127,11 @@ public final class ConstraintVerificationService extends
/** {@inheritDoc} */
@Override
public List<IFix> fixes(IConstraintVerificationStatus status) {
public <T extends IConstraint> List<IFix> fixes(T c) {
List<IFix> fixes = null;
if(status != null) {
IConstraintVerifier<IConstraint> verifier = getFirstVerifier(status.getConstraint());
if(verifier != null) {
fixes = verifier.fixes(status);
}
IConstraintVerifier<IConstraint> verifier = getFirstVerifier(c);
if(verifier != null) {
fixes = verifier.fixes(c, c.getVerificationStatus());
}
return fixes != null ? fixes : new ArrayList<IFix>();
}
......@@ -182,7 +170,7 @@ public final class ConstraintVerificationService extends
/**
* Flag to print objects which are actually checksummed in various files.
* This is useful since it is essential to control very precisely how checksums are computed.
* Should however only be set to <code>true</code> on a local machine, not commited!
* Should however only be set to <code>true</code> on a local machine, never commited!
*/
private final boolean DEBUG = false;
......@@ -217,7 +205,7 @@ public final class ConstraintVerificationService extends
res.save(oos, options);
if(DEBUG) {
String fileName = "/home/aravantinos/temp/constraints/temp" + debug_trace_number++;
String fileName = "/home/vincent/temp/constraints/temp" + debug_trace_number++;
String nameConstraint =
constraint instanceof INamedElement ? ((INamedElement)constraint).getName()
: constraint.toString();
......@@ -341,17 +329,4 @@ public final class ConstraintVerificationService extends
public IIntrospectionDetailsItem getDetailsItem() {
return new ConstraintVerificationServiceIntrospectionDetailsItem(handlerMap);
}
/** {@inheritDoc} */
@Override
public <T extends IConstraint> String getDescription(String id) {
IConstraintVerifier<IConstraint> verifier = this.idMap.get(id);
return verifier != null ? verifier.getDescription() : null;
}
/** {@inheritDoc} */
@Override
public Set<String> getDevelopmentProcessConstraintIDs() {
return this.idMap.keySet();
}
}
package org.fortiss.tooling.kernel.service;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import org.fortiss.tooling.kernel.extension.IConstraintVerifier;
......@@ -9,6 +8,7 @@ import org.fortiss.tooling.kernel.internal.ConstraintVerificationService;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraint;
import org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatus;
import org.fortiss.tooling.kernel.model.constraints.OutdatedVerificationStatus;
/**
* The verification service allows to register "constraint verifiers", e.g.,
......@@ -17,7 +17,7 @@ import org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatu
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: FD558867A49922BF4EB907180C0AB05D
* @ConQAT.Rating YELLOW Hash: EA0300E3E7FE78E9541ADC365502975F
*/
public interface IConstraintVerificationService {
/** Returns the service instance. */
......@@ -36,15 +36,21 @@ public interface IConstraintVerificationService {
/**
* @param constraint
* @return <code>true</code> if <code>constraint</code> is up to date.
* This does not just look at the status but computes a diff between the constrained
* element and the one for which the constraint was last time checked. In the standard
* case, it is enough to call IConstraintVerificationUIService.getStatus and see if the
* result is an instance of {@link OutdatedVerificationStatus}.You should use
* {isUpToDate} *only if IConstraintVerificationUIService.getStatus does not provide the
* information you want*.
*/
boolean isUpToDate(IConstraint constraint);
/**
* @param status
* @return A list of possible automatic fixes for the (constraint of) <code>status</code>.
* A status should be candidate to fixing if it is anything but successful or outdated.
* @param constraint
* @return A list of possible automatic fixes for <code>constraint</code>. A constraint should
* be candidate to fixing if it is anything but successful or outdated.
*/
List<IFix> fixes(IConstraintVerificationStatus status);
<T extends IConstraint> List<IFix> fixes(T constraint);
/** Interface for a "fix". */
public interface IFix {
......@@ -104,17 +110,4 @@ public interface IConstraintVerificationService {
/** Registers the given verifier with the service. */
<T extends IConstraint> void registerConstraintVerifier(IConstraintVerifier<T> verifier,
Class<T> constraintElementClass);
/**
* The following features deal with the usage of constraints to drive the process.
*
* EXPERIMENTAL.
*/
/** Gets a general description for the constraint type. */
<T extends IConstraint> String getDescription(String id);
/** Gets the constraint types which can be used for constraint-based development process. */
Set<String> getDevelopmentProcessConstraintIDs();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment