You’re dealing with three interconnected issues: rule registration mechanics, configuration context association, and Java extension deployment. Let me provide a comprehensive solution addressing all three areas.
First, proper rule registration requires more than runtime code. Your CustomVariantRule class must extend ENOVIA’s VariantRule base class and override the evaluate() method with the correct signature:
public class CustomVariantRule extends VariantRule {
public boolean evaluate(ConfigurationContext ctx) {
// Material compatibility logic
}
}
The registration you showed happens at runtime but doesn’t persist. Instead, register your rule through ENOVIA’s service framework by creating a rule descriptor XML file in your extension’s config directory:
<VariantRuleDefinition name="CUSTOM_MATERIAL_RULE">
<Implementation class="com.custom.CustomVariantRule"/>
<EvaluationPhase>PRE_SELECTION</EvaluationPhase>
</VariantRuleDefinition>
This XML-based registration ensures your rule is discovered by the configuration engine during system initialization.
Second, configure the configuration context association. Custom variant rules must be explicitly linked to configuration contexts where they should apply. This is done through the configuration management admin interface, but for automated deployment, create a context binding file:
<ConfigurationContext name="PRODUCT_ORDER_CONFIG">
<ActiveRules>
<Rule name="CUSTOM_MATERIAL_RULE" priority="100"/>
</ActiveRules>
</ConfigurationContext>
The priority value determines evaluation order relative to other rules. Higher priority rules evaluate first. For material compatibility checks that should filter options before standard variant logic, use a high priority value (90-100 range).
Third, ensure complete Java extension deployment. Your extension must be packaged as an ENOVIA service module with proper manifest entries. Create a service.xml in your extension’s META-INF directory:
<Service name="CustomVariantRuleService">
<Implementation class="com.custom.VariantRuleServiceImpl"/>
<Dependency service="VariantManagementService"/>
</Service>
This registers your rule service with ENOVIA’s dependency injection framework, making it available to the configuration engine across all execution contexts.
The complete deployment process:
- Package your CustomVariantRule class with the rule descriptor XML and service.xml manifest into a JAR file
- Deploy the JAR to ENOVIA’s extension directory: `/Windchill/codebase/ext/custom/
- Register the extension through the admin console: Site > Utilities > Extension Manager
- Restart the application server to load the extension
- In Configuration Management admin, associate CUSTOM_MATERIAL_RULE with your product configuration contexts
- Set the evaluation phase to PRE_SELECTION so material checks happen before variant selection
After deployment, verify the rule is active by checking the configuration engine logs during BOM generation. You should see entries like:
Evaluating rule: CUSTOM_MATERIAL_RULE
Context: PRODUCT_ORDER_CONFIG
Result: 15 variants filtered by material compatibility
If the rule still doesn’t evaluate, check these common issues:
- Rule class constructor must be public and no-arg
- The evaluate() method signature must exactly match the base class
- Configuration context name in the binding file must match the context used by order processing
- Extension JAR must be in the classpath before server startup
For your specific case with material compatibility and environmental requirements, structure your evaluate() method to access the configuration context’s product structure and variant options. The context provides methods to query component materials and filter variants based on your compatibility matrix. Make sure to log evaluation results for debugging, as rule evaluation happens deep in the configuration engine’s workflow and can be hard to trace without explicit logging.
The key insight is that ENOVIA’s variant rule framework requires explicit registration through XML descriptors and service deployment, not just runtime code registration. The configuration engine discovers rules through the service registry at startup, and only rules properly registered and associated with configuration contexts participate in BOM generation workflows.
This draft is based on general ENOVIA knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.