de.interactive_instruments.ShapeChange.Transformation.Profiling
Class Profiler

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.Transformation.Profiling.Profiler
All Implemented Interfaces:
Transformer

public class Profiler
extends Object
implements Transformer

Creates a profile of the base model by removing all classes and properties that do not belong to one of the profiles stated in the ShapeChange configuration. Each profile identifier in the configuration parameter must match the following regular expression: (\w|-)+(\[[0-9]+(\.[0-9]+)*\])?

Author:
Johannes Echterhoff (echterhoff interactive-instruments de)

Nested Class Summary
static class Profiler.ConstraintHandling
          Enumeration of the different behaviors for handling constraints during profiling.
 
Field Summary
static String CONSTRAINTHANDLING_PARAMETER
          Name of the configuration parameter that contains information on how to handle constraints during profiling.
static String PROFILES_PARAMETER
          Name of the configuration parameter that contains information about the profile(s) to restrict the model to.
static String PROFILES_TAGGED_VALUE
          Name of the tagged value that contains the profile information.
static String PROFILING_CFG_PARAM_RESIDUALTYPEREMOVAL_INCLUDESUBTYPESFOR
          Regular expression to identify the name of the classes for which subtypes shall be included.
static String RULE_TRF_PROFILING_POSTPROCESSING_REMOVEEMPTYPACKAGES
           
static String RULE_TRF_PROFILING_POSTPROCESSING_REMOVERESIDUALTYPES
           
static String RULE_TRF_PROFILING_PREPROCESSING_MODELCONSISTENCYCHECK
           
static String RULE_TRF_PROFILING_PREPROCESSING_PROFILESVALUECONSISTENCYCHECK
           
static String RULE_TRF_PROFILING_PROCESSING_CLASS_REMOVAL_INCLUDES_ALL_SUBTYPES
          If this rule is enabled, then the profiler does not only remove individual classes if their profiles do not match, but also all their (direct and indirect) subclasses.
static String RULE_TRF_PROFILING_PROCESSING_EXPLICITPROFILESETTINGS
          If this rule is enabled, model elements without profile information are treated as if they belonged to no profile (which overrides the default behavior that classes belong to all profiles and properties inherit profiles from their class).
static String RULE_TRF_PROFILING_PROCESSING_KEEP_ASSOCIATION_AS_IS
          If this rule is enabled, the profiler ignores properties that belong to associations while profiling individual properties.
 
Constructor Summary
Profiler()
           
 
Method Summary
 boolean contains(ProfileIdentifierMap profilesA, String aOwnerName, ProfileIdentifierMap profilesB, String bOwnerName, boolean profileInheritance, List<String> messages)
          Checks if one set of profiles contains another one.
 Set<GenericClassInfo> getAllSubtypes(GenericClassInfo genCi)
           
 void process(GenericModel genModel, Options options, TransformerConfiguration trfConfig, ShapeChangeResult result)
          Processes the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_TRF_PROFILING_PREPROCESSING_MODELCONSISTENCYCHECK

public static final String RULE_TRF_PROFILING_PREPROCESSING_MODELCONSISTENCYCHECK
See Also:
Constant Field Values

RULE_TRF_PROFILING_PREPROCESSING_PROFILESVALUECONSISTENCYCHECK

public static final String RULE_TRF_PROFILING_PREPROCESSING_PROFILESVALUECONSISTENCYCHECK
See Also:
Constant Field Values

RULE_TRF_PROFILING_POSTPROCESSING_REMOVERESIDUALTYPES

public static final String RULE_TRF_PROFILING_POSTPROCESSING_REMOVERESIDUALTYPES
See Also:
Constant Field Values

RULE_TRF_PROFILING_POSTPROCESSING_REMOVEEMPTYPACKAGES

public static final String RULE_TRF_PROFILING_POSTPROCESSING_REMOVEEMPTYPACKAGES
See Also:
Constant Field Values

RULE_TRF_PROFILING_PROCESSING_EXPLICITPROFILESETTINGS

public static final String RULE_TRF_PROFILING_PROCESSING_EXPLICITPROFILESETTINGS
If this rule is enabled, model elements without profile information are treated as if they belonged to no profile (which overrides the default behavior that classes belong to all profiles and properties inherit profiles from their class).

See Also:
Constant Field Values

RULE_TRF_PROFILING_PROCESSING_CLASS_REMOVAL_INCLUDES_ALL_SUBTYPES

public static final String RULE_TRF_PROFILING_PROCESSING_CLASS_REMOVAL_INCLUDES_ALL_SUBTYPES
If this rule is enabled, then the profiler does not only remove individual classes if their profiles do not match, but also all their (direct and indirect) subclasses.

See Also:
Constant Field Values

RULE_TRF_PROFILING_PROCESSING_KEEP_ASSOCIATION_AS_IS

public static final String RULE_TRF_PROFILING_PROCESSING_KEEP_ASSOCIATION_AS_IS
If this rule is enabled, the profiler ignores properties that belong to associations while profiling individual properties.

See Also:
Constant Field Values

PROFILING_CFG_PARAM_RESIDUALTYPEREMOVAL_INCLUDESUBTYPESFOR

public static final String PROFILING_CFG_PARAM_RESIDUALTYPEREMOVAL_INCLUDESUBTYPESFOR
Regular expression to identify the name of the classes for which subtypes shall be included. Can also be used to identify the names of classes to exclude. Note: only direct subclasses of classes identified via this parameter are included in the profile!

See Also:
Constant Field Values

PROFILES_PARAMETER

public static final String PROFILES_PARAMETER
Name of the configuration parameter that contains information about the profile(s) to restrict the model to.

See Also:
Constant Field Values

PROFILES_TAGGED_VALUE

public static final String PROFILES_TAGGED_VALUE
Name of the tagged value that contains the profile information.

See Also:
Constant Field Values

CONSTRAINTHANDLING_PARAMETER

public static final String CONSTRAINTHANDLING_PARAMETER
Name of the configuration parameter that contains information on how to handle constraints during profiling.

See Also:
Constant Field Values
Constructor Detail

Profiler

public Profiler()
Method Detail

process

public void process(GenericModel genModel,
                    Options options,
                    TransformerConfiguration trfConfig,
                    ShapeChangeResult result)
             throws ShapeChangeAbortException
Description copied from interface: Transformer
Processes the model. The given model is changed by the Transformer. NOTE: The TransformationManager ensures that this can be done without side-effects.

Specified by:
process in interface Transformer
Parameters:
genModel - The model to process.
options - Options to control the process execution.
result - Logging target.
Throws:
ShapeChangeAbortException
See Also:
de.interactive_instruments.ShapeChange.Transformation.Transformer#process(de.interactive_instruments.ShapeChange.Model.Model, de.interactive_instruments.ShapeChange.Options, de.interactive_instruments.ShapeChange.TransformerConfiguration, de.interactive_instruments.ShapeChange.ShapeChangeResult)

contains

public boolean contains(ProfileIdentifierMap profilesA,
                        String aOwnerName,
                        ProfileIdentifierMap profilesB,
                        String bOwnerName,
                        boolean profileInheritance,
                        List<String> messages)
Checks if one set of profiles contains another one.

Takes into account whether or not the rule for explicit profile settings is enabled, which matters in case that a model element has no profile information.

Useful for:

Profile inheritance: if profile map B is null but map A is not, map B inherits the profiles from map A. This is irrelevant if the rule for explicit profile settings is enabled.

Parameters:
profilesA - profile map that contains profilesB (or not)
profilesB - profile map that is contained in profilesA (or not)
profileInheritance - true if profile inheritance shall be applied, else false (irrelevant if rule for explicit profile settings is enabled)
messages - used to log the reason(s) why profilesA does not contain profilesB
Returns:

getAllSubtypes

public Set<GenericClassInfo> getAllSubtypes(GenericClassInfo genCi)
Returns:
Set with all direct and indirect subtypes of the given class (if they are contained in the generic model and instance of GenericClassInfo)


Copyright © 2015. All rights reserved.