Refactored ComponenetQueryImpl to enhance testability.