Claims-Based Factory Pattern for Consistent Object Creation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The standard software factory pattern does not address the relationships between multiple factories, leading to inconsistencies in object creation due to varying factory registration orders across different server startups, especially with OSGi modularization, where the order of factory registration is no longer consistent.
Innovation Solution
A claims-based factory pattern that allows factories to stake a claim for object creation, re-evaluate in light of other factories' claims, and select the factory with the highest claim, enabling consistent factory selection and modularization of application servers.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If factory registration order is used to select factories, then factory selection is simple, but consistency is lost due to varying registration orders across different server startups
Solution Approach 1:
The patent changes the selection parameter from registration order (temporal parameter) to claim strength (functional parameter). Factories evaluate and stake claims based on their capability to create the requested object type, with claims having different strengths based on specialization. This resolves the contradiction by making selection consistent across different server startups while maintaining simplicity through automated claim evaluation.
2Adaptability or versatility
If multiple factories can create the same object, then versatility is improved, but selection complexity increases due to overlapping capabilities
Solution Approach 1:
The patent allows factories to stake claims even if they are not the most specialized, permitting multiple factories to initially claim an object type. This excessive action is then resolved through claim strength comparison and potential re-evaluation, where factories can withdraw claims when seeing stronger competitors. This maintains versatility while managing complexity through a structured resolution process.
Solution Approach 2:
The patent implements feedback through the re-evaluation mechanism. When multiple factories stake claims, they are provided with information about other claiming factories and can re-evaluate their claims. This feedback loop allows factories to withdraw claims in favor of more specialized factories, resolving selection complexity while preserving versatility through multiple potential creators.
Data Source
AI summary
A claims-based factory pattern is described for creating objects on an application server. The pattern extends the functionality of factories to include the operations of staking a claim to creating particular objects and re-evaluating their claim in light of other factories staking claims. A process to create an object includes checking all registered factories to see whether they are willing to stake a claim. The claims are then compared to select a factory having the highest claim. If two or more factories have the same claim, they are asked to re-evaluate the claim by providing them information regarding other factories that have also staked a claim. Once the factories have re-evaluated their claims, their number can be reduced to a single factory that will be used to create the object. Alternatively, if no factory can be singled out, the caller can be informed of the deadlock.


