class DefaultToolchainManagerPrivate extends DefaultToolchainManager implements ToolchainManagerPrivate {
    @Inject
    public DefaultToolchainManagerPrivate(Map<String, ToolchainFactory> factories) {
        super(factories);
    }

    /**
     * Ctor needed for UT.
     */
    DefaultToolchainManagerPrivate(Map<String, ToolchainFactory> factories, Logger logger) {
        super(factories, logger);
    }

    @Override
    public ToolchainPrivate[] getToolchainsForType(String type, MavenSession session)
            throws MisconfiguredToolchainException {<FILL_FUNCTION_BODY>}

    @Override
    public void storeToolchainToBuildContext(ToolchainPrivate toolchain, MavenSession session) {
        Map<String, Object> context = retrieveContext(session);
        context.put(getStorageKey(toolchain.getType()), toolchain.getModel());
    }
}

        List<ToolchainPrivate> toRet = new ArrayList<>();

        ToolchainFactory fact = factories.get(type);
        if (fact == null) {
            logger.error("Missing toolchain factory for type: " + type + ". Possibly caused by misconfigured project.");
        } else {
            List<ToolchainModel> availableToolchains =
                    org.apache.maven.toolchain.model.ToolchainModel.toolchainModelToApiV4(
                            session.getRequest().getToolchains().get(type));

            if (availableToolchains != null) {
                for (ToolchainModel toolchainModel : availableToolchains) {
                    org.apache.maven.toolchain.model.ToolchainModel tm =
                            new org.apache.maven.toolchain.model.ToolchainModel(toolchainModel);
                    toRet.add(fact.createToolchain(tm));
                }
            }

            // add default toolchain
            ToolchainPrivate tool = fact.createDefaultToolchain();
            if (tool != null) {
                toRet.add(tool);
            }
        }

        return toRet.toArray(new ToolchainPrivate[0]);
    
<methods>public void <init>(Map<java.lang.String,org.apache.maven.toolchain.ToolchainFactory>) ,public static final java.lang.String getStorageKey(java.lang.String) ,public org.apache.maven.toolchain.Toolchain getToolchainFromBuildContext(java.lang.String, org.apache.maven.execution.MavenSession) ,public List<org.apache.maven.toolchain.Toolchain> getToolchains(org.apache.maven.execution.MavenSession, java.lang.String, Map<java.lang.String,java.lang.String>) <variables>final non-sealed Map<java.lang.String,org.apache.maven.toolchain.ToolchainFactory> factories,protected final non-sealed Logger logger